Class S3Repository

java.lang.Object
org.eclipse.jgit.lfs.server.s3.S3Repository
All Implemented Interfaces:
LargeFileRepository

public class S3Repository extends Object implements LargeFileRepository
Repository storing LFS objects in Amazon S3
Since:
4.3
  • Field Details

  • Constructor Details

    • S3Repository

      public S3Repository(S3Config config)
      Construct a LFS repository storing large objects in Amazon S3
      Parameters:
      config - AWS S3 storage bucket configuration
  • Method Details

    • getDownloadAction

      public Response.Action getDownloadAction(AnyLongObjectId oid)
      Get download action
      Specified by:
      getDownloadAction in interface LargeFileRepository
      Parameters:
      oid - id of the object to download
      Returns:
      Action for downloading the object
    • getUploadAction

      public Response.Action getUploadAction(AnyLongObjectId oid, long size)
      Get upload action
      Specified by:
      getUploadAction in interface LargeFileRepository
      Parameters:
      oid - id of the object to upload
      size - size of the object to be uploaded
      Returns:
      Action for uploading the object
    • getVerifyAction

      public Response.Action getVerifyAction(AnyLongObjectId id)
      Get verify action
      Specified by:
      getVerifyAction in interface LargeFileRepository
      Parameters:
      id - id of the object to be verified
      Returns:
      Action for verifying the object, or null if the server doesn't support or require verification
    • getSize

      public long getSize(AnyLongObjectId oid) throws IOException
      Get size of an object
      Specified by:
      getSize in interface LargeFileRepository
      Parameters:
      oid - id of the object
      Returns:
      length of the object content in bytes, -1 if the object doesn't exist
      Throws:
      IOException
    • cacheObjectMetaData

      protected void cacheObjectMetaData(AnyLongObjectId oid, long size)
      Cache metadata (size) for an object to avoid extra roundtrip to S3 in order to retrieve this metadata for a given object. Subclasses can implement a local cache and override {getSize(AnyLongObjectId) to retrieve the object size from the local cache to eliminate the need for another roundtrip to S3
      Parameters:
      oid - the object id identifying the object to be cached
      size - the object's size (in bytes)
    • validateConfig

      private void validateConfig(S3Config config)
    • assertNotEmpty

      private void assertNotEmpty(String message, String value)
    • getObjectUrl

      private URL getObjectUrl(AnyLongObjectId oid)
    • getPath

      private String getPath(AnyLongObjectId oid)