public interface DataStore
A data store should be fully thread-safe, i.e. it should be possible to add and access data records concurrently. Optimally even separate processes should be able to concurrently access the data store with zero interprocess synchronization.
Modifier and Type | Method and Description |
---|---|
DataRecord |
addRecord(InputStream stream)
Creates a new data record.
|
void |
clearInUse()
Clear the in-use list.
|
void |
close()
Close the data store
|
int |
deleteAllOlderThan(long min)
Delete objects that have a modified date older than the specified date.
|
Iterator<DataIdentifier> |
getAllIdentifiers()
Get all identifiers.
|
int |
getMinRecordLength()
Get the minimum size of an object that should be stored in this data store.
|
DataRecord |
getRecord(DataIdentifier identifier)
Returns the identified data record.
|
DataRecord |
getRecordFromReference(String reference)
Returns the record that matches the given binary reference.
|
DataRecord |
getRecordIfStored(DataIdentifier identifier)
Check if a record for the given identifier exists, and return it if yes.
|
void |
init(String homeDir)
Initialized the data store
|
void |
updateModifiedDateOnAccess(long before)
From now on, update the modified date of an object even when accessing it.
|
DataRecord getRecordIfStored(DataIdentifier identifier) throws DataStoreException
identifier
- data identifierDataStoreException
- if the data store could not be accessedDataRecord getRecord(DataIdentifier identifier) throws DataStoreException
identifier
- data identifierDataStoreException
- if the data store could not be accessed,
or if the given identifier is invalidDataRecord getRecordFromReference(String reference) throws DataStoreException
null
if the reference is invalid, for example if it
points to a record that does not exist.reference
- binary referencenull
DataStoreException
- if the data store could not be accessedDataRecord addRecord(InputStream stream) throws DataStoreException
The given stream is consumed and not closed by this method. It is the responsibility of the caller to close the stream. A typical call pattern would be:
InputStream stream = ...; try { record = store.addRecord(stream); } finally { stream.close(); }
stream
- binary streamDataStoreException
- if the data store could not be accessedvoid updateModifiedDateOnAccess(long before)
before
- - update the modified date to the current time if it is older than this valueint deleteAllOlderThan(long min) throws DataStoreException
min
- the minimum timeDataStoreException
Iterator<DataIdentifier> getAllIdentifiers() throws DataStoreException
DataStoreException
- if the list could not be readvoid init(String homeDir) throws javax.jcr.RepositoryException
homeDir
- the home directory of the repositoryjavax.jcr.RepositoryException
int getMinRecordLength()
void close() throws DataStoreException
DataStoreException
- if a problem occurredvoid clearInUse()
Copyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.