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.
    • Constructor Summary

      Constructors 
      Constructor Description
      Commit​(@NotNull org.apache.jackrabbit.oak.spi.state.NodeBuilder changes, @NotNull org.apache.jackrabbit.oak.spi.commit.CommitHook hook, @NotNull org.apache.jackrabbit.oak.spi.commit.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 passed base 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.
      org.apache.jackrabbit.oak.spi.commit.CommitInfo info()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Commit

        public Commit​(@NotNull
                      @NotNull org.apache.jackrabbit.oak.spi.state.NodeBuilder changes,
                      @NotNull
                      @NotNull org.apache.jackrabbit.oak.spi.commit.CommitHook hook,
                      @NotNull
                      @NotNull org.apache.jackrabbit.oak.spi.commit.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 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 org.apache.jackrabbit.oak.api.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:
        org.apache.jackrabbit.oak.api.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.
      • info

        public org.apache.jackrabbit.oak.spi.commit.CommitInfo info()