Interface SharedBackend
-
- All Known Implementing Classes:
AbstractSharedBackend
,AzureBlobStoreBackend
,FSBackend
,S3Backend
public interface SharedBackend
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addMetadataRecord(File input, String name)
Adds a metadata record with the specified namevoid
addMetadataRecord(InputStream input, String name)
Adds a metadata record with the specified namevoid
close()
Close backend and release resources like database connection if any.void
deleteAllMetadataRecords(String prefix)
Deletes all the metadata records with the specified prefix.boolean
deleteMetadataRecord(String name)
Deletes the metadata record with the specified namevoid
deleteRecord(DataIdentifier identifier)
Delete record identified by identifier.boolean
exists(DataIdentifier identifier)
This method check the existence of record in backend.Iterator<DataIdentifier>
getAllIdentifiers()
Returns identifiers of all records that exists in backend.List<DataRecord>
getAllMetadataRecords(String prefix)
Gets all the metadata with a specified prefix.Iterator<DataRecord>
getAllRecords()
Returns a list of all DataRecordsDataRecord
getMetadataRecord(String name)
Gets the metadata of the specified name.DataRecord
getRecord(DataIdentifier id)
Gets the record with the specified identifiervoid
init()
Initializeboolean
metadataRecordExists(String name)
Checks if the metadata record with the specified name exists.InputStream
read(DataIdentifier identifier)
Return inputstream of record identified by identifier.void
write(DataIdentifier identifier, File file)
Stores file to backend with identifier used as key.
-
-
-
Method Detail
-
read
InputStream read(DataIdentifier identifier) throws DataStoreException
Return inputstream of record identified by identifier.- Parameters:
identifier
- identifier of record.- Returns:
- inputstream of the record.
- Throws:
DataStoreException
- if record not found or any error.
-
write
void write(DataIdentifier identifier, File file) throws DataStoreException
Stores file to backend with identifier used as key. If key pre-exists, it updates the timestamp of the key.- Parameters:
identifier
- key of the filefile
- file that would be stored in backend.- Throws:
DataStoreException
- for any error.
-
getRecord
DataRecord getRecord(DataIdentifier id) throws DataStoreException
Gets the record with the specified identifier- Parameters:
id
- the record identifier- Returns:
- the metadata DataRecord
- Throws:
DataStoreException
-
getAllIdentifiers
Iterator<DataIdentifier> getAllIdentifiers() throws DataStoreException
Returns identifiers of all records that exists in backend.- Returns:
- iterator consisting of all identifiers
- Throws:
DataStoreException
-
getAllRecords
Iterator<DataRecord> getAllRecords() throws DataStoreException
Returns a list of all DataRecords- Returns:
- iterator over DataRecords
- Throws:
DataStoreException
-
exists
boolean exists(DataIdentifier identifier) throws DataStoreException
This method check the existence of record in backend.- Parameters:
identifier
- identifier to be checked.- Returns:
- true if records exists else false.
- Throws:
DataStoreException
-
close
void close() throws DataStoreException
Close backend and release resources like database connection if any.- Throws:
DataStoreException
-
deleteRecord
void deleteRecord(DataIdentifier identifier) throws DataStoreException
Delete record identified by identifier. No-op if identifier not found.- Parameters:
identifier
-- Throws:
DataStoreException
-
addMetadataRecord
void addMetadataRecord(InputStream input, String name) throws DataStoreException
Adds a metadata record with the specified name- Parameters:
input
- the record input streamname
- the name- Throws:
DataStoreException
-
addMetadataRecord
void addMetadataRecord(File input, String name) throws DataStoreException
Adds a metadata record with the specified name- Parameters:
input
- the record filename
- the name- Throws:
DataStoreException
-
getMetadataRecord
DataRecord getMetadataRecord(String name)
Gets the metadata of the specified name.- Parameters:
name
- the name of the record- Returns:
- the metadata DataRecord
-
getAllMetadataRecords
List<DataRecord> getAllMetadataRecords(String prefix)
Gets all the metadata with a specified prefix.- Parameters:
prefix
- the prefix of the records to retrieve- Returns:
- list of all the metadata DataRecords
-
deleteMetadataRecord
boolean deleteMetadataRecord(String name)
Deletes the metadata record with the specified name- Parameters:
name
- the name of the record- Returns:
- boolean to indicate success of deletion
-
deleteAllMetadataRecords
void deleteAllMetadataRecords(String prefix)
Deletes all the metadata records with the specified prefix.- Parameters:
prefix
- the prefix of the record
-
metadataRecordExists
boolean metadataRecordExists(String name)
Checks if the metadata record with the specified name exists.- Parameters:
name
- the name of the record- Returns:
- whether record exists
-
init
void init() throws DataStoreException
Initialize- Throws:
DataStoreException
-
-