Class FetchRequest

  • Direct Known Subclasses:
    FetchV0Request, FetchV2Request

    abstract class FetchRequest
    extends java.lang.Object
    Common fields between v0/v1/v2 fetch requests.
    • Constructor Summary

      Constructors 
      Constructor Description
      FetchRequest​(java.util.Set<ObjectId> wantIds, int depth, java.util.Set<ObjectId> clientShallowCommits, FilterSpec filterSpec, java.util.Set<java.lang.String> clientCapabilities, int deepenSince, java.util.List<java.lang.String> deepenNotRefs, java.lang.String agent)
      Initialize the common fields of a fetch request.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) java.lang.String getAgent()  
      (package private) java.util.Set<java.lang.String> getClientCapabilities()
      Capabilities that the client wants enabled from the server.
      (package private) java.util.Set<ObjectId> getClientShallowCommits()
      Shallow commits the client already has.
      (package private) java.util.List<java.lang.String> getDeepenNotRefs()  
      (package private) int getDeepenSince()
      The value in a "deepen-since" line in the request, indicating the timestamp where to stop fetching/cloning.
      (package private) int getDepth()  
      (package private) FilterSpec getFilterSpec()  
      (package private) java.util.Set<ObjectId> getWantIds()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • wantIds

        final java.util.Set<ObjectId> wantIds
      • depth

        final int depth
      • clientShallowCommits

        final java.util.Set<ObjectId> clientShallowCommits
      • clientCapabilities

        final java.util.Set<java.lang.String> clientCapabilities
      • deepenSince

        final int deepenSince
      • deepenNotRefs

        final java.util.List<java.lang.String> deepenNotRefs
      • agent

        @Nullable
        final java.lang.String agent
    • Constructor Detail

      • FetchRequest

        FetchRequest​(@NonNull
                     java.util.Set<ObjectId> wantIds,
                     int depth,
                     @NonNull
                     java.util.Set<ObjectId> clientShallowCommits,
                     @NonNull
                     FilterSpec filterSpec,
                     @NonNull
                     java.util.Set<java.lang.String> clientCapabilities,
                     int deepenSince,
                     @NonNull
                     java.util.List<java.lang.String> deepenNotRefs,
                     @Nullable
                     java.lang.String agent)
        Initialize the common fields of a fetch request.
        Parameters:
        wantIds - list of want ids
        depth - how deep to go in the tree
        clientShallowCommits - commits the client has without history
        filterSpec - the filter spec
        clientCapabilities - capabilities sent in the request
        deepenNotRefs - Requests that the shallow clone/fetch should be cut at these specific revisions instead of a depth.
        deepenSince - Requests that the shallow clone/fetch should be cut at a specific time, instead of depth
        agent - agent as reported by the client in the request body
    • Method Detail

      • getWantIds

        @NonNull
        java.util.Set<ObjectId> getWantIds()
        Returns:
        object ids in the "want" (and "want-ref") lines of the request
      • getDepth

        int getDepth()
        Returns:
        the depth set in a "deepen" line. 0 by default.
      • getClientShallowCommits

        @NonNull
        java.util.Set<ObjectId> getClientShallowCommits()
        Shallow commits the client already has. These are sent by the client in "shallow" request lines.
        Returns:
        set of commits the client has declared as shallow.
      • getFilterSpec

        @NonNull
        FilterSpec getFilterSpec()
        Returns:
        the filter spec given in a "filter" line
      • getClientCapabilities

        @NonNull
        java.util.Set<java.lang.String> getClientCapabilities()
        Capabilities that the client wants enabled from the server. Capabilities are options that tune the expected response from the server, like "thin-pack", "no-progress" or "ofs-delta". This list should be a subset of the capabilities announced by the server in its first response. These options are listed and well-defined in the git protocol specification. The agent capability is not included in this set. It can be retrieved via getAgent().
        Returns:
        capabilities sent by the client (excluding the "agent" capability)
      • getDeepenSince

        int getDeepenSince()
        The value in a "deepen-since" line in the request, indicating the timestamp where to stop fetching/cloning.
        Returns:
        timestamp in seconds since the epoch, where to stop the shallow fetch/clone. Defaults to 0 if not set in the request.
      • getDeepenNotRefs

        @NonNull
        java.util.List<java.lang.String> getDeepenNotRefs()
        Returns:
        refs received in "deepen-not" lines.
      • getAgent

        @Nullable
        java.lang.String getAgent()
        Returns:
        string identifying the agent (as sent in the request body by the client)