T - The type of data written.public interface RevisionedStreamClient<T> extends AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the client and frees any resources associated with it.
|
boolean |
compareAndSetMark(Revision expected,
Revision newLocation)
Records a provided location that can later be obtained by calling
getMark(). |
Revision |
fetchLatestRevision()
Returns the latest revision.
|
Revision |
fetchOldestRevision()
Returns the oldest revision than can be read.
|
Revision |
getMark()
Returns a location previously set by
compareAndSetMark(Revision, Revision). |
Iterator<Map.Entry<Revision,T>> |
readFrom(Revision start)
Read from a specified revision to the end of the stream.
|
Revision |
writeConditionally(Revision latestRevision,
T value)
If the supplied revision is the latest revision in the stream write the provided value and return the new revision.
|
void |
writeUnconditionally(T value)
Write a new value to the stream.
|
Revision fetchOldestRevision()
Revision fetchLatestRevision()
Iterator<Map.Entry<Revision,T>> readFrom(Revision start)
start - The location the iterator should start at.Revision writeConditionally(Revision latestRevision, T value)
latestRevision - The version to verify is the most recent.value - The value to be written to the stream.void writeUnconditionally(T value)
value - The value to be written.Revision getMark()
compareAndSetMark(Revision, Revision).boolean compareAndSetMark(Revision expected, Revision newLocation)
getMark().
Atomically set the mark to newLocation if it is the expected value.expected - The expected value (May be null to indicate the mark is expected to be null)newLocation - The new valuevoid close()
close in interface AutoCloseableAutoCloseable.close()