public class S3Repository extends java.lang.Object implements LargeFileRepository
Constructor and Description |
---|
S3Repository(S3Config config)
Construct a LFS repository storing large objects in Amazon S3
|
Modifier and Type | Method and Description |
---|---|
private void |
assertNotEmpty(java.lang.String message,
java.lang.String value) |
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 action
|
private java.net.URL |
getObjectUrl(AnyLongObjectId oid) |
private java.lang.String |
getPath(AnyLongObjectId oid) |
long |
getSize(AnyLongObjectId oid)
Get size of an object
|
Response.Action |
getUploadAction(AnyLongObjectId oid,
long size)
Get upload action
|
Response.Action |
getVerifyAction(AnyLongObjectId id)
Get verify action
|
private void |
validateConfig(S3Config config) |
private S3Config s3Config
public S3Repository(S3Config config)
config
- AWS S3 storage bucket configurationpublic Response.Action getDownloadAction(AnyLongObjectId oid)
getDownloadAction
in interface LargeFileRepository
oid
- id of the object to downloadpublic Response.Action getUploadAction(AnyLongObjectId oid, long size)
getUploadAction
in interface LargeFileRepository
oid
- id of the object to uploadsize
- size of the object to be uploadedpublic Response.Action getVerifyAction(AnyLongObjectId id)
getVerifyAction
in interface LargeFileRepository
id
- id of the object to be verifiednull
if the server
doesn't support or require verificationpublic long getSize(AnyLongObjectId oid) throws java.io.IOException
getSize
in interface LargeFileRepository
oid
- id of the objectjava.io.IOException
protected void cacheObjectMetaData(AnyLongObjectId oid, long size)
getSize(AnyLongObjectId)
to retrieve the object size from the local cache to eliminate the need
for another roundtrip to S3oid
- the object id identifying the object to be cachedsize
- the object's size (in bytes)private void validateConfig(S3Config config)
private void assertNotEmpty(java.lang.String message, java.lang.String value)
private java.net.URL getObjectUrl(AnyLongObjectId oid)
private java.lang.String getPath(AnyLongObjectId oid)