public class TransportAmazonS3 extends HttpTransport implements WalkTransport
This transport communicates with the Amazon S3 servers (a non-free commercial hosting service that users must subscribe to). Some users may find transport to and from S3 to be a useful backup service.
The transport does not require any specialized Git support on the remote (server side) repository, as Amazon does not provide any such support. Repository files are retrieved directly through the S3 API, which uses extended HTTP/1.1 semantics. This make it possible to read or write Git data from a remote repository that is stored on S3.
Unlike the HTTP variant (see
TransportHttp
) we rely upon being able to
list objects in a bucket, as the S3 API supports this function. By listing
the bucket contents we can avoid relying on objects/info/packs
or info/refs
in the remote repository.
Concurrent pushing over this transport is not supported. Multiple concurrent push operations may cause confusion in the repository state.
WalkFetchConnection
,
WalkPushConnection
Modifier and Type | Class and Description |
---|---|
(package private) class |
TransportAmazonS3.DatabaseS3 |
Transport.Operation
Modifier and Type | Field and Description |
---|---|
(package private) java.lang.String |
bucket
Bucket the remote repository is stored in.
|
private java.lang.String |
keyPrefix
Key prefix which all objects related to the repository start with.
|
(package private) static TransportProtocol |
PROTO_S3 |
(package private) AmazonS3 |
s3
User information necessary to connect to S3.
|
(package private) static java.lang.String |
S3_SCHEME |
connectionFactory
DEFAULT_FETCH_THIN, DEFAULT_PUSH_THIN, local, REFSPEC_PUSH_ALL, REFSPEC_TAGS, uri
Constructor and Description |
---|
TransportAmazonS3(Repository local,
URIish uri) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
private java.util.Properties |
loadProperties() |
private static java.util.Properties |
loadPropertiesFile(java.io.File propsFile) |
FetchConnection |
openFetch()
Begins a new connection for fetching from the remote repository.
|
PushConnection |
openPush()
Begins a new connection for pushing into the remote repository.
|
getConnectionFactory, setConnectionFactory
applyConfig, fetch, findRemoteRefUpdatesFor, findRemoteRefUpdatesFor, findRemoteRefUpdatesFor, findRemoteRefUpdatesFor, getCredentialsProvider, getFilterBlobLimit, getFilterSpec, getObjectChecker, getOptionReceivePack, getOptionUploadPack, getPackConfig, getPushOptions, getTagOpt, getTimeout, getTransportProtocols, getURI, isCheckFetchedObjects, isDryRun, isFetchThin, isPushAtomic, isPushThin, isRemoveDeletedRefs, open, open, open, open, open, open, open, openAll, openAll, openAll, openAll, push, push, register, setCheckFetchedObjects, setCredentialsProvider, setDryRun, setFetchThin, setFilterBlobLimit, setFilterSpec, setObjectChecker, setOptionReceivePack, setOptionUploadPack, setPackConfig, setPushAtomic, setPushOptions, setPushThin, setRemoveDeletedRefs, setTagOpt, setTimeout, unregister
static final java.lang.String S3_SCHEME
static final TransportProtocol PROTO_S3
final AmazonS3 s3
final java.lang.String bucket
private final java.lang.String keyPrefix
The prefix does not start with "/".
The prefix does not end with "/". The trailing slash is stripped during the constructor if a trailing slash was supplied in the URIish.
All files within the remote repository start with
keyPrefix + "/"
.
TransportAmazonS3(Repository local, URIish uri) throws NotSupportedException
NotSupportedException
private java.util.Properties loadProperties() throws NotSupportedException
NotSupportedException
private static java.util.Properties loadPropertiesFile(java.io.File propsFile) throws NotSupportedException
NotSupportedException
public FetchConnection openFetch() throws TransportException
If the transport has no local repository, the fetch connection can only be used for reading remote refs.
openFetch
in class Transport
TransportException
- the remote connection could not be established.public PushConnection openPush() throws TransportException
openPush
in class Transport
TransportException
- the remote connection could not be establishedpublic void close()
Close any resources used by this transport.
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.
AutoClosable.close()
declares that it throws Exception
.
Implementers shouldn't throw checked exceptions. This override narrows
the signature to prevent them from doing so.