Interface NodeStoreBranch


  • public interface NodeStoreBranch
    An instance of this class represents a private branch of the tree in a NodeStore to which transient changes can be applied and later merged back or discarded.
    • Method Detail

      • getBase

        @NotNull
        @NotNull NodeState getBase()
        Returns the base state of this branch. The base state is the state of the tree as it was at the time this branch was created.
        Returns:
        root node state
      • getHead

        @NotNull
        @NotNull NodeState getHead()
        Returns the head state of this branch. The head state is the state resulting from the base state by applying all subsequent modifications to this branch by setRoot(NodeState).
        Returns:
        root node state
        Throws:
        java.lang.IllegalStateException - if the branch is already merged
      • setRoot

        void setRoot​(NodeState newRoot)
        Updates the state of the content tree of this private branch.
        Parameters:
        newRoot - new root node state
        Throws:
        java.lang.IllegalStateException - if the branch is already merged
      • merge

        @NotNull
        @NotNull NodeState merge​(@NotNull
                                 @NotNull CommitHook hook,
                                 @NotNull
                                 @NotNull CommitInfo info)
                          throws CommitFailedException
        Merges the changes in this branch to the main content tree. Merging is done by rebasing the changes in this branch on top of the current head revision followed by a fast forward merge.
        Parameters:
        hook - the commit hook to apply while merging changes
        info - commit info associated with this merge operation
        Returns:
        the node state resulting from the merge.
        Throws:
        CommitFailedException - if the merge failed
        java.lang.IllegalStateException - if the branch is already merged
      • rebase

        void rebase()
        Rebase the changes from this branch on top of the current root.