Class ReadOnlyRevisions
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.file.ReadOnlyRevisions
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.jackrabbit.oak.segment.Revisions
Revisions.Option
-
-
Constructor Summary
Constructors Constructor Description ReadOnlyRevisions(@NotNull SegmentNodeStorePersistence persistence)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
@NotNull RecordId
getHead()
Returns the record id of the head state.@NotNull RecordId
getPersistedHead()
Returns the persisted to disk record id of the head state.RecordId
setHead(@NotNull org.apache.jackrabbit.guava.common.base.Function<RecordId,RecordId> newHead, @NotNull Revisions.Option... options)
Atomically set the record id of the current head state to the value returned from thenewHead
function when called with the record id of the current head.boolean
setHead(@NotNull RecordId expected, @NotNull RecordId head, @NotNull Revisions.Option... options)
Atomically set the record id of the current head state to the givenhead
state if the current head state matches theexpected
value.
-
-
-
Constructor Detail
-
ReadOnlyRevisions
public ReadOnlyRevisions(@NotNull @NotNull SegmentNodeStorePersistence persistence)
-
-
Method Detail
-
getHead
@NotNull public @NotNull RecordId getHead()
Description copied from interface:Revisions
Returns the record id of the head state. The returned id is a valid id for aSegmentNodeState
.
-
getPersistedHead
@NotNull public @NotNull RecordId getPersistedHead()
Description copied from interface:Revisions
Returns the persisted to disk record id of the head state. The returned id is a valid id for aSegmentNodeState
.- Specified by:
getPersistedHead
in interfaceRevisions
- Returns:
- id of the head state
-
setHead
public boolean setHead(@NotNull @NotNull RecordId expected, @NotNull @NotNull RecordId head, @NotNull @NotNull Revisions.Option... options)
Description copied from interface:Revisions
Atomically set the record id of the current head state to the givenhead
state if the current head state matches theexpected
value.All record ids must be valid ids for
SegmentNodeState
s.The locking behaviour of this method regarding implementation specific.
-
setHead
public RecordId setHead(@NotNull @NotNull org.apache.jackrabbit.guava.common.base.Function<RecordId,RecordId> newHead, @NotNull @NotNull Revisions.Option... options) throws java.lang.InterruptedException
Description copied from interface:Revisions
Atomically set the record id of the current head state to the value returned from thenewHead
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 bynewHead
is implementation specific.- Specified by:
setHead
in interfaceRevisions
- Parameters:
newHead
- function mapping an record id to the record id to which the current head id should be set.options
- implementation specific options- Returns:
- the record id of the root node if the current head was successfully
updated,
null
otherwise. - Throws:
java.lang.InterruptedException
- Blocking implementations may throw this exception whe interrupted.
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
-