Class BundleFetchConnection
- All Implemented Interfaces:
AutoCloseable
,Connection
,FetchConnection
TransportBundle
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
boolean
Did the lastFetchConnection.fetch(ProgressMonitor, Collection, Set)
validate graph?protected void
doFetch
(ProgressMonitor monitor, Collection<Ref> want, Set<ObjectId> have) Implementation ofBaseFetchConnection.fetch(ProgressMonitor, Collection, Set)
without checking for multiple fetch.private PackProtocolException
duplicateAdvertisement
(String name) All locks created by the lastFetchConnection.fetch(ProgressMonitor, Collection, Set)
call.private void
private String
readLine
(byte[] hdrbuf) private int
void
setPackLockMessage
(String message) Set the lock message used when holding a pack out of garbage collection.private void
Methods inherited from class org.eclipse.jgit.transport.BaseFetchConnection
didFetchIncludeTags, fetch, fetch
Methods inherited from class org.eclipse.jgit.transport.BaseConnection
available, getMessages, getMessageWriter, getPeerUserAgent, getRef, getRefs, getRefsMap, markStartedOperation, setMessageWriter, setPeerUserAgent
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.jgit.transport.Connection
getMessages, getPeerUserAgent, getRef, getRefs, getRefsMap
-
Field Details
-
transport
-
bin
InputStream bin -
prereqs
-
lockMessage
-
packLock
-
-
Constructor Details
-
BundleFetchConnection
BundleFetchConnection(Transport transportBundle, InputStream src) throws TransportException - Throws:
TransportException
-
-
Method Details
-
readSignature
- Throws:
IOException
-
readBundleV2
- Throws:
IOException
-
duplicateAdvertisement
-
readLine
- Throws:
IOException
-
didFetchTestConnectivity
public boolean didFetchTestConnectivity()Did the lastFetchConnection.fetch(ProgressMonitor, Collection, Set)
validate graph?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.
- Returns:
- true if the last fetch had to perform a connectivity check on the client side in order to succeed; false if the last fetch assumed the remote peer supplied a complete graph.
-
doFetch
protected void doFetch(ProgressMonitor monitor, Collection<Ref> want, Set<ObjectId> have) throws TransportException Implementation ofBaseFetchConnection.fetch(ProgressMonitor, Collection, Set)
without checking for multiple fetch.- Specified by:
doFetch
in classBaseFetchConnection
- Parameters:
monitor
- as inBaseFetchConnection.fetch(ProgressMonitor, Collection, Set)
want
- as inBaseFetchConnection.fetch(ProgressMonitor, Collection, Set)
have
- as inBaseFetchConnection.fetch(ProgressMonitor, Collection, Set)
- Throws:
TransportException
- as inBaseFetchConnection.fetch(ProgressMonitor, Collection, Set)
, but implementation doesn't have to care about multipleBaseFetchConnection.fetch(ProgressMonitor, Collection, Set)
calls, as it is checked in this class.
-
setPackLockMessage
Set the lock message used when holding a pack out of garbage collection.Callers that set a lock message must ensure they call
FetchConnection.getPackLocks()
afterFetchConnection.fetch(ProgressMonitor, Collection, Set)
, even if an exception was thrown, and release the locks that are held.- Parameters:
message
- message to use when holding a pack in place.
-
getPackLocks
All locks created by the lastFetchConnection.fetch(ProgressMonitor, Collection, Set)
call.- Returns:
- collection (possibly empty) of locks created by the last call to fetch. The caller must release these after refs are updated in order to safely permit garbage collection.
-
verifyPrerequisites
- Throws:
TransportException
-
close
public void close()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
Connection.getMessages()
.AutoClosable.close()
declares that it throwsException
. Implementers shouldn't throw checked exceptions. This override narrows the signature to prevent them from doing so.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceConnection
- Specified by:
close
in classBaseConnection
-