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<org.apache.jackrabbit.oak.spi.blob.BlobStore>
blobStoreSupplier
static int
DEFAULT_CACHE_SEGMENT_COUNT
static int
DEFAULT_CACHE_STACK_MOVE_DISTANCE
static int
DEFAULT_CHILDREN_CACHE_PERCENTAGE
static int
DEFAULT_DIFF_CACHE_PERCENTAGE
static long
DEFAULT_MEMORY_CACHE_SIZE
static int
DEFAULT_NODE_CACHE_PERCENTAGE
static int
DEFAULT_PREV_DOC_CACHE_PERCENTAGE
static int
DEFAULT_UPDATE_LIMIT
protected Supplier<DocumentStore>
documentStoreSupplier
-
Constructor Summary
Constructors Constructor Description DocumentNodeStoreBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DocumentNodeStore
build()
Cache<NamePathRev,DocumentNodeState.Children>
buildChildrenCache(DocumentNodeStore store)
Cache<org.apache.jackrabbit.oak.cache.CacheValue,NodeDocument>
buildDocumentCache(DocumentStore docStore)
Cache<RevisionsKey,LocalDiffCache.Diff>
buildLocalDiffCache()
Cache<org.apache.jackrabbit.oak.cache.CacheValue,StringValue>
buildMemoryDiffCache()
Cache<PathRev,DocumentNodeState>
buildNodeCache(DocumentNodeStore store)
NodeDocumentCache
buildNodeDocumentCache(DocumentStore docStore, NodeDocumentLocks locks)
Cache<StringValue,NodeDocument>
buildPrevDocumentsCache(DocumentStore docStore)
T
clock(org.apache.jackrabbit.oak.stats.Clock clock)
MissingLastRevSeeker
createMissingLastRevSeeker()
Iterable<org.apache.jackrabbit.oak.plugins.blob.ReferencedBlob>
createReferencedBlobs(DocumentNodeStore ns)
VersionGCSupport
createVersionGCSupport()
T
disableBranches()
int
getAsyncDelay()
org.apache.jackrabbit.oak.spi.blob.BlobStore
getBlobStore()
@Nullable org.apache.jackrabbit.oak.cache.CacheStats
getBlobStoreCacheStats()
@Nullable org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats
getBlobStoreStats()
boolean
getCacheEmptyCommitValue()
long
getChildrenCacheSize()
org.apache.jackrabbit.oak.stats.Clock
getClock()
int
getClusterId()
int
getCommitValueCacheSize()
org.apache.jackrabbit.oak.plugins.document.DiffCache
getDiffCache(int clusterId)
long
getDiffCacheSize()
long
getDocumentCacheSize()
DocumentStore
getDocumentStore()
DocumentStoreStatsCollector
getDocumentStoreStatsCollector()
Executor
getExecutor()
org.apache.jackrabbit.oak.spi.gc.GCMonitor
getGCMonitor()
long
getJournalGCMaxAge()
The maximum age for journal entries in milliseconds.JournalPropertyHandlerFactory
getJournalPropertyHandlerFactory()
boolean
getLeaseCheck()
Deprecated.This method does not distinguish betweenLeaseCheckMode.LENIENT
andLeaseCheckMode.STRICT
and returnstrue
for both modes.LeaseFailureHandler
getLeaseFailureHandler()
long
getLocalDiffCacheSize()
boolean
getLogging()
long
getMemoryDiffCacheSize()
Predicate<Path>
getNodeCachePathPredicate()
Predicate<String>
getNodeCachePredicate()
Deprecated.UsegetNodeCachePathPredicate()
instead.long
getNodeCacheSize()
DocumentNodeStoreStatsCollector
getNodeStoreStatsCollector()
@NotNull Map<String,PersistentCacheStats>
getPersistenceCacheStats()
PersistentCache
getPersistentCache()
long
getPrevDocumentCacheSize()
boolean
getReadOnlyMode()
org.apache.jackrabbit.oak.stats.StatisticsProvider
getStatisticsProvider()
boolean
getTiming()
int
getUpdateLimit()
Weigher<org.apache.jackrabbit.oak.cache.CacheValue,org.apache.jackrabbit.oak.cache.CacheValue>
getWeigher()
boolean
isBundlingDisabled()
boolean
isClusterInvisible()
boolean
isDisableBranches()
boolean
isPrefetchExternalChanges()
boolean
isUseSimpleRevision()
T
memoryCacheDistribution(int nodeCachePercentage, int prevDocCachePercentage, int childrenCachePercentage, int diffCachePercentage)
T
memoryCacheSize(long memoryCacheSize)
static DocumentNodeStoreBuilder<?>
newDocumentNodeStoreBuilder()
T
setAsyncDelay(int asyncDelay)
Set the maximum delay to write the last revision to the root node.T
setBlobStore(org.apache.jackrabbit.oak.spi.blob.BlobStore blobStore)
Set the blob store to use.T
setBundlingDisabled(boolean enabled)
T
setCacheEmptyCommitValue(boolean enable)
Controls whether caching of empty commit values (negative cache) is enabled.T
setCacheSegmentCount(int cacheSegmentCount)
T
setCacheStackMoveDistance(int cacheSegmentCount)
T
setClusterId(int clusterId)
Set the cluster id to use.T
setClusterInvisible(boolean invisible)
Set the cluster as invisible to the discovery lite service.T
setCommitValueCacheSize(int cacheSize)
T
setDocumentStore(DocumentStore documentStore)
Set the document store to use.T
setDocumentStoreStatsCollector(DocumentStoreStatsCollector documentStoreStatsCollector)
T
setExecutor(Executor executor)
T
setGCMonitor(@NotNull org.apache.jackrabbit.oak.spi.gc.GCMonitor gcMonitor)
T
setJournalCache(String journalCache)
Sets the journal cache option.T
setJournalGCMaxAge(long maxRevisionAgeMillis)
T
setJournalPropertyHandlerFactory(JournalPropertyHandlerFactory factory)
T
setLeaseCheck(boolean leaseCheck)
Deprecated.usesetLeaseCheckMode(LeaseCheckMode)
instead.T
setLeaseCheckMode(LeaseCheckMode mode)
T
setLeaseFailureHandler(LeaseFailureHandler leaseFailureHandler)
T
setLogging(boolean logging)
T
setLoggingPrefix(String prefix)
Sets a custom prefix for the logger.T
setNodeCachePathPredicate(Predicate<Path> p)
T
setNodeCachePredicate(Predicate<String> p)
Deprecated.UsesetNodeCachePathPredicate(Predicate)
instead.T
setNodeStoreStatsCollector(DocumentNodeStoreStatsCollector statsCollector)
T
setPersistentCache(String persistentCache)
Sets the persistent cache option.T
setPrefetchExternalChanges(boolean b)
T
setReadOnlyMode()
T
setStatisticsProvider(org.apache.jackrabbit.oak.stats.StatisticsProvider statisticsProvider)
T
setTiming(boolean timing)
Use the timing document store wrapper.T
setUpdateLimit(int limit)
T
setUseSimpleRevision(boolean useSimpleRevision)
protected T
thisBuilder()
T
withWeigher(Weigher<org.apache.jackrabbit.oak.cache.CacheValue,org.apache.jackrabbit.oak.cache.CacheValue> weigher)
-
-
-
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_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
-
blobStoreSupplier
protected Supplier<org.apache.jackrabbit.oak.spi.blob.BlobStore> blobStoreSupplier
-
-
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.LENIENT
behaviour.
-
getLeaseCheck
@Deprecated public boolean getLeaseCheck()
Deprecated.This method does not distinguish betweenLeaseCheckMode.LENIENT
andLeaseCheckMode.STRICT
and returnstrue
for both modes. UsegetLeaseCheckMode()
instead.
-
setLeaseCheckMode
public T setLeaseCheckMode(LeaseCheckMode mode)
-
setReadOnlyMode
public T setReadOnlyMode()
-
getReadOnlyMode
public boolean getReadOnlyMode()
-
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(org.apache.jackrabbit.oak.spi.blob.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 org.apache.jackrabbit.oak.spi.blob.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()
-
getWeigher
public Weigher<org.apache.jackrabbit.oak.cache.CacheValue,org.apache.jackrabbit.oak.cache.CacheValue> getWeigher()
-
withWeigher
public T withWeigher(Weigher<org.apache.jackrabbit.oak.cache.CacheValue,org.apache.jackrabbit.oak.cache.CacheValue> weigher)
-
memoryCacheSize
public T memoryCacheSize(long memoryCacheSize)
-
memoryCacheDistribution
public T memoryCacheDistribution(int nodeCachePercentage, int prevDocCachePercentage, int childrenCachePercentage, int diffCachePercentage)
-
getNodeCacheSize
public long getNodeCacheSize()
-
getPrevDocumentCacheSize
public long getPrevDocumentCacheSize()
-
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()
-
clock
public T clock(org.apache.jackrabbit.oak.stats.Clock clock)
-
setStatisticsProvider
public T setStatisticsProvider(org.apache.jackrabbit.oak.stats.StatisticsProvider statisticsProvider)
-
getStatisticsProvider
public org.apache.jackrabbit.oak.stats.StatisticsProvider getStatisticsProvider()
-
getDocumentStoreStatsCollector
public DocumentStoreStatsCollector getDocumentStoreStatsCollector()
-
setDocumentStoreStatsCollector
public T setDocumentStoreStatsCollector(DocumentStoreStatsCollector documentStoreStatsCollector)
-
getNodeStoreStatsCollector
public DocumentNodeStoreStatsCollector getNodeStoreStatsCollector()
-
setNodeStoreStatsCollector
public T setNodeStoreStatsCollector(DocumentNodeStoreStatsCollector statsCollector)
-
getPersistenceCacheStats
@NotNull public @NotNull Map<String,PersistentCacheStats> getPersistenceCacheStats()
-
getBlobStoreStats
@Nullable public @Nullable org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats getBlobStoreStats()
-
getBlobStoreCacheStats
@Nullable public @Nullable org.apache.jackrabbit.oak.cache.CacheStats getBlobStoreCacheStats()
-
getClock
public org.apache.jackrabbit.oak.stats.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-only
store. In read-write mode, the cache is always be disabled.- Parameters:
enable
-true
to enable the empty commit value cache.- Returns:
- this builder.
-
getCacheEmptyCommitValue
public boolean getCacheEmptyCommitValue()
- Returns:
true
when caching of empty commit values is enabled,false
otherwise.
-
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.
-
setGCMonitor
public T setGCMonitor(@NotNull @NotNull org.apache.jackrabbit.oak.spi.gc.GCMonitor gcMonitor)
-
getGCMonitor
public org.apache.jackrabbit.oak.spi.gc.GCMonitor getGCMonitor()
-
createVersionGCSupport
public VersionGCSupport createVersionGCSupport()
-
createReferencedBlobs
public Iterable<org.apache.jackrabbit.oak.plugins.blob.ReferencedBlob> createReferencedBlobs(DocumentNodeStore ns)
-
createMissingLastRevSeeker
public MissingLastRevSeeker createMissingLastRevSeeker()
-
buildNodeCache
public Cache<PathRev,DocumentNodeState> buildNodeCache(DocumentNodeStore store)
-
buildChildrenCache
public Cache<NamePathRev,DocumentNodeState.Children> buildChildrenCache(DocumentNodeStore store)
-
buildMemoryDiffCache
public Cache<org.apache.jackrabbit.oak.cache.CacheValue,StringValue> buildMemoryDiffCache()
-
buildLocalDiffCache
public Cache<RevisionsKey,LocalDiffCache.Diff> buildLocalDiffCache()
-
buildDocumentCache
public Cache<org.apache.jackrabbit.oak.cache.CacheValue,NodeDocument> buildDocumentCache(DocumentStore docStore)
-
buildPrevDocumentsCache
public Cache<StringValue,NodeDocument> buildPrevDocumentsCache(DocumentStore docStore)
-
buildNodeDocumentCache
public NodeDocumentCache buildNodeDocumentCache(DocumentStore docStore, NodeDocumentLocks locks)
-
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()
-
-