Interface DataStore

Append-only store for binary streams. A data store consists of a number
of identifiable data records that each contain a distinct binary stream.
New binary streams can be added to the data store, but existing streams
are never removed or modified.

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.

getRecord

Returns the identified data record. The given identifier should be
the identifier of a previously saved data record. Since records are
never removed, there should never be cases where the identified record
is not found. Abnormal cases like that are treated as errors and
handled by throwing an exception.

Parameters:

identifier - data identifier

Returns:

identified data record

Throws:

DataStoreException - if the data store could not be accessed,
or if the given identifier is invalid

addRecord

Creates a new data record. The given binary stream is consumed and
a binary record containing the consumed stream is created and returned.
If the same stream already exists in another record, then that record
is returned instead of creating a new one.

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:

updateModifiedDateOnAccess

void updateModifiedDateOnAccess(long before)

From now on, update the modified date of an object even when accessing it.
Usually, the modified date is only updated when creating a new object,
or when a new link is added to an existing object. When this setting is enabled,
even getLength() will update the modified date.

Parameters:

before - - update the modified date to the current time if it is older than this value