Class FileStoreBuilder
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.file.FileStoreBuilder
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_MAX_FILE_SIZE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull FileStorebuild()Create a newFileStoreinstance with the settings specified in this builder.Proc.BackendbuildProcBackend(AbstractFileStore fileStore)@NotNull ReadOnlyFileStorebuildReadOnly()Create a newReadOnlyFileStoreinstance with the settings specified in this builder.static @NotNull FileStoreBuilderfileStoreBuilder(@NotNull File directory)Create a new instance of aFileStoreBuilderfor a file store.@NotNull WriterCacheManagergetCacheManager()intgetMaxFileSize()StringtoString()FileStoreBuilderwithBinariesInlineThreshold(int binariesInlineThreshold)Sets the threshold under which binaries are inlined in data segments.@NotNull FileStoreBuilderwithBlobStore(@NotNull BlobStore blobStore)Specify theBlobStore.FileStoreBuilderwithCustomPersistence(SegmentNodeStorePersistence persistence)@NotNull FileStoreBuilderwithDefaultMemoryMapping()Set memory mapping to the default value based on OS propertiesFileStoreBuilderwithEagerSegmentCaching(boolean eagerSegmentCaching)Enable eager segment caching.@NotNull FileStoreBuilderwithGCMonitor(@NotNull GCMonitor gcMonitor)GCMonitorfor monitoring this files store's gc process.@NotNull FileStoreBuilderwithGCOptions(SegmentGCOptions gcOptions)SegmentGCOptionsthe garbage collection options of the store@NotNull FileStoreBuilderwithIOLogging(@NotNull Logger logger)Log IO reads at debug level to the passed logger@NotNull FileStoreBuilderwithIOMonitor(@NotNull IOMonitor ioMonitor)@NotNull FileStoreBuilderwithMaxFileSize(int maxFileSize)Maximal size of the generated tar files in MB.@NotNull FileStoreBuilderwithMemoryMapping(boolean memoryMapping)Turn memory mapping on or off@NotNull FileStoreBuilderwithNodeDeduplicationCacheSize(int nodeDeduplicationCacheSize)Number of items to keep in the node deduplication cache@NotNull FileStoreBuilderwithOffHeapAccess(boolean offHeapAccess)Turn off heap access on or off@NotNull FileStoreBuilderwithPersistentCache(@NotNull PersistentCache persistentCache)ThePersistentCacheinstance to be used, if any.@NotNull FileStoreBuilderwithPersistentCachePreloading(@NotNull PersistentCachePreloadingConfiguration preloadingConfig)ThePersistentCachePreloadingConfigurationto be used for preloading segments.@NotNull FileStoreBuilderwithRemoteStoreMonitor(@NotNull RemoteStoreMonitor remoteStoreMonitor)@NotNull FileStoreBuilderwithSegmentCacheSize(int segmentCacheSize)Size of the segment cache in MB.@NotNull FileStoreBuilderwithSnfeListener(@NotNull SegmentNotFoundExceptionListener snfeListener)SegmentNotFoundExceptionListenerlistener forSegmentNotFoundException@NotNull FileStoreBuilderwithStatisticsProvider(@NotNull StatisticsProvider statisticsProvider)StatisticsProviderfor collecting statistics related to FileStore@NotNull FileStoreBuilderwithStrictVersionCheck(boolean strictVersionCheck)Enable strict version checking.@NotNull FileStoreBuilderwithStringCacheSize(int stringCacheSize)Size of the string cache in MB.@NotNull FileStoreBuilderwithStringDeduplicationCacheSize(int stringDeduplicationCacheSize)Number of items to keep in the string deduplication cache@NotNull FileStoreBuilderwithTemplateCacheSize(int templateCacheSize)Size of the template cache in MB.@NotNull FileStoreBuilderwithTemplateDeduplicationCacheSize(int templateDeduplicationCacheSize)Number of items to keep in the template deduplication cache
-
-
-
Field Detail
-
DEFAULT_MAX_FILE_SIZE
public static final int DEFAULT_MAX_FILE_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
fileStoreBuilder
@NotNull public static @NotNull FileStoreBuilder fileStoreBuilder(@NotNull @NotNull File directory)
Create a new instance of aFileStoreBuilderfor a file store.- Parameters:
directory- directory where the tar files are stored- Returns:
- a new
FileStoreBuilderinstance.
-
withBlobStore
@NotNull public @NotNull FileStoreBuilder withBlobStore(@NotNull @NotNull BlobStore blobStore)
Specify theBlobStore.- Parameters:
blobStore-- Returns:
- this instance
-
withMaxFileSize
@NotNull public @NotNull FileStoreBuilder withMaxFileSize(int maxFileSize)
Maximal size of the generated tar files in MB.- Parameters:
maxFileSize-- Returns:
- this instance
-
withSegmentCacheSize
@NotNull public @NotNull FileStoreBuilder withSegmentCacheSize(int segmentCacheSize)
Size of the segment cache in MB.- Parameters:
segmentCacheSize- None negative cache size- Returns:
- this instance
-
withStringCacheSize
@NotNull public @NotNull FileStoreBuilder withStringCacheSize(int stringCacheSize)
Size of the string cache in MB.- Parameters:
stringCacheSize- None negative cache size- Returns:
- this instance
-
withTemplateCacheSize
@NotNull public @NotNull FileStoreBuilder withTemplateCacheSize(int templateCacheSize)
Size of the template cache in MB.- Parameters:
templateCacheSize- None negative cache size- Returns:
- this instance
-
withStringDeduplicationCacheSize
@NotNull public @NotNull FileStoreBuilder withStringDeduplicationCacheSize(int stringDeduplicationCacheSize)
Number of items to keep in the string deduplication cache- Parameters:
stringDeduplicationCacheSize- None negative cache size- Returns:
- this instance
-
withTemplateDeduplicationCacheSize
@NotNull public @NotNull FileStoreBuilder withTemplateDeduplicationCacheSize(int templateDeduplicationCacheSize)
Number of items to keep in the template deduplication cache- Parameters:
templateDeduplicationCacheSize- None negative cache size- Returns:
- this instance
-
withNodeDeduplicationCacheSize
@NotNull public @NotNull FileStoreBuilder withNodeDeduplicationCacheSize(int nodeDeduplicationCacheSize)
Number of items to keep in the node deduplication cache- Parameters:
nodeDeduplicationCacheSize- None negative cache size. Must be a power of 2.- Returns:
- this instance
-
withPersistentCache
@NotNull public @NotNull FileStoreBuilder withPersistentCache(@NotNull @NotNull PersistentCache persistentCache)
ThePersistentCacheinstance to be used, if any. By default noPersistentCacheis configured.- Parameters:
persistentCache- the persistent cache- Returns:
- this instance
-
withPersistentCachePreloading
@NotNull public @NotNull FileStoreBuilder withPersistentCachePreloading(@NotNull @NotNull PersistentCachePreloadingConfiguration preloadingConfig)
ThePersistentCachePreloadingConfigurationto be used for preloading segments. This configuration must be used together with aPersistentCache, configured viawithPersistentCache(PersistentCache). By default, no segment preloading is configured.- Parameters:
preloadingConfig- the configuration for persistent cache preloading- Returns:
- this instance
-
withMemoryMapping
@NotNull public @NotNull FileStoreBuilder withMemoryMapping(boolean memoryMapping)
Turn memory mapping on or off- Parameters:
memoryMapping-- Returns:
- this instance
-
withOffHeapAccess
@NotNull public @NotNull FileStoreBuilder withOffHeapAccess(boolean offHeapAccess)
Turn off heap access on or off- Parameters:
offHeapAccess-- Returns:
- this instance
-
withDefaultMemoryMapping
@NotNull public @NotNull FileStoreBuilder withDefaultMemoryMapping()
Set memory mapping to the default value based on OS properties- Returns:
- this instance
-
withGCMonitor
@NotNull public @NotNull FileStoreBuilder withGCMonitor(@NotNull @NotNull GCMonitor gcMonitor)
GCMonitorfor monitoring this files store's gc process.- Parameters:
gcMonitor-- Returns:
- this instance
-
withStatisticsProvider
@NotNull public @NotNull FileStoreBuilder withStatisticsProvider(@NotNull @NotNull StatisticsProvider statisticsProvider)
StatisticsProviderfor collecting statistics related to FileStore- Parameters:
statisticsProvider-- Returns:
- this instance
-
withGCOptions
@NotNull public @NotNull FileStoreBuilder withGCOptions(SegmentGCOptions gcOptions)
SegmentGCOptionsthe garbage collection options of the store- Parameters:
gcOptions-- Returns:
- this instance
-
withSnfeListener
@NotNull public @NotNull FileStoreBuilder withSnfeListener(@NotNull @NotNull SegmentNotFoundExceptionListener snfeListener)
SegmentNotFoundExceptionListenerlistener forSegmentNotFoundException- Parameters:
snfeListener- , the actual listener- Returns:
- this instance
-
withIOMonitor
@NotNull public @NotNull FileStoreBuilder withIOMonitor(@NotNull @NotNull IOMonitor ioMonitor)
-
withRemoteStoreMonitor
@NotNull public @NotNull FileStoreBuilder withRemoteStoreMonitor(@NotNull @NotNull RemoteStoreMonitor remoteStoreMonitor)
-
withIOLogging
@NotNull public @NotNull FileStoreBuilder withIOLogging(@NotNull @NotNull Logger logger)
Log IO reads at debug level to the passed logger- Parameters:
logger- logger for logging IO reads- Returns:
- this.
-
withStrictVersionCheck
@NotNull public @NotNull FileStoreBuilder withStrictVersionCheck(boolean strictVersionCheck)
Enable strict version checking. With strict version checking enabled Oak will fail to start if the store version does not exactly match this Oak version. This is useful to e.g. avoid inadvertent upgrades during when running offline compaction accidentally against an older version of a store.- Parameters:
strictVersionCheck- enables strict version checking ifftrue.- Returns:
- this instance
-
withCustomPersistence
public FileStoreBuilder withCustomPersistence(SegmentNodeStorePersistence persistence)
-
withEagerSegmentCaching
public FileStoreBuilder withEagerSegmentCaching(boolean eagerSegmentCaching)
Enable eager segment caching. This proves useful when segments need to be cached as soon as they are created, right before persisting them to disk. One such scenario is the cold standby, see OAK-8006.- Parameters:
eagerSegmentCaching- enables eager segment caching ifftrue.- Returns:
- this instance
-
withBinariesInlineThreshold
public FileStoreBuilder withBinariesInlineThreshold(int binariesInlineThreshold)
Sets the threshold under which binaries are inlined in data segments.- Parameters:
binariesInlineThreshold- the threshold- Returns:
- this instance
-
buildProcBackend
public Proc.Backend buildProcBackend(AbstractFileStore fileStore) throws IOException
- Throws:
IOException
-
build
@NotNull public @NotNull FileStore build() throws InvalidFileStoreVersionException, IOException
Create a newFileStoreinstance with the settings specified in this builder. If none of thewithmethods have been called before calling this method, a file store with the following default settings is returned:- blob store: inline
- max file size: 256MB
- cache size: 256MB
- memory mapping: on for 64 bit JVMs off otherwise
- whiteboard: none. No
GCMonitortracking - statsProvider:
StatisticsProvider.NOOP - GC options:
SegmentGCOptions.defaultGCOptions()
- Returns:
- a new file store instance
- Throws:
IOExceptionInvalidFileStoreVersionException
-
buildReadOnly
@NotNull public @NotNull ReadOnlyFileStore buildReadOnly() throws InvalidFileStoreVersionException, IOException
Create a newReadOnlyFileStoreinstance with the settings specified in this builder. If none of thewithmethods have been called before calling this method, a file store with the following default settings is returned:- blob store: inline
- max file size: 256MB
- cache size: 256MB
- memory mapping: on for 64 bit JVMs off otherwise
- whiteboard: none. No
GCMonitortracking - statsProvider:
StatisticsProvider.NOOP - GC options:
SegmentGCOptions.defaultGCOptions()
- Returns:
- a new file store instance
- Throws:
IOExceptionInvalidFileStoreVersionException
-
getMaxFileSize
public int getMaxFileSize()
-
getCacheManager
@NotNull public @NotNull WriterCacheManager getCacheManager()
- Returns:
- creates or returns the
WriterCacheManagerthis builder passes or passed to the store onbuild(). - See Also:
withNodeDeduplicationCacheSize(int),withStringDeduplicationCacheSize(int),withTemplateDeduplicationCacheSize(int)
-
-