Class DocumentNodeStoreBuilder<T extends DocumentNodeStoreBuilder<T>>
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBuilder<T>
-
- Direct Known Subclasses:
MongoDocumentNodeStoreBuilderBase,RDBDocumentNodeStoreBuilder
public class DocumentNodeStoreBuilder<T extends DocumentNodeStoreBuilder<T>> extends Object
A generic builder for aDocumentNodeStore. By default the builder will create an in-memoryDocumentNodeStore. In most cases this is only useful for tests.
-
-
Field Summary
Fields Modifier and Type Field Description protected Supplier<BlobStore>blobStoreSupplierstatic intDEFAULT_CACHE_SEGMENT_COUNTstatic intDEFAULT_CACHE_STACK_MOVE_DISTANCEstatic intDEFAULT_CHILDREN_CACHE_PERCENTAGEstatic intDEFAULT_DIFF_CACHE_PERCENTAGEstatic longDEFAULT_MEMORY_CACHE_SIZEstatic intDEFAULT_NODE_CACHE_PERCENTAGEstatic intDEFAULT_PREV_DOC_CACHE_PERCENTAGEstatic intDEFAULT_PREV_NO_PROP_CACHE_PERCENTAGEstatic intDEFAULT_UPDATE_LIMITprotected Supplier<DocumentStore>documentStoreSupplier
-
Constructor Summary
Constructors Constructor Description DocumentNodeStoreBuilder()
-
Method Summary
-
-
-
Field Detail
-
DEFAULT_MEMORY_CACHE_SIZE
public static final long DEFAULT_MEMORY_CACHE_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_NODE_CACHE_PERCENTAGE
public static final int DEFAULT_NODE_CACHE_PERCENTAGE
- See Also:
- Constant Field Values
-
DEFAULT_PREV_NO_PROP_CACHE_PERCENTAGE
public static final int DEFAULT_PREV_NO_PROP_CACHE_PERCENTAGE
- See Also:
- Constant Field Values
-
DEFAULT_PREV_DOC_CACHE_PERCENTAGE
public static final int DEFAULT_PREV_DOC_CACHE_PERCENTAGE
- See Also:
- Constant Field Values
-
DEFAULT_CHILDREN_CACHE_PERCENTAGE
public static final int DEFAULT_CHILDREN_CACHE_PERCENTAGE
- See Also:
- Constant Field Values
-
DEFAULT_DIFF_CACHE_PERCENTAGE
public static final int DEFAULT_DIFF_CACHE_PERCENTAGE
- See Also:
- Constant Field Values
-
DEFAULT_CACHE_SEGMENT_COUNT
public static final int DEFAULT_CACHE_SEGMENT_COUNT
- See Also:
- Constant Field Values
-
DEFAULT_CACHE_STACK_MOVE_DISTANCE
public static final int DEFAULT_CACHE_STACK_MOVE_DISTANCE
- See Also:
- Constant Field Values
-
DEFAULT_UPDATE_LIMIT
public static final int DEFAULT_UPDATE_LIMIT
- See Also:
- Constant Field Values
-
documentStoreSupplier
protected Supplier<DocumentStore> documentStoreSupplier
-
-
Method Detail
-
newDocumentNodeStoreBuilder
public static DocumentNodeStoreBuilder<?> newDocumentNodeStoreBuilder()
- Returns:
- a new
DocumentNodeStoreBuilder.
-
build
public DocumentNodeStore build()
-
thisBuilder
protected final T thisBuilder()
-
setPersistentCache
public T setPersistentCache(String persistentCache)
Sets the persistent cache option.- Returns:
- this
-
setJournalCache
public T setJournalCache(String journalCache)
Sets the journal cache option.- Returns:
- this
-
setTiming
public T setTiming(boolean timing)
Use the timing document store wrapper.- Parameters:
timing- whether to use the timing wrapper.- Returns:
- this
-
getTiming
public boolean getTiming()
-
setLogging
public T setLogging(boolean logging)
-
getLogging
public boolean getLogging()
-
setLoggingPrefix
public T setLoggingPrefix(String prefix)
Sets a custom prefix for the logger.- Parameters:
prefix- to be used in the logs output.- Returns:
- this
-
setLeaseCheck
@Deprecated public T setLeaseCheck(boolean leaseCheck)
Deprecated.usesetLeaseCheckMode(LeaseCheckMode)instead.Iftrue, sets lease check mode toLeaseCheckMode.LENIENT, otherwise sets the mode toLeaseCheckMode.DISABLED. This method is only kept for backward compatibility with the behaviour before OAK-7626. The new default lease check mode isLeaseCheckMode.STRICT, but existing code may rely on the previous behaviour, when enabling the lease check corresponded with aLeaseCheckMode.LENIENTbehaviour.
-
getLeaseCheck
@Deprecated public boolean getLeaseCheck()
Deprecated.This method does not distinguish betweenLeaseCheckMode.LENIENTandLeaseCheckMode.STRICTand returnstruefor both modes. UsegetLeaseCheckMode()instead.
-
setLeaseCheckMode
public T setLeaseCheckMode(LeaseCheckMode mode)
-
setThrottlingEnabled
public T setThrottlingEnabled(boolean b)
-
isThrottlingEnabled
public boolean isThrottlingEnabled()
-
setThrottlingTimeMillis
public T setThrottlingTimeMillis(int v)
-
getThrottlingTimeMillis
public int getThrottlingTimeMillis()
-
setThrottlingJobSchedulePeriodSecs
public T setThrottlingJobSchedulePeriodSecs(int v)
-
getThrottlingJobSchedulePeriodSecs
public int getThrottlingJobSchedulePeriodSecs()
-
setAvoidMergeLock
public T setAvoidMergeLock(boolean b)
-
avoidMergeLock
public boolean avoidMergeLock()
-
setFullGCEnabled
public T setFullGCEnabled(boolean b)
-
isFullGCEnabled
public boolean isFullGCEnabled()
-
setFullGCAuditLoggingEnabled
public T setFullGCAuditLoggingEnabled(boolean b)
-
isFullGCAuditLoggingEnabled
public boolean isFullGCAuditLoggingEnabled()
-
setEmbeddedVerificationEnabled
public T setEmbeddedVerificationEnabled(boolean b)
-
isEmbeddedVerificationEnabled
public boolean isEmbeddedVerificationEnabled()
-
setFullGCMode
public T setFullGCMode(int v)
-
getFullGCMode
public int getFullGCMode()
-
setFullGCGeneration
public T setFullGCGeneration(long v)
-
getFullGCGeneration
public long getFullGCGeneration()
-
setFullGcMaxAgeMillis
public T setFullGcMaxAgeMillis(long v)
The maximum age for nodes in milliseconds. Older entries are candidates for full gc- Parameters:
v- max age in millis- Returns:
- builder object
-
getFullGcMaxAgeMillis
public long getFullGcMaxAgeMillis()
The maximum age for nodes in milliseconds. Older entries are candidates for Full GC.- Returns:
- maximum age for nodes entries in milliseconds.
-
setFullGCBatchSize
public T setFullGCBatchSize(int v)
-
getFullGCBatchSize
public int getFullGCBatchSize()
-
setFullGCProgressSize
public T setFullGCProgressSize(int v)
-
getFullGCProgressSize
public int getFullGCProgressSize()
-
setFullGCDelayFactor
public T setFullGCDelayFactor(double v)
-
getFullGCDelayFactor
public double getFullGCDelayFactor()
-
setReadOnlyMode
public T setReadOnlyMode()
-
getReadOnlyMode
public boolean getReadOnlyMode()
-
getPrefetchFeature
@Nullable public @Nullable Feature getPrefetchFeature()
-
setDocStoreThrottlingFeature
public T setDocStoreThrottlingFeature(@Nullable @Nullable Feature docStoreThrottling)
-
getDocStoreThrottlingFeature
@Nullable public @Nullable Feature getDocStoreThrottlingFeature()
-
setNoChildOrderCleanupFeature
public T setNoChildOrderCleanupFeature(@Nullable @Nullable Feature noChildOrderCleanupFeature)
-
getNoChildOrderCleanupFeature
@Nullable public @Nullable Feature getNoChildOrderCleanupFeature()
-
setCancelInvalidationFeature
public T setCancelInvalidationFeature(@Nullable @Nullable Feature cancelInvalidation)
-
getCancelInvalidationFeature
@Nullable public @Nullable Feature getCancelInvalidationFeature()
-
setDocStoreFullGCFeature
public T setDocStoreFullGCFeature(@Nullable @Nullable Feature docStoreFullGC)
-
getDocStoreFullGCFeature
public Feature getDocStoreFullGCFeature()
-
setDocStoreEmbeddedVerificationFeature
public T setDocStoreEmbeddedVerificationFeature(@Nullable @Nullable Feature getDocStoreEmbeddedVerification)
-
getDocStoreEmbeddedVerificationFeature
@Nullable public @Nullable Feature getDocStoreEmbeddedVerificationFeature()
-
getDocStoreAvoidMergeLockFeature
public Feature getDocStoreAvoidMergeLockFeature()
-
setDocStoreAvoidMergeLockFeature
public T setDocStoreAvoidMergeLockFeature(@Nullable @Nullable Feature docStoreAvoidMergeLock)
-
setPrevNoPropCacheFeature
public T setPrevNoPropCacheFeature(@Nullable @Nullable Feature prevNoPropCacheFeature)
-
getPrevNoPropCacheFeature
@Nullable public @Nullable Feature getPrevNoPropCacheFeature()
-
setLeaseFailureHandler
public T setLeaseFailureHandler(LeaseFailureHandler leaseFailureHandler)
-
getLeaseFailureHandler
public LeaseFailureHandler getLeaseFailureHandler()
-
setDocumentStore
public T setDocumentStore(DocumentStore documentStore)
Set the document store to use. By default an in-memory store is used.- Parameters:
documentStore- the document store- Returns:
- this
-
getDocumentStore
public DocumentStore getDocumentStore()
-
getDiffCache
public org.apache.jackrabbit.oak.plugins.document.DiffCache getDiffCache(int clusterId)
-
setBlobStore
public T setBlobStore(BlobStore blobStore)
Set the blob store to use. By default an in-memory store is used.- Parameters:
blobStore- the blob store- Returns:
- this
-
getBlobStore
public BlobStore getBlobStore()
-
setClusterId
public T setClusterId(int clusterId)
Set the cluster id to use. By default, 0 is used, meaning the cluster id is automatically generated.- Parameters:
clusterId- the cluster id- Returns:
- this
-
setClusterInvisible
public T setClusterInvisible(boolean invisible)
Set the cluster as invisible to the discovery lite service. By default it is visible.- Returns:
- this
- See Also:
DocumentDiscoveryLiteService
-
setCacheSegmentCount
public T setCacheSegmentCount(int cacheSegmentCount)
-
setCacheStackMoveDistance
public T setCacheStackMoveDistance(int cacheSegmentCount)
-
getClusterId
public int getClusterId()
-
isClusterInvisible
public boolean isClusterInvisible()
-
setAsyncDelay
public T setAsyncDelay(int asyncDelay)
Set the maximum delay to write the last revision to the root node. By default 1000 (meaning 1 second) is used.- Parameters:
asyncDelay- in milliseconds- Returns:
- this
-
getAsyncDelay
public int getAsyncDelay()
-
setClusterIdReuseDelayAfterRecovery
public T setClusterIdReuseDelayAfterRecovery(long clusterIdReuseDelayAfterRecovery)
-
getClusterIdReuseDelayAfterRecovery
public long getClusterIdReuseDelayAfterRecovery()
-
getWeigher
public org.apache.jackrabbit.guava.common.cache.Weigher<CacheValue,CacheValue> getWeigher()
-
withWeigher
public T withWeigher(org.apache.jackrabbit.guava.common.cache.Weigher<CacheValue,CacheValue> weigher)
-
memoryCacheSize
public T memoryCacheSize(long memoryCacheSize)
-
memoryCacheDistribution
public T memoryCacheDistribution(int nodeCachePercentage, int prevDocCachePercentage, int childrenCachePercentage, int diffCachePercentage, int prevNoPropCachePercentage)
-
getNodeCacheSize
public long getNodeCacheSize()
-
getPrevDocumentCacheSize
public long getPrevDocumentCacheSize()
-
getPrevNoPropCacheSize
public long getPrevNoPropCacheSize()
-
getChildrenCacheSize
public long getChildrenCacheSize()
-
getDocumentCacheSize
public long getDocumentCacheSize()
-
getDiffCacheSize
public long getDiffCacheSize()
-
getMemoryDiffCacheSize
public long getMemoryDiffCacheSize()
-
getLocalDiffCacheSize
public long getLocalDiffCacheSize()
-
setUseSimpleRevision
public T setUseSimpleRevision(boolean useSimpleRevision)
-
isUseSimpleRevision
public boolean isUseSimpleRevision()
-
getExecutor
public Executor getExecutor()
-
setStatisticsProvider
public T setStatisticsProvider(StatisticsProvider statisticsProvider)
-
getStatisticsProvider
public StatisticsProvider getStatisticsProvider()
-
getDocumentStoreStatsCollector
public DocumentStoreStatsCollector getDocumentStoreStatsCollector()
-
setDocumentStoreStatsCollector
public T setDocumentStoreStatsCollector(DocumentStoreStatsCollector documentStoreStatsCollector)
-
getThrottlingStatsCollector
@NotNull public @NotNull ThrottlingStatsCollector getThrottlingStatsCollector()
-
setThrottlingStatsCollector
public T setThrottlingStatsCollector(@NotNull @NotNull ThrottlingStatsCollector throttlingStatsCollector)
-
getNodeStoreStatsCollector
public DocumentNodeStoreStatsCollector getNodeStoreStatsCollector()
-
setNodeStoreStatsCollector
public T setNodeStoreStatsCollector(DocumentNodeStoreStatsCollector statsCollector)
-
getPersistenceCacheStats
@NotNull public @NotNull Map<String,PersistentCacheStats> getPersistenceCacheStats()
-
getBlobStoreStats
@Nullable public @Nullable BlobStoreStats getBlobStoreStats()
-
getBlobStoreCacheStats
@Nullable public @Nullable CacheStats getBlobStoreCacheStats()
-
getClock
public Clock getClock()
-
disableBranches
public T disableBranches()
-
isDisableBranches
public boolean isDisableBranches()
-
setBundlingDisabled
public T setBundlingDisabled(boolean enabled)
-
isBundlingDisabled
public boolean isBundlingDisabled()
-
setPrefetchExternalChanges
public T setPrefetchExternalChanges(boolean b)
-
isPrefetchExternalChanges
public boolean isPrefetchExternalChanges()
-
setJournalPropertyHandlerFactory
public T setJournalPropertyHandlerFactory(JournalPropertyHandlerFactory factory)
-
getJournalPropertyHandlerFactory
public JournalPropertyHandlerFactory getJournalPropertyHandlerFactory()
-
setUpdateLimit
public T setUpdateLimit(int limit)
-
getUpdateLimit
public int getUpdateLimit()
-
setCommitValueCacheSize
public T setCommitValueCacheSize(int cacheSize)
-
getCommitValueCacheSize
public int getCommitValueCacheSize()
-
setCacheEmptyCommitValue
public T setCacheEmptyCommitValue(boolean enable)
Controls whether caching of empty commit values (negative cache) is enabled. This cache is disabled by default. The cache can only be enabled on aread-onlystore. In read-write mode, the cache is always be disabled.- Parameters:
enable-trueto enable the empty commit value cache.- Returns:
- this builder.
-
getCacheEmptyCommitValue
public boolean getCacheEmptyCommitValue()
- Returns:
truewhen caching of empty commit values is enabled,falseotherwise.
-
setJournalGCMaxAge
public T setJournalGCMaxAge(long maxRevisionAgeMillis)
-
getJournalGCMaxAge
public long getJournalGCMaxAge()
The maximum age for journal entries in milliseconds. Older entries are candidates for GC.- Returns:
- maximum age for journal entries in milliseconds.
-
setRevisionGCMaxAge
public T setRevisionGCMaxAge(long maxRevisionGCAgeMillis)
-
getRevisionGCMaxAge
public long getRevisionGCMaxAge()
The maximum age for changes in milliseconds. Older changes are candidates for revision garbage collection.- Returns:
- maximum age in milliseconds.
-
setSuspendTimeoutMillis
public T setSuspendTimeoutMillis(long suspendTimeoutMillis)
-
getSuspendTimeoutMillis
public long getSuspendTimeoutMillis()
-
setRecoveryDelayMillis
public T setRecoveryDelayMillis(long recoveryDelayMillis)
-
getRecoveryDelayMillis
public long getRecoveryDelayMillis()
-
setPerfloggerInfoMillis
public T setPerfloggerInfoMillis(long perfloggerInfoMillis)
-
getPerfloggerInfoMillis
public long getPerfloggerInfoMillis()
-
getGCMonitor
public GCMonitor getGCMonitor()
-
createVersionGCSupport
public VersionGCSupport createVersionGCSupport()
-
createReferencedBlobs
public Iterable<ReferencedBlob> createReferencedBlobs(DocumentNodeStore ns)
-
createMissingLastRevSeeker
public MissingLastRevSeeker createMissingLastRevSeeker()
-
buildNodeCache
public org.apache.jackrabbit.guava.common.cache.Cache<PathRev,DocumentNodeState> buildNodeCache(DocumentNodeStore store)
-
buildChildrenCache
public org.apache.jackrabbit.guava.common.cache.Cache<NamePathRev,DocumentNodeState.Children> buildChildrenCache(DocumentNodeStore store)
-
buildMemoryDiffCache
public org.apache.jackrabbit.guava.common.cache.Cache<CacheValue,StringValue> buildMemoryDiffCache()
-
buildLocalDiffCache
public org.apache.jackrabbit.guava.common.cache.Cache<RevisionsKey,LocalDiffCache.Diff> buildLocalDiffCache()
-
buildDocumentCache
public org.apache.jackrabbit.guava.common.cache.Cache<CacheValue,NodeDocument> buildDocumentCache(DocumentStore docStore)
-
buildPrevDocumentsCache
public org.apache.jackrabbit.guava.common.cache.Cache<StringValue,NodeDocument> buildPrevDocumentsCache(DocumentStore docStore)
-
buildNodeDocumentCache
public NodeDocumentCache buildNodeDocumentCache(DocumentStore docStore, NodeDocumentLocks locks)
-
buildPrevNoPropCache
@Nullable public @Nullable org.apache.jackrabbit.guava.common.cache.Cache<StringValue,StringValue> buildPrevNoPropCache()
Builds the prevNoProp cache, if the corresponding feature toggle is enabled. Returns null otherwise- Returns:
- null if prevNoProp feature is disabled and size non-null, a newly built cache otherwise
-
setNodeCachePredicate
@Deprecated public T setNodeCachePredicate(Predicate<String> p)
Deprecated.UsesetNodeCachePathPredicate(Predicate)instead.
-
getNodeCachePredicate
@Deprecated public Predicate<String> getNodeCachePredicate()
Deprecated.UsegetNodeCachePathPredicate()instead.
-
getPersistentCache
public PersistentCache getPersistentCache()
-
-