public class S3Backend extends AbstractBackend
| Constructor and Description |
|---|
S3Backend() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close backend and release resources like database connection if any.
|
Set<DataIdentifier> |
deleteAllOlderThan(long min)
Delete all records which are older than timestamp.
|
void |
deleteRecord(DataIdentifier identifier)
Delete record identified by identifier.
|
boolean |
exists(DataIdentifier identifier)
Check if record identified by identifier exists in Amazon S3.
|
boolean |
exists(DataIdentifier identifier,
boolean touch)
This method check the existence of record in backend.
|
Iterator<DataIdentifier> |
getAllIdentifiers()
Returns identifiers of all records that exists in backend.
|
String |
getBucket() |
long |
getLastModified(DataIdentifier identifier)
Return lastModified of record identified by identifier.
|
long |
getLength(DataIdentifier identifier)
Return length of record identified by identifier.
|
void |
init(CachingDataStore store,
String homeDir,
Properties prop) |
void |
init(CachingDataStore store,
String homeDir,
String config)
Initialize S3Backend.
|
InputStream |
read(DataIdentifier identifier)
Return inputstream of record identified by identifier.
|
void |
setBucket(String bucket) |
void |
setProperties(Properties properties)
Properties used to configure the backend.
|
void |
touch(DataIdentifier identifier,
long minModifiedDate)
Update the lastModified of record if it's lastModified < minModifiedDate.
|
void |
touchAsync(DataIdentifier identifier,
long minModifiedDate,
AsyncTouchCallback callback)
Update the lastModified of record if it's lastModified < minModifiedDate
asynchronously.
|
void |
write(DataIdentifier identifier,
File file)
It uploads file to Amazon S3.
|
void |
writeAsync(DataIdentifier identifier,
File file,
AsyncUploadCallback callback)
Write file to backend in asynchronous mode.
|
createAsyncWriteExecutor, getAsyncWriteExecutor, getAsyncWritePoolSize, getConfig, getDataStore, getHomeDir, setAsyncWritePoolSize, setConfig, setDataStore, setHomeDirpublic void init(CachingDataStore store, String homeDir, String config) throws DataStoreException
init in interface Backendinit in class AbstractBackendstore - CachingDataStorehomeDir - path of repository home dir.config - path of config property file.DataStoreExceptionpublic void init(CachingDataStore store, String homeDir, Properties prop) throws DataStoreException
DataStoreExceptionpublic void write(DataIdentifier identifier, File file) throws DataStoreException
identifier - key of the filefile - file that would be stored in backend.DataStoreException - for any error.public void writeAsync(DataIdentifier identifier, File file, AsyncUploadCallback callback) throws DataStoreException
Backendcallback - Callback interface to called after upload succeed or failed.DataStoreExceptionpublic boolean exists(DataIdentifier identifier) throws DataStoreException
identifier - identifier to be checked.DataStoreExceptionpublic boolean exists(DataIdentifier identifier, boolean touch) throws DataStoreException
BackendDataStoreExceptionpublic void touchAsync(DataIdentifier identifier, long minModifiedDate, AsyncTouchCallback callback) throws DataStoreException
BackendAsyncTouchCallback methods. If identifier's lastModified >
minModified AsyncTouchCallback.onAbort(AsyncTouchResult) is
called. Any exception is communicated through
AsyncTouchCallback.onFailure(AsyncTouchResult) . On successful
update of lastModified,
AsyncTouchCallback.onSuccess(AsyncTouchResult)
is invoked.DataStoreExceptionpublic void touch(DataIdentifier identifier, long minModifiedDate) throws DataStoreException
BackendDataStoreExceptionpublic InputStream read(DataIdentifier identifier) throws DataStoreException
Backendidentifier - identifier of record.DataStoreException - if record not found or any error.public Iterator<DataIdentifier> getAllIdentifiers() throws DataStoreException
BackendDataStoreExceptionpublic long getLastModified(DataIdentifier identifier) throws DataStoreException
Backendidentifier - identifier of record.DataStoreException - if record not found or any error.public long getLength(DataIdentifier identifier) throws DataStoreException
Backendidentifier - identifier of record.DataStoreException - if record not found or any error.public void deleteRecord(DataIdentifier identifier) throws DataStoreException
BackendDataStoreExceptionpublic Set<DataIdentifier> deleteAllOlderThan(long min) throws DataStoreException
BackendSet of identifiers which are deleted.DataStoreExceptionpublic void close()
throws DataStoreException
AbstractBackendclose in interface Backendclose in class AbstractBackendDataStoreExceptionpublic String getBucket()
public void setBucket(String bucket)
public void setProperties(Properties properties)
properties - to configure S3BackendCopyright © 2004–2024 The Apache Software Foundation. All rights reserved.