Class FileStoreBuilder

java.lang.Object
org.apache.jackrabbit.oak.segment.file.FileStoreBuilder

public class FileStoreBuilder extends Object
Builder for creating FileStore instances.
  • Field Details

  • Method Details

    • fileStoreBuilder

      @NotNull public static @NotNull FileStoreBuilder fileStoreBuilder(@NotNull @NotNull File directory)
      Create a new instance of a FileStoreBuilder for a file store.
      Parameters:
      directory - directory where the tar files are stored
      Returns:
      a new FileStoreBuilder instance.
    • withBlobStore

      @NotNull public @NotNull FileStoreBuilder withBlobStore(@NotNull @NotNull BlobStore blobStore)
      Specify the BlobStore.
      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
    • 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)
      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

      @NotNull public @NotNull FileStoreBuilder withGCOptions(SegmentGCOptions gcOptions)
      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 for SegmentNotFoundException
      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 iff true.
      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 iff true.
      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 new FileStore instance with the settings specified in this builder. If none of the with methods have been called before calling this method, a file store with the following default settings is returned:
      Returns:
      a new file store instance
      Throws:
      IOException
      InvalidFileStoreVersionException
    • buildReadOnly

      @NotNull public @NotNull ReadOnlyFileStore buildReadOnly() throws InvalidFileStoreVersionException, IOException
      Create a new ReadOnlyFileStore instance with the settings specified in this builder. If none of the with methods have been called before calling this method, a file store with the following default settings is returned:
      Returns:
      a new file store instance
      Throws:
      IOException
      InvalidFileStoreVersionException
    • getMaxFileSize

      public int getMaxFileSize()
    • getCacheManager

      @NotNull public @NotNull WriterCacheManager getCacheManager()
      Returns:
      creates or returns the WriterCacheManager this builder passes or passed to the store on build().
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object