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
org.) 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 |
|---|---|
| pack-priv class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final String | bucket
Bucket the remote repository is stored in. |
| private final String | keyPrefix
Key prefix which all objects related to the repository start with. |
| pack-priv static final TransportProtocol | |
| pack-priv final AmazonS3 | s3
User information necessary to connect to S3. |
| pack-priv static final String |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Implements abstract org. Implements java. Closes this resource, relinquishing any underlying resources. |
| private Properties | |
| private static Properties | |
| public FetchConnection | openFetch()
Implements abstract org. Begins a new connection for fetching from the remote repository. |
| public PushConnection | openPush()
Implements abstract org. Begins a new connection for pushing into the remote repository. |
| bucket | back to summary |
|---|---|
| pack-priv final String bucket Bucket the remote repository is stored in. | |
| keyPrefix | back to summary |
|---|---|
| private final String keyPrefix Key prefix which all objects related to the repository start with. 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
| |
| PROTO_S3 | back to summary |
|---|---|
| pack-priv static final TransportProtocol PROTO_S3 | |
| s3 | back to summary |
|---|---|
| pack-priv final AmazonS3 s3 User information necessary to connect to S3. | |
| S3_SCHEME | back to summary |
|---|---|
| pack-priv static final String S3_SCHEME | |
| TransportAmazonS3 | back to summary |
|---|---|
| pack-priv TransportAmazonS3(final Repository local, final URIish uri) throws NotSupportedException | |
| close | back to summary |
|---|---|
| public void close() Implements abstract org. Implements java. 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 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.
| |
| loadProperties | back to summary |
|---|---|
| private Properties loadProperties() throws NotSupportedException | |
| loadPropertiesFile | back to summary |
|---|---|
| private static Properties loadPropertiesFile(File propsFile) throws NotSupportedException | |
| openFetch | back to summary |
|---|---|
| public FetchConnection openFetch() throws TransportException Implements abstract org. Doc from org. Begins a new connection for fetching from the remote repository. If the transport has no local repository, the fetch connection can only be used for reading remote refs.
| |
| openPush | back to summary |
|---|---|
| public PushConnection openPush() throws TransportException Implements abstract org. Doc from org. Begins a new connection for pushing into the remote repository.
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | close()
Implements abstract org. Close any resources used by this connection. |
| pack-priv void | deleteFile(String
name of the item to be removed, relative to the current object
database. path)Overrides org. Delete a file from the object database. |
| pack-priv Collection | getAlternates()
Implements abstract org. Obtain alternate connections to alternate object databases (if any). |
| pack-priv Collection | getPackNames()
Implements abstract org. Obtain the list of available packs (if any). |
| pack-priv URIish | |
| private Ref. | |
| pack-priv WalkRemoteObjectDatabase. | open(String
location of the file to read, relative to this objects
directory (e.g.
path)cb/95df6ab7ae9e57571511ef451cf33767c26dd2 or
pack/pack-035760ab452d6eebd123add421f253ce7682355a.pack).Implements abstract org. Open a single file for reading. |
| pack-priv WalkRemoteObjectDatabase | openAlternate(String
the location of the new alternate, relative to the current
object database. location)Implements abstract org. Create a new connection for a discovered alternate object database
This method is typically called by |
| pack-priv Map | |
| private void | |
| private Ref | |
| private String | |
| pack-priv OutputStream | writeFile(final String
name of the file to write, relative to the current object
database. path, final ProgressMonitor (optional) progress monitor to post write completion to during
the stream's close method. monitor, final String (optional) task name to display during the close method. monitorTask)Overrides org. Open a remote file for writing. |
| pack-priv void | writeFile(String
name of the file to write, relative to the current object
database. path, byte[] complete new content of the file. data)Overrides org. Atomically write a remote file. |
| bucketName | back to summary |
|---|---|
| private final String bucketName | |
| objectsKey | back to summary |
|---|---|
| private final String objectsKey | |
| DatabaseS3 | back to summary |
|---|---|
| pack-priv DatabaseS3(final String b, final String o) | |
| close | back to summary |
|---|---|
| pack-priv void close() Implements abstract org. Doc from org. 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.
| |
| deleteFile | back to summary |
|---|---|
| pack-priv void deleteFile(String path) throws IOException Overrides org. Doc from org. Delete a file from the object database.
Path may start with When possible empty directories must be removed, up to but not including the current object database directory itself. This method does not support deletion of directories.
| |
| getAlternates | back to summary |
|---|---|
| pack-priv Collection Implements abstract org. Doc from org. Obtain alternate connections to alternate object databases (if any).
Alternates are typically read from the file
Alternates may reuse the same network connection handle, however the
fetch connection will
| |
| getPackNames | back to summary |
|---|---|
| pack-priv Collection Implements abstract org. Doc from org. Obtain the list of available packs (if any).
Pack names should be the file name in the packs directory, that is
| |
| getURI | back to summary |
|---|---|
| pack-priv URIish getURI() Implements abstract org.
| |
| loose | back to summary |
|---|---|
| private Ref. | |
| open | back to summary |
|---|---|
| pack-priv WalkRemoteObjectDatabase. Implements abstract org. Doc from org. Open a single file for reading.
Implementors should make every attempt possible to ensure
This method is recommended for already compressed files like loose objects
and pack files. For text files, see
| |
| openAlternate | back to summary |
|---|---|
| pack-priv WalkRemoteObjectDatabase openAlternate(String location) throws IOException Implements abstract org. Doc from org. Create a new connection for a discovered alternate object database
This method is typically called by
| |
| readAdvertisedRefs | back to summary |
|---|---|
| pack-priv Map | |
| readLooseRefs | back to summary |
|---|---|
| private void readLooseRefs(TreeMap<String, Ref> avail) throws TransportException | |
| readRef | back to summary |
|---|---|
| private Ref readRef(TreeMap<String, Ref> avail, String rn) throws TransportException | |
| resolveKey | back to summary |
|---|---|
| private String resolveKey(String subpath) | |
| writeFile | back to summary |
|---|---|
| pack-priv OutputStream writeFile(final String path, final ProgressMonitor monitor, final String monitorTask) throws IOException Overrides org. Doc from org. Open a remote file for writing.
Path may start with The requested path may or may not exist. If the path already exists as a file the file should be truncated and completely replaced. This method creates any missing parent directories, if necessary.
| |
| writeFile | back to summary |
|---|---|
| pack-priv void writeFile(String path, byte[] data) throws IOException Overrides org. Doc from org. Atomically write a remote file. This method attempts to perform as atomic of an update as it can, reducing (or eliminating) the time that clients might be able to see partial file content. This method is not suitable for very large transfers as the complete content must be passed as an argument.
Path may start with The requested path may or may not exist. If the path already exists as a file the file should be truncated and completely replaced. This method creates any missing parent directories, if necessary.
| |