Class Commit


  • public class Commit
    extends java.lang.Object
    A Commit instance represents a set of related changes, which when applied to a base node state result in a new node state.
    • 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 calling NodeBuilder.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 passed base 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 to base. (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 as SegmentNodeState.fastEquals(NodeState, NodeState), which cannot guarantee against false negatives.
        Returns:
        true, if the commit has changes.