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
,org.apache.jackrabbit.oak.spi.state.PrefetchNodeStore
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, org.apache.jackrabbit.oak.spi.state.PrefetchNodeStore, NodeStateDiffer
Implementation of a NodeStore onDocumentStore
.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.jackrabbit.oak.plugins.document.CommitQueue
commitQueue
The commit queue to coordinate the commits.static 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.static java.lang.String
SYS_PROP_DISABLE_JOURNAL
static java.lang.String
SYS_PROP_DISABLE_SWEEP2
static java.lang.String
SYS_PROP_PREFETCH
static FormatVersion
VERSION
-
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.Closeable
addObserver(org.apache.jackrabbit.oak.spi.commit.Observer observer)
@NotNull java.lang.String
checkpoint(long lifetime)
@NotNull java.lang.String
checkpoint(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()
boolean
compare(@NotNull AbstractDocumentNodeState node, @NotNull AbstractDocumentNodeState base, @NotNull org.apache.jackrabbit.oak.spi.state.NodeStateDiff diff)
Compares the givennode
against thebase
state and reports the differences to theNodeStateDiff
.@NotNull org.apache.jackrabbit.oak.plugins.blob.BlobStoreBlob
createBlob(java.io.InputStream inputStream)
@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@NotNull org.apache.jackrabbit.oak.api.PropertyState
createPropertyState(java.lang.String name, java.lang.String value)
void
dispose()
int
getAsyncDelay()
org.apache.jackrabbit.oak.api.Blob
getBlob(@NotNull java.lang.String reference)
Returns theBlob
with the given reference.org.apache.jackrabbit.oak.api.Blob
getBlobFromBlobId(java.lang.String blobId)
Returns theBlob
with the given blobId.org.apache.jackrabbit.oak.spi.blob.BlobStore
getBlobStore()
org.apache.jackrabbit.oak.plugins.document.UnmergedBranches
getBranches()
BundlingConfigHandler
getBundlingConfigHandler()
int
getChangeSetMaxDepth()
int
getChangeSetMaxItems()
org.apache.jackrabbit.oak.plugins.document.Checkpoints
getCheckpoints()
@NotNull org.apache.jackrabbit.oak.stats.Clock
getClock()
int
getClusterId()
@NotNull ClusterNodeInfo
getClusterInfo()
java.lang.String
getCommitValue(@NotNull Revision changeRevision, @NotNull NodeDocument doc)
Retrieves the commit value for a given change.org.apache.jackrabbit.oak.plugins.document.DiffCache
getDiffCache()
@NotNull java.lang.Iterable<org.apache.jackrabbit.oak.cache.CacheStats>
getDiffCacheStats()
@NotNull DocumentStore
getDocumentStore()
@NotNull RevisionVector
getHeadRevision()
java.lang.String
getInstanceId()
@NotNull JournalGarbageCollector
getJournalGarbageCollector()
JournalPropertyHandlerFactory
getJournalPropertyHandlerFactory()
@NotNull LastRevRecoveryAgent
getLastRevRecoveryAgent()
int
getMaxBackOffMillis()
long
getMaxTimeDiffMillis()
DocumentNodeStoreMBean
getMBean()
@Nullable DocumentNodeState
getNode(@NotNull Path path, @NotNull RevisionVector rev)
Get the node for the given path and revision.org.apache.jackrabbit.guava.common.cache.Cache<PathRev,DocumentNodeState>
getNodeCache()
org.apache.jackrabbit.guava.common.base.Predicate<Path>
getNodeCachePredicate()
org.apache.jackrabbit.oak.cache.CacheStats
getNodeCacheStats()
org.apache.jackrabbit.guava.common.cache.Cache<NamePathRev,DocumentNodeState.Children>
getNodeChildrenCache()
org.apache.jackrabbit.oak.cache.CacheStats
getNodeChildrenCacheStats()
DocumentNodeStateCache
getNodeStateCache()
org.apache.jackrabbit.oak.plugins.document.UnsavedModifications
getPendingModifications()
int
getPendingWriteCount()
java.util.Iterator<org.apache.jackrabbit.oak.plugins.blob.ReferencedBlob>
getReferencedBlobsIterator()
Returns an iterator for all the blob present in the store.@NotNull DocumentNodeState
getRoot()
DocumentNodeStoreStatsCollector
getStatsCollector()
@NotNull VersionGarbageCollector
getVersionGarbageCollector()
java.lang.String
getVisibilityToken()
boolean
isDisableBranches()
boolean
isVisible(@NotNull java.lang.String visibilityToken, long maxWaitMillis)
@NotNull org.apache.jackrabbit.oak.spi.state.NodeState
merge(@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 Revision
newRevision()
void
prefetch(java.util.Collection<java.lang.String> paths, org.apache.jackrabbit.oak.spi.state.NodeState rootState)
@NotNull org.apache.jackrabbit.oak.spi.state.NodeState
rebase(@NotNull org.apache.jackrabbit.oak.spi.state.NodeBuilder builder)
boolean
release(@NotNull java.lang.String checkpoint)
org.apache.jackrabbit.oak.spi.state.NodeState
reset(@NotNull org.apache.jackrabbit.oak.spi.state.NodeBuilder builder)
@Nullable org.apache.jackrabbit.oak.spi.state.NodeState
retrieve(@NotNull java.lang.String checkpoint)
void
runBackgroundOperations()
Used for testing onlyvoid
setAsyncDelay(int delay)
void
setChangeSetMaxDepth(int changeSetMaxDepth)
void
setChangeSetMaxItems(int changeSetMaxItems)
void
setMaxBackOffMillis(int time)
void
setNodeStateCache(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
-
SYS_PROP_PREFETCH
public static final java.lang.String SYS_PROP_PREFETCH
- 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 org.apache.jackrabbit.guava.common.cache.Cache<PathRev,DocumentNodeState> getNodeCache()
-
getNodeChildrenCache
public org.apache.jackrabbit.guava.common.cache.Cache<NamePathRev,DocumentNodeState.Children> getNodeChildrenCache()
-
getNodeCachePredicate
public org.apache.jackrabbit.guava.common.base.Predicate<Path> getNodeCachePredicate()
-
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
null
if 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 givennode
against thebase
state and reports the differences to theNodeStateDiff
.- Specified by:
compare
in interfaceNodeStateDiffer
- 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, orfalse
if it was aborted as requested by the handler (see theNodeStateDiff
contract for more details)
-
addObserver
public java.io.Closeable addObserver(org.apache.jackrabbit.oak.spi.commit.Observer observer)
- Specified by:
addObserver
in interfaceorg.apache.jackrabbit.oak.spi.commit.Observable
-
getRoot
@NotNull public @NotNull DocumentNodeState getRoot()
- Specified by:
getRoot
in 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:
merge
in 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:
rebase
in 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:
reset
in 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:
createBlob
in 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 theBlob
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 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 theBlob
with 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:
checkpoint
in interfaceorg.apache.jackrabbit.oak.spi.state.NodeStore
-
checkpoint
@NotNull public @NotNull java.lang.String checkpoint(long lifetime)
- Specified by:
checkpoint
in 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:
checkpointInfo
in interfaceorg.apache.jackrabbit.oak.spi.state.NodeStore
-
checkpoints
@NotNull public @NotNull java.lang.Iterable<java.lang.String> checkpoints()
- Specified by:
checkpoints
in 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:
retrieve
in interfaceorg.apache.jackrabbit.oak.spi.state.NodeStore
-
release
public boolean release(@NotNull @NotNull java.lang.String checkpoint)
- Specified by:
release
in interfaceorg.apache.jackrabbit.oak.spi.state.NodeStore
-
getBranches
public org.apache.jackrabbit.oak.plugins.document.UnmergedBranches getBranches()
- Specified by:
getBranches
in 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:
getPendingModifications
in interfaceRevisionContext
- Returns:
- the pending modifications.
-
getClusterId
public int getClusterId()
- Specified by:
getClusterId
in interfaceRevisionContext
- Returns:
- the cluster id of the local DocumentMK instance.
-
getHeadRevision
@NotNull public @NotNull RevisionVector getHeadRevision()
- Specified by:
getHeadRevision
in interfaceRevisionContext
- Returns:
- the current head revision.
-
newRevision
@NotNull public @NotNull Revision newRevision()
- Specified by:
newRevision
in 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:
getClock
in 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: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 interfaceRevisionContext
- 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, 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:
getInstanceId
in interfaceorg.apache.jackrabbit.oak.spi.state.Clusterable
-
getVisibilityToken
public java.lang.String getVisibilityToken()
- Specified by:
getVisibilityToken
in 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:
isVisible
in 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()
-
prefetch
public void prefetch(java.util.Collection<java.lang.String> paths, org.apache.jackrabbit.oak.spi.state.NodeState rootState)
- Specified by:
prefetch
in interfaceorg.apache.jackrabbit.oak.spi.state.PrefetchNodeStore
-
-