Since there are no Git-specific smarts on the remote side of the connection the client side must determine which objects it needs to copy in order to completely fetch the requested refs and their history. The generic walk support in this class parses each individual object (once it has been copied to the local repository) and examines the list of objects that must also be copied to create a complete history. Objects which are already available locally are retained (and not copied), saving bandwidth for incremental fetches. Pack files are copied from the remote repository only as a last resort, as the entire pack must be copied locally in order to access any single object.
This fetch connection does not actually perform the object data transfer.
Instead it delegates the transfer to a WalkRemoteObjectDatabase,
which knows how to read individual files from the remote repository and
supply the data as a standard Java InputStream.
WalkRemoteObjectDatabase
| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private final RevFlag | COMPLETE
Objects whose direct dependents we know we have (or will have). |
| private final HashMap | fetchErrors
Errors received while trying to obtain an object. |
| private final MutableObjectId | |
| private final RevFlag | IN_WORK_QUEUE
Objects that have already entered |
| pack-priv final ObjectInserter | |
| private int | lastRemoteIdx
Most recently used item in |
| pack-priv final Repository | local
The repository this transport fetches into, or pushes out of. |
| private final DateRevQueue | localCommitQueue
Commits already reachable from all local refs. |
| private final RevFlag | LOCALLY_SEEN
Commits that have already entered |
| pack-priv String | |
| private final Deque | noAlternatesYet
Databases we have not yet obtained the alternates from. |
| private final Deque | noPacksYet
Databases we have not yet obtained the list of packs from. |
| pack-priv final ObjectChecker | objCheck
If not null the validator for received objects. |
| pack-priv final List | |
| private final Set | packsConsidered
Packs whose indexes we have looked at in |
| private final ObjectReader | |
| private final List | remotes
List of all remote repositories we may need to get objects out of. |
| private final RevWalk | |
| private final TreeWalk | |
| private final Map | unfetchedPacks
Packs we have discovered, but have not yet fetched locally. |
| private Deque | workQueue
Objects we need to copy from the remote repository. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private boolean | |
| public void | close()
Implements abstract org. Implements org. Closes this resource, relinquishing any underlying resources. |
| public boolean | didFetchTestConnectivity()
Implements org. Did the last |
| protected void | doFetch(final ProgressMonitor monitor, final Collection<Ref> want, final Set<ObjectId> have)
Implements abstract org. Implementation of |
| private boolean | downloadLooseObject(final AnyObjectId id, final String looseName, final WalkRemoteObjectDatabase remote)
|
| private void | |
| private boolean | |
| private boolean | |
| private Collection | |
| public Collection | getPackLocks()
Implements org. All locks created by the last
|
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| public void | setPackLockMessage(String
message to use when holding a pack in place. message)Implements org. Set the lock message used when holding a pack out of garbage collection. |
| private Deque | |
| private void |
| COMPLETE | back to summary |
|---|---|
| private final RevFlag COMPLETE Objects whose direct dependents we know we have (or will have). | |
| fetchErrors | back to summary |
|---|---|
| private final HashMap<ObjectId, List<Throwable>> fetchErrors Errors received while trying to obtain an object. If the fetch winds up failing because we cannot locate a specific object then we need to report all errors related to that object back to the caller as there may be cascading failures. | |
| idBuffer | back to summary |
|---|---|
| private final MutableObjectId idBuffer | |
| IN_WORK_QUEUE | back to summary |
|---|---|
| private final RevFlag IN_WORK_QUEUE Objects that have already entered | |
| inserter | back to summary |
|---|---|
| pack-priv final ObjectInserter inserter Inserter to write objects onto | |
| lastRemoteIdx | back to summary |
|---|---|
| private int lastRemoteIdx Most recently used item in | |
| local | back to summary |
|---|---|
| pack-priv final Repository local The repository this transport fetches into, or pushes out of. | |
| localCommitQueue | back to summary |
|---|---|
| private final DateRevQueue localCommitQueue Commits already reachable from all local refs. | |
| LOCALLY_SEEN | back to summary |
|---|---|
| private final RevFlag LOCALLY_SEEN Commits that have already entered | |
| lockMessage | back to summary |
|---|---|
| pack-priv String lockMessage | |
| noAlternatesYet | back to summary |
|---|---|
| private final Deque<WalkRemoteObjectDatabase> noAlternatesYet Databases we have not yet obtained the alternates from. | |
| noPacksYet | back to summary |
|---|---|
| private final Deque<WalkRemoteObjectDatabase> noPacksYet Databases we have not yet obtained the list of packs from. | |
| objCheck | back to summary |
|---|---|
| pack-priv final ObjectChecker objCheck If not null the validator for received objects. | |
| packLocks | back to summary |
|---|---|
| pack-priv final List<PackLock> packLocks | |
| packsConsidered | back to summary |
|---|---|
| private final Set<String> packsConsidered Packs whose indexes we have looked at in We try to avoid getting duplicate copies of the same pack through multiple alternates by only looking at packs whose names are not yet in this collection. | |
| reader | back to summary |
|---|---|
| private final ObjectReader reader Inserter to read objects from | |
| remotes | back to summary |
|---|---|
| private final List<WalkRemoteObjectDatabase> remotes List of all remote repositories we may need to get objects out of. The first repository in the list is the one we were asked to fetch from; the remaining repositories point to the alternate locations we can fetch objects through. | |
| revWalk | back to summary |
|---|---|
| private final RevWalk revWalk | |
| treeWalk | back to summary |
|---|---|
| private final TreeWalk treeWalk | |
| unfetchedPacks | back to summary |
|---|---|
| private final Map<String, WalkFetchConnection. Packs we have discovered, but have not yet fetched locally. | |
| workQueue | back to summary |
|---|---|
| private Deque<ObjectId> workQueue Objects we need to copy from the remote repository. | |
| WalkFetchConnection | back to summary |
|---|---|
| pack-priv WalkFetchConnection(WalkTransport t, WalkRemoteObjectDatabase w) | |
| alreadyHave | back to summary |
|---|---|
| private boolean alreadyHave(AnyObjectId id) throws TransportException | |
| close | back to summary |
|---|---|
| public void close() Implements abstract org. Implements org. Doc from org. Closes this resource, relinquishing any underlying resources.
This method is invoked automatically on objects managed by the
Close any resources used by this connection. If the remote repository is contacted by a network socket this method must close that network socket, disconnecting the two peers. If the remote repository is actually local (same system) this method must close any open file handles used to read the "remote" repository.
If additional messages were produced by the remote peer, these should
still be retained in the connection instance for
| |
| didFetchTestConnectivity | back to summary |
|---|---|
| public boolean didFetchTestConnectivity() Implements org. Doc from org. Did the last Some transports walk the object graph on the client side, with the client looking for what objects it is missing and requesting them individually from the remote peer. By virtue of completing the fetch call the client implicitly tested the object connectivity, as every object in the graph was either already local or was requested successfully from the peer. In such transports this method returns true. Some transports assume the remote peer knows the Git object graph and is able to supply a fully connected graph to the client (although it may only be transferring the parts the client does not yet have). Its faster to assume such remote peers are well behaved and send the correct response to the client. In such transports this method returns false.
| |
| doFetch | back to summary |
|---|---|
| protected void doFetch(final ProgressMonitor monitor, final Collection<Ref> want, final Set<ObjectId> have) throws TransportException Implements abstract org. Doc from org. Implementation of
| |
| downloadLooseObject | back to summary |
|---|---|
| private boolean downloadLooseObject(final AnyObjectId id, final String looseName, final WalkRemoteObjectDatabase remote) throws TransportException | |
| downloadObject | back to summary |
|---|---|
| private void downloadObject(ProgressMonitor pm, AnyObjectId id) throws TransportException | |
| downloadPackedObject | back to summary |
|---|---|
| private boolean downloadPackedObject(ProgressMonitor monitor, AnyObjectId id) throws TransportException | |
| downloadPackedObject | back to summary |
|---|---|
private boolean downloadPackedObject(final ProgressMonitor monitor, final AnyObjectId id, Set<String> brokenPacks) throws TransportException
| |
| expandOneAlternate | back to summary |
|---|---|
| private Collection | |
| getPackLocks | back to summary |
|---|---|
| public Collection Implements org. Doc from org. All locks created by the last
| |
| markLocalCommitsComplete | back to summary |
|---|---|
| private void markLocalCommitsComplete(int until) throws TransportException | |
| markLocalObjComplete | back to summary |
|---|---|
| private void markLocalObjComplete(RevObject obj) throws IOException | |
| markLocalRefsComplete | back to summary |
|---|---|
| private void markLocalRefsComplete(Set<ObjectId> have) throws TransportException | |
| markTreeComplete | back to summary |
|---|---|
| private void markTreeComplete(RevTree tree) throws IOException | |
| needs | back to summary |
|---|---|
| private void needs(RevObject obj) | |
| process | back to summary |
|---|---|
| private void process(ObjectId id) throws TransportException | |
| processBlob | back to summary |
|---|---|
| private void processBlob(RevObject obj) throws TransportException | |
| processCommit | back to summary |
|---|---|
| private void processCommit(RevObject obj) throws TransportException | |
| processTag | back to summary |
|---|---|
| private void processTag(RevObject obj) | |
| processTree | back to summary |
|---|---|
| private void processTree(RevObject obj) throws TransportException | |
| pushLocalCommit | back to summary |
|---|---|
| private void pushLocalCommit(RevCommit p) throws MissingObjectException, IOException | |
| queueWants | back to summary |
|---|---|
| private void queueWants(Collection<Ref> want) throws TransportException | |
| recordError | back to summary |
|---|---|
| private void recordError(AnyObjectId id, Throwable what) | |
| setPackLockMessage | back to summary |
|---|---|
| public void setPackLockMessage(String message) Implements org. Doc from org. Set the lock message used when holding a pack out of garbage collection.
Callers that set a lock message must ensure they call
| |
| swapFetchQueue | back to summary |
|---|---|
| private Deque | |
| verifyAndInsertLooseObject | back to summary |
|---|---|
| private void verifyAndInsertLooseObject(final AnyObjectId id, final byte[] compressed) throws IOException | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final WalkRemoteObjectDatabase | |
| pack-priv final String | |
| pack-priv PackIndex | |
| pack-priv final String | |
| pack-priv File |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| pack-priv void |
| connection | back to summary |
|---|---|
| pack-priv final WalkRemoteObjectDatabase connection | |
| idxName | back to summary |
|---|---|
| pack-priv final String idxName | |
| index | back to summary |
|---|---|
| pack-priv PackIndex index | |
| packName | back to summary |
|---|---|
| pack-priv final String packName | |
| tmpIdx | back to summary |
|---|---|
| pack-priv File tmpIdx | |
| RemotePack | back to summary |
|---|---|
| pack-priv RemotePack(WalkRemoteObjectDatabase c, String pn) | |
| downloadPack | back to summary |
|---|---|
| pack-priv void downloadPack(ProgressMonitor monitor) throws IOException | |
| openIndex | back to summary |
|---|---|
| pack-priv void openIndex(ProgressMonitor pm) throws IOException | |