Package org.eclipse.jgit.lfs.server.s3
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
-
-
Constructor Summary
Constructors Constructor Description S3Repository(S3Config config)
Construct a LFS repository storing large objects in Amazon S3
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.Response.Action
getDownloadAction(AnyLongObjectId oid)
Get download actionlong
getSize(AnyLongObjectId oid)
Get size of an objectResponse.Action
getUploadAction(AnyLongObjectId oid, long size)
Get upload actionResponse.Action
getVerifyAction(AnyLongObjectId id)
Get verify action
-
-
-
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
-
getDownloadAction
public Response.Action getDownloadAction(AnyLongObjectId oid)
Get download action- Specified by:
getDownloadAction
in interfaceLargeFileRepository
- 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 interfaceLargeFileRepository
- Parameters:
oid
- id of the object to uploadsize
- 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 interfaceLargeFileRepository
- 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 interfaceLargeFileRepository
- 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 cachedsize
- the object's size (in bytes)
-
-