Class EmbeddedStorageManagerBuilder

java.lang.Object
io.helidon.integrations.microstream.core.EmbeddedStorageManagerBuilder
All Implemented Interfaces:
Builder<EmbeddedStorageManagerBuilder,one.microstream.storage.embedded.types.EmbeddedStorageManager>, Supplier<one.microstream.storage.embedded.types.EmbeddedStorageManager>

public class EmbeddedStorageManagerBuilder extends Object implements Builder<EmbeddedStorageManagerBuilder,one.microstream.storage.embedded.types.EmbeddedStorageManager>
Builder for Microstream EmbeddedStorageManager.
  • Method Details

    • builder

      public static EmbeddedStorageManagerBuilder builder()
      A builder for the EmbeddedStorageManager.
      Returns:
      a new fluent API builder
    • create

      public static one.microstream.storage.embedded.types.EmbeddedStorageManager create(Config config)
      Create a EmbeddedStorageManager instance from Config.
      Parameters:
      config - configuration to use
      Returns:
      new EmbeddedStorageManager instance
    • build

      public one.microstream.storage.embedded.types.EmbeddedStorageManager build()
      Description copied from interface: Builder
      Build the instance from this builder.
      Specified by:
      build in interface Builder<EmbeddedStorageManagerBuilder,one.microstream.storage.embedded.types.EmbeddedStorageManager>
      Returns:
      instance of the built type
    • config

      public EmbeddedStorageManagerBuilder config(Config config)
      Update builder from configuration.
      Parameters:
      config -
      Returns:
      the fluent API builder
    • storageDirectory

      public EmbeddedStorageManagerBuilder storageDirectory(String storageDirectory)
      The base directory of the storage in the file system.
      Parameters:
      storageDirectory - location of the storage as string.
      Returns:
      EmbeddedStorageManager builder
    • backupDirectory

      public EmbeddedStorageManagerBuilder backupDirectory(String backupDirectory)
      The backup directory.
      Parameters:
      backupDirectory - location of the storage backup as string.
      Returns:
      EmbeddedStorageManager builder
    • deletionDirectory

      public EmbeddedStorageManagerBuilder deletionDirectory(String deletionDirectory)
      The deletion directory.
      Parameters:
      deletionDirectory - location of the storage's deleted files backup as string.
      Returns:
      EmbeddedStorageManager builder
    • truncationDirectory

      public EmbeddedStorageManagerBuilder truncationDirectory(String truncationDirectory)
      The truncation directory.
      Parameters:
      truncationDirectory - location of the storage's truncation files backup as string.
      Returns:
      EmbeddedStorageManager builder
    • channelDirectoryPrefix

      public EmbeddedStorageManagerBuilder channelDirectoryPrefix(String channelDirectoryPrefix)
      Name prefix of the subdirectories used by the channel threads. Default is "channel_".
      Parameters:
      channelDirectoryPrefix - new prefix
      Returns:
      EmbeddedStorageManager builder
    • dataFilePrefix

      public EmbeddedStorageManagerBuilder dataFilePrefix(String dataFilePrefix)
      Name prefix of the storage files. Default is "channel_".
      Parameters:
      dataFilePrefix - new prefix
      Returns:
      EmbeddedStorageManager builder
    • dataFileSuffix

      public EmbeddedStorageManagerBuilder dataFileSuffix(String dataFileSuffix)
      Name suffix of the storage files. Default is ".dat".
      Parameters:
      dataFileSuffix - new suffix
      Returns:
      EmbeddedStorageManager builder
    • transactionFilePrefix

      public EmbeddedStorageManagerBuilder transactionFilePrefix(String transactionFilePrefix)
      Name prefix of the storage transaction file. Default is "transactions_".
      Parameters:
      transactionFilePrefix - new prefix
      Returns:
      EmbeddedStorageManager builder
    • transactionFileSuffix

      public EmbeddedStorageManagerBuilder transactionFileSuffix(String transactionFileSuffix)
      Name suffix of the storage transaction file. Default is ".sft".
      Parameters:
      transactionFileSuffix - new suffix
      Returns:
      EmbeddedStorageManager builder
    • typeDictionaryFilename

      public EmbeddedStorageManagerBuilder typeDictionaryFilename(String typeDictionaryFilename)
      The name of the dictionary file. Default is "PersistenceTypeDictionary.ptd".
      Parameters:
      typeDictionaryFilename - new name
      Returns:
      EmbeddedStorageManager builder
    • rescuedFileSuffix

      public EmbeddedStorageManagerBuilder rescuedFileSuffix(String rescuedFileSuffix)
      Name suffix of the storage rescue files. Default is ".bak".
      Parameters:
      rescuedFileSuffix -
      Returns:
      EmbeddedStorageManager builder
    • lockFileName

      public EmbeddedStorageManagerBuilder lockFileName(String lockFileName)
      Name of the lock file. Default is "used.lock"
      Parameters:
      lockFileName -
      Returns:
      EmbeddedStorageManager builder
    • channelCount

      public EmbeddedStorageManagerBuilder channelCount(int channelCount)
      The number of threads and number of directories used by the storage engine. Every thread has exclusive access to its directory. Default is 1.
      Parameters:
      channelCount - the new channel count, must be a power of 2
      Returns:
      EmbeddedStorageManager builder
    • housekeepingInterval

      public EmbeddedStorageManagerBuilder housekeepingInterval(Duration housekeepingInterval)
      Interval in milliseconds for the housekeeping. This is work like garbage collection or cache checking. In combination with housekeepingTimeBudget(Duration) the maximum processor time for housekeeping work can be set. Default is 1000 (every second).
      Parameters:
      housekeepingInterval - the new interval
      Returns:
      EmbeddedStorageManager builder
      See Also:
    • housekeepingTimeBudget

      public EmbeddedStorageManagerBuilder housekeepingTimeBudget(Duration housekeepingTimeBudget)
      Number of nanoseconds used for each housekeeping cycle. However, no matter how low the number is, one item of work will always be completed. But if there is nothing to clean up, no processor time will be wasted. Default is 10000000 (10 million nanoseconds = 10 milliseconds = 0.01 seconds).
      Parameters:
      housekeepingTimeBudget - the new time budget
      Returns:
      EmbeddedStorageManager builder
      See Also:
    • entityCacheTimeout

      public EmbeddedStorageManagerBuilder entityCacheTimeout(Duration entityCacheTimeout)
      Timeout in milliseconds for the entity cache evaluator. If an entity wasn't accessed in this timespan it will be removed from the cache. Default is 86400000 (1 day).
      Parameters:
      entityCacheTimeout -
      Returns:
      EmbeddedStorageManager builder
      See Also:
    • entityCacheThreshold

      public EmbeddedStorageManagerBuilder entityCacheThreshold(long entityCacheThreshold)
      Abstract threshold value for the lifetime of entities in the cache. See StorageEntityCacheEvaluator. Default is 1000000000.
      Parameters:
      entityCacheThreshold - the new threshold
      Returns:
      EmbeddedStorageManager builder
    • dataFileMinimumSize

      public EmbeddedStorageManagerBuilder dataFileMinimumSize(one.microstream.configuration.types.ByteSize dataFileMinimumSize)
      Minimum file size for a data file to avoid cleaning it up. Default is 1024^2 = 1 MiB.
      Parameters:
      dataFileMinimumSize - the new minimum file size
      Returns:
      EmbeddedStorageManager builder
      See Also:
    • dataFileMaximumSize

      public EmbeddedStorageManagerBuilder dataFileMaximumSize(one.microstream.configuration.types.ByteSize dataFileMaximumSize)
      Maximum file size for a data file to avoid cleaning it up. Default is 1024^2*8 = 8 MiB.
      Parameters:
      dataFileMaximumSize - the new maximum file size
      Returns:
      EmbeddedStorageManager builder
      See Also:
    • dataFileMinimumUseRatio

      public EmbeddedStorageManagerBuilder dataFileMinimumUseRatio(double dataFileMinimumUseRatio)
      The ratio (value in ]0.0;1.0]) of non-gap data contained in a storage file to prevent the file from being dissolved. "Gap" data is anything that is not the latest version of an entity's data, including older versions of an entity and "comment" bytes (a sequence of bytes beginning with its length as a negative value length header).
      The closer this value is to 1.0 (100%), the less disk space is occupied by storage files, but the more file dissolving (data transfers to new files) is required and vice versa.
      Parameters:
      dataFileMinimumUseRatio - the new minimum use ratio
      Returns:
      EmbeddedStorageManager builder
    • dataFileCleanupHeadFile

      public EmbeddedStorageManagerBuilder dataFileCleanupHeadFile(boolean dataFileCleanupHeadFile)
      A flag defining whether the current head file (the only file actively written to) shall be subjected to file cleanups as well.
      Parameters:
      dataFileCleanupHeadFile -
      Returns:
      EmbeddedStorageManager builder