Class Commit
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.scheduler.Commit
-
public class Commit extends Object
ACommit
instance represents a set of related changes, which when applied to a base node state result in a new node state.
-
-
Constructor Summary
Constructors Constructor Description Commit(@NotNull NodeBuilder changes, @NotNull CommitHook hook, @NotNull CommitInfo info)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applied(SegmentNodeState merged)
Does housekeeping work needed after applying the commit.SegmentNodeState
apply(SegmentNodeState base)
Apply the changes represented by this commit to the passedbase
node state.@Nullable GCGeneration
getGCGeneration()
This method makes a best effort on getting the gc generation of the current commit.boolean
hasChanges()
Checks if the commit contains any changes.CommitInfo
info()
-
-
-
Constructor Detail
-
Commit
public Commit(@NotNull @NotNull NodeBuilder changes, @NotNull @NotNull CommitHook hook, @NotNull @NotNull CommitInfo info)
-
-
Method Detail
-
getGCGeneration
@Nullable public @Nullable GCGeneration getGCGeneration()
This method makes a best effort on getting the gc generation of the current commit. However it avoids causing a write ahead action by callingNodeBuilder.getName(String)
on the changes in this commit.- Returns:
- the gc generation of this commit or
null
if not yet available.
-
apply
public SegmentNodeState apply(SegmentNodeState base) throws CommitFailedException
Apply the changes represented by this commit to the passedbase
node state.- Parameters:
base
- the base node state to apply this commit to- Returns:
- the resulting state from applying this commit to
base
. - Throws:
CommitFailedException
- if the commit cannot be applied tobase
. (e.g. because of a conflict.)
-
applied
public void applied(SegmentNodeState merged)
Does housekeeping work needed after applying the commit.- Parameters:
merged
- the current head node state, after applying the changes in the commit.
-
hasChanges
public boolean hasChanges()
Checks if the commit contains any changes. This is a shallow check, with the same semantics asSegmentNodeState.fastEquals(NodeState, NodeState)
, which cannot guarantee against false negatives.- Returns:
true
, if the commit has changes.
-
info
public CommitInfo info()
-
-