Class FileStoreBuilder
java.lang.Object
org.apache.jackrabbit.oak.segment.file.FileStoreBuilder
Builder for creating
FileStore
instances.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription@NotNull FileStore
build()
Create a newFileStore
instance with the settings specified in this builder.buildProcBackend
(AbstractFileStore fileStore) @NotNull ReadOnlyFileStore
Create a newReadOnlyFileStore
instance with the settings specified in this builder.static @NotNull FileStoreBuilder
fileStoreBuilder
(@NotNull File directory) Create a new instance of aFileStoreBuilder
for a file store.@NotNull WriterCacheManager
int
toString()
withBinariesInlineThreshold
(int binariesInlineThreshold) Sets the threshold under which binaries are inlined in data segments.@NotNull FileStoreBuilder
withBlobStore
(@NotNull BlobStore blobStore) Specify theBlobStore
.withCustomPersistence
(SegmentNodeStorePersistence persistence) @NotNull FileStoreBuilder
Set memory mapping to the default value based on OS propertieswithEagerSegmentCaching
(boolean eagerSegmentCaching) Enable eager segment caching.@NotNull FileStoreBuilder
withGCMonitor
(@NotNull GCMonitor gcMonitor) GCMonitor
for monitoring this files store's gc process.@NotNull FileStoreBuilder
withGCOptions
(SegmentGCOptions gcOptions) SegmentGCOptions
the garbage collection options of the store@NotNull FileStoreBuilder
withIOLogging
(@NotNull Logger logger) Log IO reads at debug level to the passed logger@NotNull FileStoreBuilder
withIOMonitor
(@NotNull IOMonitor ioMonitor) @NotNull FileStoreBuilder
withMaxFileSize
(int maxFileSize) Maximal size of the generated tar files in MB.@NotNull FileStoreBuilder
withMemoryMapping
(boolean memoryMapping) Turn memory mapping on or off@NotNull FileStoreBuilder
withNodeDeduplicationCacheSize
(int nodeDeduplicationCacheSize) Number of items to keep in the node deduplication cache@NotNull FileStoreBuilder
withOffHeapAccess
(boolean offHeapAccess) Turn off heap access on or off@NotNull FileStoreBuilder
withRemoteStoreMonitor
(@NotNull RemoteStoreMonitor remoteStoreMonitor) @NotNull FileStoreBuilder
withSegmentCacheSize
(int segmentCacheSize) Size of the segment cache in MB.@NotNull FileStoreBuilder
withSnfeListener
(@NotNull SegmentNotFoundExceptionListener snfeListener) SegmentNotFoundExceptionListener
listener forSegmentNotFoundException
@NotNull FileStoreBuilder
withStatisticsProvider
(@NotNull StatisticsProvider statisticsProvider) StatisticsProvider
for collecting statistics related to FileStore@NotNull FileStoreBuilder
withStrictVersionCheck
(boolean strictVersionCheck) Enable strict version checking.@NotNull FileStoreBuilder
withStringCacheSize
(int stringCacheSize) Size of the string cache in MB.@NotNull FileStoreBuilder
withStringDeduplicationCacheSize
(int stringDeduplicationCacheSize) Number of items to keep in the string deduplication cache@NotNull FileStoreBuilder
withTemplateCacheSize
(int templateCacheSize) Size of the template cache in MB.@NotNull FileStoreBuilder
withTemplateDeduplicationCacheSize
(int templateDeduplicationCacheSize) Number of items to keep in the template deduplication cache
-
Field Details
-
DEFAULT_MAX_FILE_SIZE
public static final int DEFAULT_MAX_FILE_SIZE- See Also:
-
-
Method Details
-
fileStoreBuilder
Create a new instance of aFileStoreBuilder
for a file store.- Parameters:
directory
- directory where the tar files are stored- Returns:
- a new
FileStoreBuilder
instance.
-
withBlobStore
Specify theBlobStore
.- Parameters:
blobStore
-- Returns:
- this instance
-
withMaxFileSize
Maximal size of the generated tar files in MB.- Parameters:
maxFileSize
-- Returns:
- this instance
-
withSegmentCacheSize
Size of the segment cache in MB.- Parameters:
segmentCacheSize
- None negative cache size- Returns:
- this instance
-
withStringCacheSize
Size of the string cache in MB.- Parameters:
stringCacheSize
- None negative cache size- Returns:
- this instance
-
withTemplateCacheSize
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
-
withMemoryMapping
Turn memory mapping on or off- Parameters:
memoryMapping
-- Returns:
- this instance
-
withOffHeapAccess
Turn off heap access on or off- Parameters:
offHeapAccess
-- Returns:
- this instance
-
withDefaultMemoryMapping
Set memory mapping to the default value based on OS properties- Returns:
- this instance
-
withGCMonitor
GCMonitor
for monitoring this files store's gc process.- Parameters:
gcMonitor
-- Returns:
- this instance
-
withStatisticsProvider
@NotNull public @NotNull FileStoreBuilder withStatisticsProvider(@NotNull @NotNull StatisticsProvider statisticsProvider) StatisticsProvider
for collecting statistics related to FileStore- Parameters:
statisticsProvider
-- Returns:
- this instance
-
withGCOptions
SegmentGCOptions
the garbage collection options of the store- Parameters:
gcOptions
-- Returns:
- this instance
-
withSnfeListener
@NotNull public @NotNull FileStoreBuilder withSnfeListener(@NotNull @NotNull SegmentNotFoundExceptionListener snfeListener) SegmentNotFoundExceptionListener
listener forSegmentNotFoundException
- Parameters:
snfeListener
- , the actual listener- Returns:
- this instance
-
withIOMonitor
-
withRemoteStoreMonitor
@NotNull public @NotNull FileStoreBuilder withRemoteStoreMonitor(@NotNull @NotNull RemoteStoreMonitor remoteStoreMonitor) -
withIOLogging
Log IO reads at debug level to the passed logger- Parameters:
logger
- logger for logging IO reads- Returns:
- this.
-
withStrictVersionCheck
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
-
withEagerSegmentCaching
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
Sets the threshold under which binaries are inlined in data segments.- Parameters:
binariesInlineThreshold
- the threshold- Returns:
- this instance
-
buildProcBackend
- Throws:
IOException
-
build
Create a newFileStore
instance with the settings specified in this builder. If none of thewith
methods 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
GCMonitor
tracking - statsProvider:
StatisticsProvider.NOOP
- GC options:
SegmentGCOptions.defaultGCOptions()
- Returns:
- a new file store instance
- Throws:
IOException
InvalidFileStoreVersionException
-
buildReadOnly
@NotNull public @NotNull ReadOnlyFileStore buildReadOnly() throws InvalidFileStoreVersionException, IOExceptionCreate a newReadOnlyFileStore
instance with the settings specified in this builder. If none of thewith
methods 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
GCMonitor
tracking - statsProvider:
StatisticsProvider.NOOP
- GC options:
SegmentGCOptions.defaultGCOptions()
- Returns:
- a new file store instance
- Throws:
IOException
InvalidFileStoreVersionException
-
getMaxFileSize
public int getMaxFileSize() -
getCacheManager
- Returns:
- creates or returns the
WriterCacheManager
this builder passes or passed to the store onbuild()
. - See Also:
-
toString
-