Interface Configuration
- All Known Implementing Classes:
Configuration.Default
public interface Configuration
Mutable configuration type, which serves as a template for an EmbeddedStorageFoundation
.
Its purposes are:
- To offer all possible settings of the MicroStream Storage in one place.
- And to enable external configuration.
Code example:
EmbeddedStorageManager storageManager = Configuration.Default() .setBaseDirectoryInUserHome("data-dir") .setBackupDirectory("backup-dir") .setChannelCount(4) .createEmbeddedStorageFoundation() .createEmbeddedStorageManager();
External configuration example with properties file
baseDirectory = ~/data-dir backupDirectory = backup-dir channelCount = 4 Configuration configuration = Configuration.LoadIni( "path-to-properties-file" );
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Configuration.Default
-
Method Summary
Modifier and Type Method Description default EmbeddedStorageFoundation<?>
createEmbeddedStorageFoundation()
Creates anEmbeddedStorageFoundation
based on the settings of thisConfiguration
.static Configuration
Default()
Creates a newConfiguration
with the default settings.static String
DefaultResourceName()
The default name of the storage configuration resource.String
getBackupDirectory()
The backup directory.String
getBaseDirectory()
The base directory of the storage in the file system.int
getChannelCount()
The number of threads and number of directories used by the storage engine.String
getChannelDirectoryPrefix()
Name prefix of the subdirectories used by the channel threads.boolean
getDataFileCleanupHeadFile()
A flag defining wether the current head file (the only file actively written to) shall be subjected to file cleanups as well.default double
getDataFileDissolveRatio()
Deprecated.replaced bygetDataFileMinimumUseRatio()
, will be removed in a future releaseint
getDataFileMaximumSize()
Maximum file size for a data file to avoid cleaning it up.default int
getDataFileMaxSize()
Deprecated.replaced bygetDataFileMaximumSize()
, will be removed in a future releaseint
getDataFileMinimumSize()
Minimum file size for a data file to avoid cleaning it up.double
getDataFileMinimumUseRatio()
The ratio (value in ]0.0;1.0]) of non-gap data contained in a storage file to prevent the file from being dissolved.default int
getDataFileMinSize()
Deprecated.replaced bygetDataFileMinimumSize()
, will be removed in a future releaseString
getDataFilePrefix()
Name prefix of the storage files.String
getDataFileSuffix()
Name suffix of the storage files.String
getDeletionDirectory()
The deletion directory.long
getEntityCacheThreshold()
Abstract threshold value for the lifetime of entities in the cache.default long
getEntityCacheTimeout()
Deprecated.replaced bygetEntityCacheTimeoutMs()
, will be removed in a future releaselong
getEntityCacheTimeoutMs()
Timeout in milliseconds for the entity cache evaluator.default long
getHouseKeepingInterval()
Deprecated.replaced bygetHousekeepingIntervalMs()
, will be removed in a future releaselong
getHousekeepingIntervalMs()
Interval in milliseconds for the houskeeping.default long
getHouseKeepingNanoTimeBudget()
Deprecated.replaced bygetHousekeepingTimeBudgetNs()
, will be removed in a future releaselong
getHousekeepingTimeBudgetNs()
Number of nanoseconds used for each housekeeping cycle.String
getTransactionFilePrefix()
Name prefix of the storage transaction file.String
getTransactionFileSuffix()
Name suffix of the storage transaction file.String
getTruncationDirectory()
The truncation directory.String
getTypeDictionaryFilename()
The name of the dictionary file.static Configuration
Load()
Tries to load the default configuration properties file.static Configuration
Load(String path)
Tries to load the configuration file frompath
.static Configuration
Load(String path, Charset charset)
Tries to load the configuration file frompath
.static Configuration
Load(Charset charset)
Tries to load the default configuration properties file.static Configuration
LoadIni(File file)
Tries to load the configuration INI from the filefile
.static Configuration
LoadIni(File file, Charset charset)
Tries to load the configuration INI from the filefile
.static Configuration
LoadIni(InputStream inputStream)
Tries to load the configuration INI from theInputStream
inputStream
.static Configuration
LoadIni(InputStream inputStream, Charset charset)
Tries to load the configuration INI from theInputStream
inputStream
.static Configuration
LoadIni(String path)
Tries to load the configuration INI file frompath
.static Configuration
LoadIni(String path, Charset charset)
Tries to load the configuration INI file frompath
.static Configuration
LoadIni(URL url)
Tries to load the configuration INI from the URLurl
.static Configuration
LoadIni(URL url, Charset charset)
Tries to load the configuration INI from the URLurl
.static Configuration
LoadIni(Path path)
Tries to load the configuration INI file frompath
.static Configuration
LoadIni(Path path, Charset charset)
Tries to load the configuration INI file frompath
.static Configuration
LoadXml(File file)
Tries to load the configuration XML from the filefile
.static Configuration
LoadXml(File file, Charset charset)
Tries to load the configuration XML from the filefile
.static Configuration
LoadXml(InputStream inputStream)
Tries to load the configuration XML from theInputStream
inputStream
.static Configuration
LoadXml(InputStream inputStream, Charset charset)
Tries to load the configuration XML from theInputStream
inputStream
.static Configuration
LoadXml(String path)
Tries to load the configuration XML file frompath
.static Configuration
LoadXml(String path, Charset charset)
Tries to load the configuration XML file frompath
.static Configuration
LoadXml(URL url)
Tries to load the configuration XML from the URLurl
.static Configuration
LoadXml(URL url, Charset charset)
Tries to load the configuration XML from the URLurl
.static Configuration
LoadXml(Path path)
Tries to load the configuration XML file frompath
.static Configuration
LoadXml(Path path, Charset charset)
Tries to load the configuration XML file frompath
.static String
PathProperty()
The property name which is used to hand the external configuration file path to the application.Configuration
setBackupDirectory(String backupDirectory)
The backup directory.default Configuration
setBackupDirectoryInUserHome(String backupDirectoryInUserHome)
The backup directory.Configuration
setBaseDirectory(String baseDirectory)
The base directory of the storage in the file system.default Configuration
setBaseDirectoryInUserHome(String baseDirectoryInUserHome)
The base directory of the storage in the file system.Configuration
setChannelCount(int channelCount)
The number of threads and number of directories used by the storage engine.Configuration
setChannelDirectoryPrefix(String channelDirectoryPrefix)
Name prefix of the subdirectories used by the channel threads.Configuration
setDataFileCleanupHeadFile(boolean dataFileCleanupHeadFile)
A flag defining wether the current head file (the only file actively written to) shall be subjected to file cleanups as well.default Configuration
setDataFileDissolveRatio(double dataFileDissolveRatio)
Deprecated.replaced bysetDataFileMinimumUseRatio(double)
, will be removed in a future releaseConfiguration
setDataFileMaximumSize(int dataFileMaximumSize)
Maximum file size for a data file to avoid cleaning it up.default Configuration
setDataFileMaxSize(int dataFileMaxSize)
Deprecated.replaced bysetDataFileMaximumSize(int)
, will be removed in a future releaseConfiguration
setDataFileMinimumSize(int dataFileMinimumSize)
Minimum file size for a data file to avoid cleaning it up.Configuration
setDataFileMinimumUseRatio(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.default Configuration
setDataFileMinSize(int dataFileMinSize)
Deprecated.replaced bysetDataFileMinimumSize(int)
, will be removed in a future releaseConfiguration
setDataFilePrefix(String dataFilePrefix)
Name prefix of the storage files.Configuration
setDataFileSuffix(String dataFileSuffix)
Name suffix of the storage files.Configuration
setDeletionDirectory(String deletionDirectory)
The deletion directory.Configuration
setEntityCacheThreshold(long entityCacheThreshold)
Abstract threshold value for the lifetime of entities in the cache.default Configuration
setEntityCacheTimeout(long entityCacheTimeout)
Deprecated.replaced bysetEntityCacheTimeoutMs(long)
, will be removed in a future releaseConfiguration
setEntityCacheTimeoutMs(long entityCacheTimeoutMs)
Timeout in milliseconds for the entity cache evaluator.default Configuration
setHouseKeepingInterval(long houseKeepingInterval)
Deprecated.replaced bysetHousekeepingIntervalMs(long)
, will be removed in a future releaseConfiguration
setHousekeepingIntervalMs(long houseKeepingIntervalMs)
Interval in milliseconds for the houskeeping.default Configuration
setHouseKeepingNanoTimeBudget(long houseKeepingNanoTimeBudget)
Deprecated.replaced bysetHousekeepingTimeBudgetNs(long)
, will be removed in a future releaseConfiguration
setHousekeepingTimeBudgetNs(long housekeepingTimeBudgetNs)
Number of nanoseconds used for each housekeeping cycle.Configuration
setTransactionFilePrefix(String transactionFilePrefix)
Name prefix of the storage transaction file.Configuration
setTransactionFileSuffix(String transactionFileSuffix)
Name suffix of the storage transaction file.Configuration
setTruncationDirectory(String truncationDirectory)
The truncation directory.Configuration
setTypeDictionaryFilename(String typeDictionaryFilename)
The name of the dictionary file.
-
Method Details
-
PathProperty
The property name which is used to hand the external configuration file path to the application.Either as system property or in the context's configuration, e.g. Spring's application.properties.
- Returns:
- "microstream.storage.configuration.path"
-
DefaultResourceName
The default name of the storage configuration resource.- Returns:
- "microstream-storage.properties"
- See Also:
Load()
-
Load
Tries to load the default configuration properties file.The search order is as follows:
- The path set in the system property "microstream.storage.configuration.path"
- The file named "microstream-storage.properties" in
- The classpath
- The application's directory
- The user home directory
- Returns:
- the loaded configuration or
null
if none was found - See Also:
PathProperty()
,DefaultResourceName()
-
Load
Tries to load the default configuration properties file.The search order is as follows:
- The path set in the system property "microstream.storage.configuration.path"
- The file named "microstream-storage.properties" in
- The classpath
- The application's directory
- The user home directory
- Parameters:
charset
- the charset used to load the configuration- Returns:
- the loaded configuration or
null
if none was found - See Also:
PathProperty()
,DefaultResourceName()
-
Load
Tries to load the configuration file frompath
. Depending on the file suffix either the XML or the INI loader is used.The load order is as follows:
- The classpath
- As an URL
- As a file
- Parameters:
path
- a classpath resource, a file path or an URL- Returns:
- the configuration or
null
if none was found
-
Load
Tries to load the configuration file frompath
. Depending on the file suffix either the XML or the INI loader is used.The load order is as follows:
- The classpath
- As an URL
- As a file
- Parameters:
path
- a classpath resource, a file path or an URLcharset
- the charset used to load the configuration- Returns:
- the configuration or
null
if none was found
-
LoadIni
Tries to load the configuration INI file frompath
.The load order is as follows:
- The classpath
- As an URL
- As a file
- Parameters:
path
- a classpath resource, a file path or an URL- Returns:
- the configuration or
null
if none was found
-
LoadIni
Tries to load the configuration INI file frompath
.The load order is as follows:
- The classpath
- As an URL
- As a file
- Parameters:
path
- a classpath resource, a file path or an URLcharset
- the charset used to load the configuration- Returns:
- the configuration or
null
if none was found
-
LoadIni
Tries to load the configuration INI file frompath
.- Parameters:
path
- file system path- Returns:
- the configuration
- Throws:
StorageConfigurationException
- if the configuration couldn't be loaded
-
LoadIni
Tries to load the configuration INI file frompath
.- Parameters:
path
- file system pathcharset
- the charset used to load the configuration- Returns:
- the configuration
- Throws:
StorageConfigurationException
- if the configuration couldn't be loaded
-
LoadIni
Tries to load the configuration INI from the filefile
.- Parameters:
file
- file path- Returns:
- the configuration
- Throws:
StorageConfigurationException
- if the configuration couldn't be loaded
-
LoadIni
Tries to load the configuration INI from the filefile
.- Parameters:
file
- file pathcharset
- the charset used to load the configuration- Returns:
- the configuration
- Throws:
StorageConfigurationException
- if the configuration couldn't be loaded
-
LoadIni
Tries to load the configuration INI from the URLurl
.- Parameters:
url
- URL path- Returns:
- the configuration
- Throws:
StorageConfigurationException
- if the configuration couldn't be loaded
-
LoadIni
Tries to load the configuration INI from the URLurl
.- Parameters:
url
- URL pathcharset
- the charset used to load the configuration- Returns:
- the configuration
- Throws:
StorageConfigurationException
- if the configuration couldn't be loaded
-
LoadIni
Tries to load the configuration INI from theInputStream
inputStream
.- Parameters:
inputStream
- the stream to read from- Returns:
- the configuration
- Throws:
StorageConfigurationException
- if the configuration couldn't be loaded
-
LoadIni
Tries to load the configuration INI from theInputStream
inputStream
.- Parameters:
inputStream
- the stream to read fromcharset
- the charset used to load the configuration- Returns:
- the configuration
- Throws:
StorageConfigurationException
- if the configuration couldn't be loaded
-
LoadXml
Tries to load the configuration XML file frompath
.The load order is as follows:
- The classpath
- As an URL
- As a file
- Parameters:
path
- a classpath resource, a file path or an URL- Returns:
- the configuration or
null
if none was found
-
LoadXml
Tries to load the configuration XML file frompath
.The load order is as follows:
- The classpath
- As an URL
- As a file
- Parameters:
path
- a classpath resource, a file path or an URLcharset
- the charset used to load the configuration- Returns:
- the configuration or
null
if none was found
-
LoadXml
Tries to load the configuration XML file frompath
.- Parameters:
path
- file system path- Returns:
- the configuration
- Throws:
StorageConfigurationException
- if the configuration couldn't be loaded
-
LoadXml
Tries to load the configuration XML file frompath
.- Parameters:
path
- file system pathcharset
- the charset used to load the configuration- Returns:
- the configuration
- Throws:
StorageConfigurationException
- if the configuration couldn't be loaded
-
LoadXml
Tries to load the configuration XML from the filefile
.- Parameters:
file
- file path- Returns:
- the configuration
- Throws:
StorageConfigurationException
- if the configuration couldn't be loaded
-
LoadXml
Tries to load the configuration XML from the filefile
.- Parameters:
file
- file pathcharset
- the charset used to load the configuration- Returns:
- the configuration
- Throws:
StorageConfigurationException
- if the configuration couldn't be loaded
-
LoadXml
Tries to load the configuration XML from the URLurl
.- Parameters:
url
- URL path- Returns:
- the configuration
- Throws:
StorageConfigurationException
- if the configuration couldn't be loaded
-
LoadXml
Tries to load the configuration XML from the URLurl
.- Parameters:
url
- URL pathcharset
- the charset used to load the configuration- Returns:
- the configuration
- Throws:
StorageConfigurationException
- if the configuration couldn't be loaded
-
LoadXml
Tries to load the configuration XML from theInputStream
inputStream
.- Parameters:
inputStream
- the stream to read from- Returns:
- the configuration
- Throws:
StorageConfigurationException
- if the configuration couldn't be loaded
-
LoadXml
Tries to load the configuration XML from theInputStream
inputStream
.- Parameters:
inputStream
- the stream to read fromcharset
- the charset used to load the configuration- Returns:
- the configuration
- Throws:
StorageConfigurationException
- if the configuration couldn't be loaded
-
createEmbeddedStorageFoundation
Creates anEmbeddedStorageFoundation
based on the settings of thisConfiguration
.- Returns:
- an
EmbeddedStorageFoundation
- See Also:
EmbeddedStorageFoundationCreator
-
setBaseDirectory
The base directory of the storage in the file system. -
setBaseDirectoryInUserHome
The base directory of the storage in the file system.- Parameters:
baseDirectoryInUserHome
- relative location in the user home directory
-
getBaseDirectory
String getBaseDirectory()The base directory of the storage in the file system. -
setDeletionDirectory
The deletion directory. -
getDeletionDirectory
String getDeletionDirectory()The deletion directory. -
setTruncationDirectory
The truncation directory. -
getTruncationDirectory
String getTruncationDirectory()The truncation directory. -
setBackupDirectory
The backup directory. -
setBackupDirectoryInUserHome
The backup directory.- Parameters:
backupDirectoryInUserHome
- relative location in the user home directory
-
getBackupDirectory
String getBackupDirectory()The backup directory. -
setChannelCount
The number of threads and number of directories used by the storage engine. Every thread has exclusive access to its directory. Default is1
.- Parameters:
channelCount
- the new channel count, must be a power of 2
-
getChannelCount
int getChannelCount()The number of threads and number of directories used by the storage engine. Every thread has exclusive access to its directory. -
setChannelDirectoryPrefix
Name prefix of the subdirectories used by the channel threads. Default is"channel_"
.- Parameters:
channelDirectoryPrefix
- new prefix
-
getChannelDirectoryPrefix
String getChannelDirectoryPrefix()Name prefix of the subdirectories used by the channel threads. -
setDataFilePrefix
Name prefix of the storage files. Default is"channel_"
.- Parameters:
dataFilePrefix
- new prefix
-
getDataFilePrefix
String getDataFilePrefix()Name prefix of the storage files. -
setDataFileSuffix
Name suffix of the storage files. Default is".dat"
.- Parameters:
dataFileSuffix
- new suffix
-
getDataFileSuffix
String getDataFileSuffix()Name suffix of the storage files. -
setTransactionFilePrefix
Name prefix of the storage transaction file. Default is"transactions_"
.- Parameters:
transactionFilePrefix
- new prefix
-
getTransactionFilePrefix
String getTransactionFilePrefix()Name prefix of the storage transaction file. -
setTransactionFileSuffix
Name suffix of the storage transaction file. Default is".sft"
.- Parameters:
transactionFileSuffix
- new suffix
-
getTransactionFileSuffix
String getTransactionFileSuffix()Name suffix of the storage transaction file. -
setTypeDictionaryFilename
The name of the dictionary file. Default is"PersistenceTypeDictionary.ptd"
.- Parameters:
typeDictionaryFilename
- new name
-
getTypeDictionaryFilename
String getTypeDictionaryFilename()The name of the dictionary file. -
setHouseKeepingInterval
Deprecated.replaced bysetHousekeepingIntervalMs(long)
, will be removed in a future release -
setHousekeepingIntervalMs
Interval in milliseconds for the houskeeping. This is work like garbage collection or cache checking. In combination withsetHousekeepingTimeBudgetNs(long)
the maximum processor time for housekeeping work can be set. Default is1000
(every second).- Parameters:
houseKeepingIntervalMs
- the new interval- See Also:
setHousekeepingTimeBudgetNs(long)
-
getHouseKeepingInterval
Deprecated.replaced bygetHousekeepingIntervalMs()
, will be removed in a future release -
getHousekeepingIntervalMs
long getHousekeepingIntervalMs()Interval in milliseconds for the houskeeping. This is work like garbage collection or cache checking.- See Also:
getHousekeepingTimeBudgetNs()
-
setHouseKeepingNanoTimeBudget
Deprecated.replaced bysetHousekeepingTimeBudgetNs(long)
, will be removed in a future release -
setHousekeepingTimeBudgetNs
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 is10000000
(10 million nanoseconds = 10 milliseconds = 0.01 seconds).- Parameters:
housekeepingTimeBudgetNs
- the new time budget- See Also:
setHousekeepingIntervalMs(long)
-
getHouseKeepingNanoTimeBudget
Deprecated.replaced bygetHousekeepingTimeBudgetNs()
, will be removed in a future release -
getHousekeepingTimeBudgetNs
long getHousekeepingTimeBudgetNs()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.- See Also:
getHousekeepingIntervalMs()
-
setEntityCacheThreshold
Abstract threshold value for the lifetime of entities in the cache. SeeStorageEntityCacheEvaluator
. Default is1000000000
.- Parameters:
entityCacheThreshold
- the new threshold
-
getEntityCacheThreshold
long getEntityCacheThreshold()Abstract threshold value for the lifetime of entities in the cache. SeeStorageEntityCacheEvaluator
. -
setEntityCacheTimeout
Deprecated.replaced bysetEntityCacheTimeoutMs(long)
, will be removed in a future release -
setEntityCacheTimeoutMs
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 is86400000
(1 day).- Parameters:
entityCacheTimeoutMs
-- See Also:
Duration
-
getEntityCacheTimeout
Deprecated.replaced bygetEntityCacheTimeoutMs()
, will be removed in a future release -
getEntityCacheTimeoutMs
long getEntityCacheTimeoutMs()Timeout in milliseconds for the entity cache evaluator. If an entity wasn't accessed in this timespan it will be removed from the cache. -
setDataFileMinSize
Deprecated.replaced bysetDataFileMinimumSize(int)
, will be removed in a future release -
setDataFileMinimumSize
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- See Also:
setDataFileMinimumUseRatio(double)
-
getDataFileMinSize
Deprecated.replaced bygetDataFileMinimumSize()
, will be removed in a future release -
getDataFileMinimumSize
int getDataFileMinimumSize()Minimum file size for a data file to avoid cleaning it up.- See Also:
getDataFileMinimumUseRatio()
-
setDataFileMaxSize
Deprecated.replaced bysetDataFileMaximumSize(int)
, will be removed in a future release -
setDataFileMaximumSize
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- See Also:
setDataFileMinimumUseRatio(double)
-
getDataFileMaxSize
Deprecated.replaced bygetDataFileMaximumSize()
, will be removed in a future release -
getDataFileMaximumSize
int getDataFileMaximumSize()Maximum file size for a data file to avoid cleaning it up.- See Also:
getDataFileMinimumUseRatio()
-
setDataFileDissolveRatio
Deprecated.replaced bysetDataFileMinimumUseRatio(double)
, will be removed in a future release -
setDataFileMinimumUseRatio
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, inluding 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
-
getDataFileDissolveRatio
Deprecated.replaced bygetDataFileMinimumUseRatio()
, will be removed in a future release -
getDataFileMinimumUseRatio
double getDataFileMinimumUseRatio()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, inluding 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. -
setDataFileCleanupHeadFile
A flag defining wether the current head file (the only file actively written to) shall be subjected to file cleanups as well.- Parameters:
dataFileCleanupHeadFile
-
-
getDataFileCleanupHeadFile
boolean getDataFileCleanupHeadFile()A flag defining wether the current head file (the only file actively written to) shall be subjected to file cleanups as well. -
Default
Creates a newConfiguration
with the default settings.
-