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 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.CommitQueue
commitQueue
The commit queue to coordinate the commits.static 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.static String
SYS_PROP_DISABLE_JOURNAL
static String
SYS_PROP_DISABLE_SWEEP2
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 Closeable
addObserver(org.apache.jackrabbit.oak.spi.commit.Observer observer)
@NotNull String
checkpoint(long lifetime)
@NotNull String
checkpoint(long lifetime, @NotNull Map<String,String> properties)
@NotNull Map<String,String>
checkpointInfo(@NotNull String checkpoint)
@NotNull Iterable<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(InputStream inputStream)
@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@NotNull org.apache.jackrabbit.oak.api.PropertyState
createPropertyState(String name, String value)
void
dispose()
int
getAsyncDelay()
org.apache.jackrabbit.oak.api.Blob
getBlob(@NotNull String reference)
Returns theBlob
with the given reference.org.apache.jackrabbit.oak.api.Blob
getBlobFromBlobId(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()
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 Iterable<org.apache.jackrabbit.oak.cache.CacheStats>
getDiffCacheStats()
@NotNull DocumentStore
getDocumentStore()
@NotNull RevisionVector
getHeadRevision()
String
getInstanceId()
@NotNull JournalGarbageCollector
getJournalGarbageCollector()
JournalPropertyHandlerFactory
getJournalPropertyHandlerFactory()
@NotNull LastRevRecoveryAgent
getLastRevRecoveryAgent()
int
getMaxBackOffMillis()
DocumentNodeStoreMBean
getMBean()
@Nullable DocumentNodeState
getNode(@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.CacheStats
getNodeCacheStats()
Cache<NamePathRev,DocumentNodeState.Children>
getNodeChildrenCache()
org.apache.jackrabbit.oak.cache.CacheStats
getNodeChildrenCacheStats()
DocumentNodeStateCache
getNodeStateCache()
org.apache.jackrabbit.oak.plugins.document.UnsavedModifications
getPendingModifications()
int
getPendingWriteCount()
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()
String
getVisibilityToken()
boolean
isDisableBranches()
boolean
isVisible(@NotNull 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()
@NotNull org.apache.jackrabbit.oak.spi.state.NodeState
rebase(@NotNull org.apache.jackrabbit.oak.spi.state.NodeBuilder builder)
boolean
release(@NotNull 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 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 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.
-
SYS_PROP_DISABLE_JOURNAL
public static final String SYS_PROP_DISABLE_JOURNAL
- See Also:
- Constant Field Values
-
SYS_PROP_DISABLE_SWEEP2
public static final 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 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()
-
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.
-
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 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(InputStream inputStream) throws IOException
- Specified by:
createBlob
in interfaceorg.apache.jackrabbit.oak.spi.state.NodeStore
- Throws:
IOException
-
getBlob
public org.apache.jackrabbit.oak.api.Blob getBlob(@NotNull @NotNull 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(String blobId)
Returns theBlob
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 interfaceorg.apache.jackrabbit.oak.spi.state.NodeStore
-
checkpoint
@NotNull public @NotNull String checkpoint(long lifetime)
- Specified by:
checkpoint
in interfaceorg.apache.jackrabbit.oak.spi.state.NodeStore
-
checkpointInfo
@NotNull public @NotNull Map<String,String> checkpointInfo(@NotNull @NotNull String checkpoint)
- Specified by:
checkpointInfo
in interfaceorg.apache.jackrabbit.oak.spi.state.NodeStore
-
checkpoints
@NotNull public @NotNull Iterable<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 String checkpoint)
- Specified by:
retrieve
in interfaceorg.apache.jackrabbit.oak.spi.state.NodeStore
-
release
public boolean release(@NotNull @NotNull 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 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, 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 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 String getInstanceId()
- Specified by:
getInstanceId
in interfaceorg.apache.jackrabbit.oak.spi.state.Clusterable
-
getVisibilityToken
public String getVisibilityToken()
- Specified by:
getVisibilityToken
in interfaceorg.apache.jackrabbit.oak.spi.state.Clusterable
-
isVisible
public boolean isVisible(@NotNull @NotNull String visibilityToken, long maxWaitMillis) throws InterruptedException
- Specified by:
isVisible
in interfaceorg.apache.jackrabbit.oak.spi.state.Clusterable
- Throws:
InterruptedException
-
getStatsCollector
public DocumentNodeStoreStatsCollector getStatsCollector()
-
getNodeStateCache
public DocumentNodeStateCache getNodeStateCache()
-
setNodeStateCache
public void setNodeStateCache(DocumentNodeStateCache nodeStateCache)
-
getJournalPropertyHandlerFactory
public JournalPropertyHandlerFactory getJournalPropertyHandlerFactory()
-
-