public interface Revisions
Revisions
instances provide read and write access to
the current head state. Implementations are thread safe
and all setters act atomically.
This is a low level API and it is the callers and implementors responsibility to ensure all record id passed to or returned from methods of this interface are the ids of node states.
Modifier and Type | Interface and Description |
---|---|
static interface |
Revisions.Option
Implementation specific options for the
setHead methods. |
Modifier and Type | Method and Description |
---|---|
RecordId |
getHead()
Returns the record id of the head state.
|
boolean |
setHead(com.google.common.base.Function<RecordId,RecordId> newHead,
Revisions.Option... options)
Atomically set the record id of the current head state to the value
returned from the
newHead function when called with the record
id of the current head. |
boolean |
setHead(RecordId expected,
RecordId head,
Revisions.Option... options)
Atomically set the record id of the current head state to the
given
head state if the current head state matches
the expected value. |
@Nonnull RecordId getHead()
SegmentNodeState
.boolean setHead(@Nonnull RecordId expected, @Nonnull RecordId head, @Nonnull Revisions.Option... options)
head
state if the current head state matches
the expected
value.
All record ids must be valid ids for SegmentNodeState
s.
The locking behaviour of this method regarding implementation specific.
expected
- the expected head for the update to take placehead
- the new head to update tooptions
- implementation specific optionstrue
if the current head was successfully
updated, false
otherwise.boolean setHead(@Nonnull com.google.common.base.Function<RecordId,RecordId> newHead, @Nonnull Revisions.Option... options) throws InterruptedException
newHead
function when called with the record
id of the current head.
All record ids must be valid ids for SegmentNodeState
s.
The behaviour of this method regarding locking and handling
null
values returned by newHead
is implementation specific.
newHead
- function mapping an record id to the record id to which
the current head id should be set.options
- implementation specific optionstrue
if the current head was successfully
updated, false
otherwise.InterruptedException
- Blocking implementations may throw this exception whe
interrupted.Copyright © 2012-2019 The Apache Software Foundation. All Rights Reserved.