Class DocumentNodeStore
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.document.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 java.lang.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 onDocumentStore.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.jackrabbit.oak.plugins.document.CommitQueuecommitQueueThe commit queue to coordinate the commits.static java.util.List<java.lang.String>META_PROP_NAMESList of meta properties which are created by DocumentNodeStore and which needs to be retained in any cloned copy of DocumentNodeState.static java.lang.StringSYS_PROP_DISABLE_JOURNALstatic java.lang.StringSYS_PROP_DISABLE_SWEEP2static FormatVersionVERSION-
Fields inherited from interface org.apache.jackrabbit.oak.plugins.document.NodeStateDiffer
DEFAULT_DIFFER
-
-
Constructor Summary
Constructors Constructor Description DocumentNodeStore(DocumentNodeStoreBuilder<?> builder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.CloseableaddObserver(org.apache.jackrabbit.oak.spi.commit.Observer observer)@NotNull java.lang.Stringcheckpoint(long lifetime)@NotNull java.lang.Stringcheckpoint(long lifetime, @NotNull java.util.Map<java.lang.String,java.lang.String> properties)@NotNull java.util.Map<java.lang.String,java.lang.String>checkpointInfo(@NotNull java.lang.String checkpoint)@NotNull java.lang.Iterable<java.lang.String>checkpoints()booleancompare(@NotNull AbstractDocumentNodeState node, @NotNull AbstractDocumentNodeState base, @NotNull org.apache.jackrabbit.oak.spi.state.NodeStateDiff diff)Compares the givennodeagainst thebasestate and reports the differences to theNodeStateDiff.@NotNull org.apache.jackrabbit.oak.plugins.blob.BlobStoreBlobcreateBlob(java.io.InputStream inputStream)@Nullable org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollectorcreateBlobGarbageCollector(long blobGcMaxAgeInSecs, java.lang.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@NotNull org.apache.jackrabbit.oak.api.PropertyStatecreatePropertyState(java.lang.String name, java.lang.String value)voiddispose()intgetAsyncDelay()org.apache.jackrabbit.oak.api.BlobgetBlob(@NotNull java.lang.String reference)Returns theBlobwith the given reference.org.apache.jackrabbit.oak.api.BlobgetBlobFromBlobId(java.lang.String blobId)Returns theBlobwith the given blobId.org.apache.jackrabbit.oak.spi.blob.BlobStoregetBlobStore()org.apache.jackrabbit.oak.plugins.document.UnmergedBranchesgetBranches()BundlingConfigHandlergetBundlingConfigHandler()intgetChangeSetMaxDepth()intgetChangeSetMaxItems()org.apache.jackrabbit.oak.plugins.document.CheckpointsgetCheckpoints()@NotNull org.apache.jackrabbit.oak.stats.ClockgetClock()intgetClusterId()@NotNull ClusterNodeInfogetClusterInfo()java.lang.StringgetCommitValue(@NotNull Revision changeRevision, @NotNull NodeDocument doc)Retrieves the commit value for a given change.org.apache.jackrabbit.oak.plugins.document.DiffCachegetDiffCache()@NotNull java.lang.Iterable<org.apache.jackrabbit.oak.cache.CacheStats>getDiffCacheStats()@NotNull DocumentStoregetDocumentStore()@NotNull RevisionVectorgetHeadRevision()java.lang.StringgetInstanceId()@NotNull JournalGarbageCollectorgetJournalGarbageCollector()JournalPropertyHandlerFactorygetJournalPropertyHandlerFactory()@NotNull LastRevRecoveryAgentgetLastRevRecoveryAgent()intgetMaxBackOffMillis()longgetMaxTimeDiffMillis()DocumentNodeStoreMBeangetMBean()@Nullable DocumentNodeStategetNode(@NotNull Path path, @NotNull RevisionVector rev)Get the node for the given path and revision.Cache<PathRev,DocumentNodeState>getNodeCache()Predicate<Path>getNodeCachePredicate()org.apache.jackrabbit.oak.cache.CacheStatsgetNodeCacheStats()Cache<NamePathRev,DocumentNodeState.Children>getNodeChildrenCache()org.apache.jackrabbit.oak.cache.CacheStatsgetNodeChildrenCacheStats()DocumentNodeStateCachegetNodeStateCache()org.apache.jackrabbit.oak.plugins.document.UnsavedModificationsgetPendingModifications()intgetPendingWriteCount()java.util.Iterator<org.apache.jackrabbit.oak.plugins.blob.ReferencedBlob>getReferencedBlobsIterator()Returns an iterator for all the blob present in the store.@NotNull DocumentNodeStategetRoot()DocumentNodeStoreStatsCollectorgetStatsCollector()@NotNull VersionGarbageCollectorgetVersionGarbageCollector()java.lang.StringgetVisibilityToken()booleanisDisableBranches()booleanisVisible(@NotNull java.lang.String visibilityToken, long maxWaitMillis)@NotNull org.apache.jackrabbit.oak.spi.state.NodeStatemerge(@NotNull org.apache.jackrabbit.oak.spi.state.NodeBuilder builder, @NotNull org.apache.jackrabbit.oak.spi.commit.CommitHook commitHook, @NotNull org.apache.jackrabbit.oak.spi.commit.CommitInfo info)@NotNull RevisionnewRevision()@NotNull org.apache.jackrabbit.oak.spi.state.NodeStaterebase(@NotNull org.apache.jackrabbit.oak.spi.state.NodeBuilder builder)booleanrelease(@NotNull java.lang.String checkpoint)org.apache.jackrabbit.oak.spi.state.NodeStatereset(@NotNull org.apache.jackrabbit.oak.spi.state.NodeBuilder builder)@Nullable org.apache.jackrabbit.oak.spi.state.NodeStateretrieve(@NotNull java.lang.String checkpoint)voidrunBackgroundOperations()Used for testing onlyvoidsetAsyncDelay(int delay)voidsetChangeSetMaxDepth(int changeSetMaxDepth)voidsetChangeSetMaxItems(int changeSetMaxItems)voidsetMaxBackOffMillis(int time)voidsetNodeStateCache(DocumentNodeStateCache nodeStateCache)
-
-
-
Field Detail
-
VERSION
public static final FormatVersion VERSION
-
META_PROP_NAMES
public static final java.util.List<java.lang.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.
-
SYS_PROP_DISABLE_JOURNAL
public static final java.lang.String SYS_PROP_DISABLE_JOURNAL
- See Also:
- Constant Field Values
-
SYS_PROP_DISABLE_SWEEP2
public static final java.lang.String SYS_PROP_DISABLE_SWEEP2
- See Also:
- Constant Field Values
-
commitQueue
protected final org.apache.jackrabbit.oak.plugins.document.CommitQueue commitQueue
The commit queue to coordinate the commits.
-
-
Constructor Detail
-
DocumentNodeStore
public DocumentNodeStore(DocumentNodeStoreBuilder<?> builder)
-
-
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 java.lang.Iterable<org.apache.jackrabbit.oak.cache.CacheStats> getDiffCacheStats()
-
getNodeCache
public Cache<PathRev,DocumentNodeState> getNodeCache()
-
getNodeChildrenCache
public Cache<NamePathRev,DocumentNodeState.Children> getNodeChildrenCache()
-
getPendingWriteCount
public int getPendingWriteCount()
-
isDisableBranches
public boolean isDisableBranches()
-
getMaxTimeDiffMillis
public long getMaxTimeDiffMillis()
-
createPropertyState
@NotNull public @NotNull org.apache.jackrabbit.oak.api.PropertyState createPropertyState(java.lang.String name, java.lang.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
nullif the node does not exist at the given revision.
-
getBundlingConfigHandler
public BundlingConfigHandler getBundlingConfigHandler()
-
compare
public boolean compare(@NotNull @NotNull AbstractDocumentNodeState node, @NotNull @NotNull AbstractDocumentNodeState base, @NotNull @NotNull org.apache.jackrabbit.oak.spi.state.NodeStateDiff diff)Compares the givennodeagainst thebasestate and reports the differences to theNodeStateDiff.- Specified by:
comparein interfaceNodeStateDiffer- Parameters:
node- the node to compare.base- the base node to compare against.diff- handler of node state differences- Returns:
trueif the full diff was performed, orfalseif it was aborted as requested by the handler (see theNodeStateDiffcontract for more details)
-
addObserver
public java.io.Closeable addObserver(org.apache.jackrabbit.oak.spi.commit.Observer observer)
- Specified by:
addObserverin interfaceorg.apache.jackrabbit.oak.spi.commit.Observable
-
getRoot
@NotNull public @NotNull DocumentNodeState getRoot()
- Specified by:
getRootin interfaceorg.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:
mergein interfaceorg.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:
rebasein interfaceorg.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:
resetin interfaceorg.apache.jackrabbit.oak.spi.state.NodeStore
-
createBlob
@NotNull public @NotNull org.apache.jackrabbit.oak.plugins.blob.BlobStoreBlob createBlob(java.io.InputStream inputStream) throws java.io.IOException- Specified by:
createBlobin interfaceorg.apache.jackrabbit.oak.spi.state.NodeStore- Throws:
java.io.IOException
-
getBlob
public org.apache.jackrabbit.oak.api.Blob getBlob(@NotNull @NotNull java.lang.String reference)Returns theBlobwith 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:
getBlobin interfaceorg.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(java.lang.String blobId)
Returns theBlobwith the given blobId.- Parameters:
blobId- the blobId of the blob.- Returns:
- the blob.
-
checkpoint
@NotNull public @NotNull java.lang.String checkpoint(long lifetime, @NotNull @NotNull java.util.Map<java.lang.String,java.lang.String> properties)- Specified by:
checkpointin interfaceorg.apache.jackrabbit.oak.spi.state.NodeStore
-
checkpoint
@NotNull public @NotNull java.lang.String checkpoint(long lifetime)
- Specified by:
checkpointin interfaceorg.apache.jackrabbit.oak.spi.state.NodeStore
-
checkpointInfo
@NotNull public @NotNull java.util.Map<java.lang.String,java.lang.String> checkpointInfo(@NotNull @NotNull java.lang.String checkpoint)- Specified by:
checkpointInfoin interfaceorg.apache.jackrabbit.oak.spi.state.NodeStore
-
checkpoints
@NotNull public @NotNull java.lang.Iterable<java.lang.String> checkpoints()
- Specified by:
checkpointsin interfaceorg.apache.jackrabbit.oak.spi.state.NodeStore
-
retrieve
@Nullable public @Nullable org.apache.jackrabbit.oak.spi.state.NodeState retrieve(@NotNull @NotNull java.lang.String checkpoint)- Specified by:
retrievein interfaceorg.apache.jackrabbit.oak.spi.state.NodeStore
-
release
public boolean release(@NotNull @NotNull java.lang.String checkpoint)- Specified by:
releasein interfaceorg.apache.jackrabbit.oak.spi.state.NodeStore
-
getBranches
public org.apache.jackrabbit.oak.plugins.document.UnmergedBranches getBranches()
- Specified by:
getBranchesin interfaceRevisionContext- 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:
getPendingModificationsin interfaceRevisionContext- Returns:
- the pending modifications.
-
getClusterId
public int getClusterId()
- Specified by:
getClusterIdin interfaceRevisionContext- Returns:
- the cluster id of the local DocumentMK instance.
-
getHeadRevision
@NotNull public @NotNull RevisionVector getHeadRevision()
- Specified by:
getHeadRevisionin interfaceRevisionContext- Returns:
- the current head revision.
-
newRevision
@NotNull public @NotNull Revision newRevision()
- Specified by:
newRevisionin interfaceRevisionContext- Returns:
- a new revision for the local document node store instance.
-
getClock
@NotNull public @NotNull org.apache.jackrabbit.oak.stats.Clock getClock()
- Specified by:
getClockin interfaceRevisionContext- Returns:
- the clock in use when a new revision is created.
-
getCommitValue
public java.lang.String getCommitValue(@NotNull @NotNull Revision changeRevision, @NotNull @NotNull NodeDocument doc)Description copied from interface:RevisionContextRetrieves 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:
getCommitValuein interfaceRevisionContext- Parameters:
changeRevision- the revision a change was made.doc- the document where the change was made.- Returns:
- the commit value or
nullif 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, java.lang.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
-
getMBean
public DocumentNodeStoreMBean getMBean()
-
getBlobStore
public org.apache.jackrabbit.oak.spi.blob.BlobStore getBlobStore()
-
getReferencedBlobsIterator
public java.util.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()
-
getVersionGarbageCollector
@NotNull public @NotNull VersionGarbageCollector getVersionGarbageCollector()
-
getJournalGarbageCollector
@NotNull public @NotNull JournalGarbageCollector getJournalGarbageCollector()
-
getLastRevRecoveryAgent
@NotNull public @NotNull LastRevRecoveryAgent getLastRevRecoveryAgent()
-
getInstanceId
public java.lang.String getInstanceId()
- Specified by:
getInstanceIdin interfaceorg.apache.jackrabbit.oak.spi.state.Clusterable
-
getVisibilityToken
public java.lang.String getVisibilityToken()
- Specified by:
getVisibilityTokenin interfaceorg.apache.jackrabbit.oak.spi.state.Clusterable
-
isVisible
public boolean isVisible(@NotNull @NotNull java.lang.String visibilityToken, long maxWaitMillis) throws java.lang.InterruptedException- Specified by:
isVisiblein interfaceorg.apache.jackrabbit.oak.spi.state.Clusterable- Throws:
java.lang.InterruptedException
-
getStatsCollector
public DocumentNodeStoreStatsCollector getStatsCollector()
-
getNodeStateCache
public DocumentNodeStateCache getNodeStateCache()
-
setNodeStateCache
public void setNodeStateCache(DocumentNodeStateCache nodeStateCache)
-
getJournalPropertyHandlerFactory
public JournalPropertyHandlerFactory getJournalPropertyHandlerFactory()
-
-