class BundleFetchConnection extends BaseFetchConnection
TransportBundle
Modifier and Type | Field and Description |
---|---|
(package private) java.io.InputStream |
bin |
private java.lang.String |
lockMessage |
private PackLock |
packLock |
(package private) java.util.Map<ObjectId,java.lang.String> |
prereqs |
private Transport |
transport |
Constructor and Description |
---|
BundleFetchConnection(Transport transportBundle,
java.io.InputStream src) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
didFetchTestConnectivity()
Did the last
FetchConnection.fetch(ProgressMonitor, Collection, Set) validate
graph? |
protected void |
doFetch(ProgressMonitor monitor,
java.util.Collection<Ref> want,
java.util.Set<ObjectId> have)
Implementation of
BaseFetchConnection.fetch(ProgressMonitor, Collection, Set)
without checking for multiple fetch. |
private PackProtocolException |
duplicateAdvertisement(java.lang.String name) |
java.util.Collection<PackLock> |
getPackLocks()
All locks created by the last
FetchConnection.fetch(ProgressMonitor, Collection, Set) call. |
private void |
readBundleV2() |
private java.lang.String |
readLine(byte[] hdrbuf) |
private int |
readSignature() |
void |
setPackLockMessage(java.lang.String message)
Set the lock message used when holding a pack out of garbage collection.
|
private void |
verifyPrerequisites() |
didFetchIncludeTags, fetch, fetch
available, getMessages, getMessageWriter, getPeerUserAgent, getRef, getRefs, getRefsMap, markStartedOperation, setMessageWriter, setPeerUserAgent
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMessages, getPeerUserAgent, getRef, getRefs, getRefsMap
private final Transport transport
java.io.InputStream bin
final java.util.Map<ObjectId,java.lang.String> prereqs
private java.lang.String lockMessage
private PackLock packLock
BundleFetchConnection(Transport transportBundle, java.io.InputStream src) throws TransportException
TransportException
private int readSignature() throws java.io.IOException
java.io.IOException
private void readBundleV2() throws java.io.IOException
java.io.IOException
private PackProtocolException duplicateAdvertisement(java.lang.String name)
private java.lang.String readLine(byte[] hdrbuf) throws java.io.IOException
java.io.IOException
public boolean didFetchTestConnectivity()
FetchConnection.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.
protected void doFetch(ProgressMonitor monitor, java.util.Collection<Ref> want, java.util.Set<ObjectId> have) throws TransportException
BaseFetchConnection.fetch(ProgressMonitor, Collection, Set)
without checking for multiple fetch.doFetch
in class BaseFetchConnection
monitor
- as in BaseFetchConnection.fetch(ProgressMonitor, Collection, Set)
want
- as in BaseFetchConnection.fetch(ProgressMonitor, Collection, Set)
have
- as in BaseFetchConnection.fetch(ProgressMonitor, Collection, Set)
TransportException
- as in BaseFetchConnection.fetch(ProgressMonitor, Collection, Set)
, but
implementation doesn't have to care about multiple
BaseFetchConnection.fetch(ProgressMonitor, Collection, Set)
calls, as it
is checked in this class.public void setPackLockMessage(java.lang.String message)
Callers that set a lock message must ensure they call
FetchConnection.getPackLocks()
after
FetchConnection.fetch(ProgressMonitor, Collection, Set)
, even if an exception
was thrown, and release the locks that are held.
message
- message to use when holding a pack in place.public java.util.Collection<PackLock> getPackLocks()
FetchConnection.fetch(ProgressMonitor, Collection, Set)
call.private void verifyPrerequisites() throws TransportException
TransportException
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 throws Exception
.
Implementers shouldn't throw checked exceptions. This override narrows
the signature to prevent them from doing so.
close
in interface java.lang.AutoCloseable
close
in interface Connection
close
in class BaseConnection