Class DocumentNodeStore

  • All Implemented Interfaces:
    NodeStateDiffer, RevisionContext, org.apache.jackrabbit.oak.spi.commit.Observable, org.apache.jackrabbit.oak.spi.state.Clusterable, org.apache.jackrabbit.oak.spi.state.NodeStore

    public final class DocumentNodeStore
    extends Object
    implements org.apache.jackrabbit.oak.spi.state.NodeStore, RevisionContext, org.apache.jackrabbit.oak.spi.commit.Observable, org.apache.jackrabbit.oak.spi.state.Clusterable, NodeStateDiffer
    Implementation of a NodeStore on DocumentStore.
    • Field Detail

      • META_PROP_NAMES

        public static final List<String> META_PROP_NAMES
        List of meta properties which are created by DocumentNodeStore and which needs to be retained in any cloned copy of DocumentNodeState.
      • commitQueue

        protected final org.apache.jackrabbit.oak.plugins.document.CommitQueue commitQueue
        The commit queue to coordinate the commits.
    • Method Detail

      • dispose

        public void dispose()
      • getDocumentStore

        @NotNull
        public @NotNull DocumentStore getDocumentStore()
      • setAsyncDelay

        public void setAsyncDelay​(int delay)
      • getAsyncDelay

        public int getAsyncDelay()
      • setMaxBackOffMillis

        public void setMaxBackOffMillis​(int time)
      • getMaxBackOffMillis

        public int getMaxBackOffMillis()
      • getChangeSetMaxItems

        public int getChangeSetMaxItems()
      • setChangeSetMaxItems

        public void setChangeSetMaxItems​(int changeSetMaxItems)
      • getChangeSetMaxDepth

        public int getChangeSetMaxDepth()
      • setChangeSetMaxDepth

        public void setChangeSetMaxDepth​(int changeSetMaxDepth)
      • getClusterInfo

        @NotNull
        public @NotNull ClusterNodeInfo getClusterInfo()
      • getNodeCacheStats

        public org.apache.jackrabbit.oak.cache.CacheStats getNodeCacheStats()
      • getNodeChildrenCacheStats

        public org.apache.jackrabbit.oak.cache.CacheStats getNodeChildrenCacheStats()
      • getDiffCacheStats

        @NotNull
        public @NotNull Iterable<org.apache.jackrabbit.oak.cache.CacheStats> getDiffCacheStats()
      • getNodeCachePredicate

        public Predicate<Path> getNodeCachePredicate()
      • getPendingWriteCount

        public int getPendingWriteCount()
      • isDisableBranches

        public boolean isDisableBranches()
      • createPropertyState

        @NotNull
        public @NotNull org.apache.jackrabbit.oak.api.PropertyState createPropertyState​(String name,
                                                                                        String value)
      • getNode

        @Nullable
        public @Nullable DocumentNodeState getNode​(@NotNull
                                                   @NotNull Path path,
                                                   @NotNull
                                                   @NotNull RevisionVector rev)
        Get the node for the given path and revision. The returned object might not be modified directly.
        Parameters:
        path - the path of the node.
        rev - the read revision.
        Returns:
        the node or null if the node does not exist at the given revision.
      • compare

        public boolean compare​(@NotNull
                               @NotNull AbstractDocumentNodeState node,
                               @NotNull
                               @NotNull AbstractDocumentNodeState base,
                               @NotNull
                               @NotNull org.apache.jackrabbit.oak.spi.state.NodeStateDiff diff)
        Compares the given node against the base state and reports the differences to the NodeStateDiff.
        Specified by:
        compare in interface NodeStateDiffer
        Parameters:
        node - the node to compare.
        base - the base node to compare against.
        diff - handler of node state differences
        Returns:
        true if the full diff was performed, or false if it was aborted as requested by the handler (see the NodeStateDiff contract for more details)
      • addObserver

        public Closeable addObserver​(org.apache.jackrabbit.oak.spi.commit.Observer observer)
        Specified by:
        addObserver in interface org.apache.jackrabbit.oak.spi.commit.Observable
      • getRoot

        @NotNull
        public @NotNull DocumentNodeState getRoot()
        Specified by:
        getRoot in interface org.apache.jackrabbit.oak.spi.state.NodeStore
      • merge

        @NotNull
        public @NotNull org.apache.jackrabbit.oak.spi.state.NodeState merge​(@NotNull
                                                                            @NotNull org.apache.jackrabbit.oak.spi.state.NodeBuilder builder,
                                                                            @NotNull
                                                                            @NotNull org.apache.jackrabbit.oak.spi.commit.CommitHook commitHook,
                                                                            @NotNull
                                                                            @NotNull org.apache.jackrabbit.oak.spi.commit.CommitInfo info)
                                                                     throws org.apache.jackrabbit.oak.api.CommitFailedException
        Specified by:
        merge in interface org.apache.jackrabbit.oak.spi.state.NodeStore
        Throws:
        org.apache.jackrabbit.oak.api.CommitFailedException
      • rebase

        @NotNull
        public @NotNull org.apache.jackrabbit.oak.spi.state.NodeState rebase​(@NotNull
                                                                             @NotNull org.apache.jackrabbit.oak.spi.state.NodeBuilder builder)
        Specified by:
        rebase in interface org.apache.jackrabbit.oak.spi.state.NodeStore
      • reset

        public org.apache.jackrabbit.oak.spi.state.NodeState reset​(@NotNull
                                                                   @NotNull org.apache.jackrabbit.oak.spi.state.NodeBuilder builder)
        Specified by:
        reset in interface org.apache.jackrabbit.oak.spi.state.NodeStore
      • createBlob

        @NotNull
        public @NotNull org.apache.jackrabbit.oak.plugins.blob.BlobStoreBlob createBlob​(InputStream inputStream)
                                                                                 throws IOException
        Specified by:
        createBlob in interface org.apache.jackrabbit.oak.spi.state.NodeStore
        Throws:
        IOException
      • getBlob

        public org.apache.jackrabbit.oak.api.Blob getBlob​(@NotNull
                                                          @NotNull String reference)
        Returns the Blob with the given reference. Note that this method is meant to be used with secure reference obtained from Blob#reference which is different from blobId
        Specified by:
        getBlob in interface org.apache.jackrabbit.oak.spi.state.NodeStore
        Parameters:
        reference - the reference of the blob.
        Returns:
        the blob.
      • getBlobFromBlobId

        public org.apache.jackrabbit.oak.api.Blob getBlobFromBlobId​(String blobId)
        Returns the Blob with the given blobId.
        Parameters:
        blobId - the blobId of the blob.
        Returns:
        the blob.
      • checkpoint

        @NotNull
        public @NotNull String checkpoint​(long lifetime,
                                          @NotNull
                                          @NotNull Map<String,​String> properties)
        Specified by:
        checkpoint in interface org.apache.jackrabbit.oak.spi.state.NodeStore
      • checkpoint

        @NotNull
        public @NotNull String checkpoint​(long lifetime)
        Specified by:
        checkpoint in interface org.apache.jackrabbit.oak.spi.state.NodeStore
      • checkpointInfo

        @NotNull
        public @NotNull Map<String,​String> checkpointInfo​(@NotNull
                                                                @NotNull String checkpoint)
        Specified by:
        checkpointInfo in interface org.apache.jackrabbit.oak.spi.state.NodeStore
      • checkpoints

        @NotNull
        public @NotNull Iterable<String> checkpoints()
        Specified by:
        checkpoints in interface org.apache.jackrabbit.oak.spi.state.NodeStore
      • retrieve

        @Nullable
        public @Nullable org.apache.jackrabbit.oak.spi.state.NodeState retrieve​(@NotNull
                                                                                @NotNull String checkpoint)
        Specified by:
        retrieve in interface org.apache.jackrabbit.oak.spi.state.NodeStore
      • release

        public boolean release​(@NotNull
                               @NotNull String checkpoint)
        Specified by:
        release in interface org.apache.jackrabbit.oak.spi.state.NodeStore
      • getBranches

        public org.apache.jackrabbit.oak.plugins.document.UnmergedBranches getBranches()
        Specified by:
        getBranches in interface RevisionContext
        Returns:
        the branches of the local DocumentMK instance, which are not yet merged.
      • getPendingModifications

        public org.apache.jackrabbit.oak.plugins.document.UnsavedModifications getPendingModifications()
        Specified by:
        getPendingModifications in interface RevisionContext
        Returns:
        the pending modifications.
      • getClusterId

        public int getClusterId()
        Specified by:
        getClusterId in interface RevisionContext
        Returns:
        the cluster id of the local DocumentMK instance.
      • newRevision

        @NotNull
        public @NotNull Revision newRevision()
        Specified by:
        newRevision in interface RevisionContext
        Returns:
        a new revision for the local document node store instance.
      • getClock

        @NotNull
        public @NotNull org.apache.jackrabbit.oak.stats.Clock getClock()
        Specified by:
        getClock in interface RevisionContext
        Returns:
        the clock in use when a new revision is created.
      • getCommitValue

        public String getCommitValue​(@NotNull
                                     @NotNull Revision changeRevision,
                                     @NotNull
                                     @NotNull NodeDocument doc)
        Description copied from interface: RevisionContext
        Retrieves the commit value for a given change. This method returns the following types of commit values:
        • "c" : the change revision is committed as is.
        • "c-rX-Y-Z" : the change revision is a branch commit merged in revision "rX-Y-Z".
        • "brX-Y-Z" : the change revision is a branch commit done at "rX-Y-Z" but not yet merged.
        • null : the change revision does not have an entry on the commit root document and is not committed.
        Specified by:
        getCommitValue in interface RevisionContext
        Parameters:
        changeRevision - the revision a change was made.
        doc - the document where the change was made.
        Returns:
        the commit value or null if the change does not have a commit value (yet).
      • runBackgroundOperations

        public void runBackgroundOperations()
        Used for testing only
      • createBlobGarbageCollector

        @Nullable
        public @Nullable org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector createBlobGarbageCollector​(long blobGcMaxAgeInSecs,
                                                                                                                     String repositoryId,
                                                                                                                     org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard whiteboard,
                                                                                                                     org.apache.jackrabbit.oak.stats.StatisticsProvider statisticsProvider)
        Creates and returns a MarkSweepGarbageCollector if the current BlobStore supports garbage collection
        Parameters:
        blobGcMaxAgeInSecs -
        repositoryId -
        whiteboard -
        statisticsProvider -
        Returns:
        garbage collector of the BlobStore supports GC otherwise null
      • getBlobStore

        public org.apache.jackrabbit.oak.spi.blob.BlobStore getBlobStore()
      • getReferencedBlobsIterator

        public Iterator<org.apache.jackrabbit.oak.plugins.blob.ReferencedBlob> getReferencedBlobsIterator()
        Returns an iterator for all the blob present in the store.

        In some cases the iterator might implement Closeable. So callers should check for such iterator and close them.

        Returns:
        an iterator for all the blobs
      • getDiffCache

        public org.apache.jackrabbit.oak.plugins.document.DiffCache getDiffCache()
      • getCheckpoints

        public org.apache.jackrabbit.oak.plugins.document.Checkpoints getCheckpoints()
      • getInstanceId

        public String getInstanceId()
        Specified by:
        getInstanceId in interface org.apache.jackrabbit.oak.spi.state.Clusterable
      • getVisibilityToken

        public String getVisibilityToken()
        Specified by:
        getVisibilityToken in interface org.apache.jackrabbit.oak.spi.state.Clusterable
      • isVisible

        public boolean isVisible​(@NotNull
                                 @NotNull String visibilityToken,
                                 long maxWaitMillis)
                          throws InterruptedException
        Specified by:
        isVisible in interface org.apache.jackrabbit.oak.spi.state.Clusterable
        Throws:
        InterruptedException