Class S3Repository

    • Field Detail

    • Constructor Detail

      • S3Repository

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

      • getSize

        public long getSize​(AnyLongObjectId oid)
                     throws java.io.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:
        java.io.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​(java.lang.String message,
                                    java.lang.String value)
      • getObjectUrl

        private java.net.URL getObjectUrl​(AnyLongObjectId oid)