Class Storage
public final class Storage extends Object
To setup and start a database, see the class "EmbeddedStorage".
- See Also:
Persistence
,StorageChannel
-
Method Summary
-
Method Details
-
DefaultFileSystem
-
defaultStorageDirectory
-
defaultStorageDirectory
Returns the default storage directory in the current working directory and with a filename defined byStorageLiveFileProvider.Defaults.defaultStorageDirectory()
.- Parameters:
fileSystem
- the file system to use- Returns:
- the default storage directory located in the current working directory.
-
FileProvider
Creates a newStorageLiveFileProvider
.For a detailed explanation see
StorageLiveFileProvider.New()
.- Returns:
- a new
StorageLiveFileProvider
instance. - See Also:
FileProvider(Path)
,StorageLiveFileProvider.New()
,StorageLiveFileProvider.Builder
,StorageLiveFileProvider.Defaults
-
FileProvider
Creates a newStorageLiveFileProvider
.For a detailed explanation see
StorageLiveFileProvider.New(ADirectory)
.- Parameters:
storageDirectory
- the directory where the storage will be located.- Returns:
- a new
StorageLiveFileProvider
instance. - See Also:
FileProvider()
,StorageLiveFileProvider.New(ADirectory)
,StorageLiveFileProvider.Builder
,StorageLiveFileProvider.Defaults
-
FileProvider
-
FileProviderBuilder
Creates a newStorageLiveFileProvider.Builder
.For a detailed explanation see
StorageLiveFileProvider.Builder()
.- Returns:
- a new
StorageLiveFileProvider.Builder
instance. - See Also:
FileProvider()
,FileProvider(Path)
,StorageLiveFileProvider.Builder
-
FileProviderBuilder
Creates a newStorageLiveFileProvider.Builder
.For a detailed explanation see
StorageLiveFileProvider.Builder(AFileSystem)
.- Parameters:
fileSystem
- the file system to use- Returns:
- a new
StorageLiveFileProvider.Builder
instance. - See Also:
FileProvider()
,FileProvider(Path)
,StorageLiveFileProvider.Builder
-
BackupFileProvider
-
BackupFileProvider
@Deprecated public static final StorageBackupFileProvider BackupFileProvider(File storageDirectory)Deprecated. -
BackupFileProvider
-
BackupFileProvider
-
BackupFileProviderBuilder
-
BackupFileProviderBuilder
public static final StorageBackupFileProvider.Builder<?> BackupFileProviderBuilder(AFileSystem fileSystem) -
Configuration
Creates a newStorageConfiguration
.For a detailed explanation see
StorageConfiguration.New()
.- Returns:
- a new
StorageConfiguration
instance. - See Also:
Configuration(StorageLiveFileProvider)
,StorageConfiguration.New()
,StorageConfiguration.Builder
-
Configuration
Creates a newStorageConfiguration
.For a detailed explanation see
StorageConfiguration.New(StorageLiveFileProvider)
.- Parameters:
fileProvider
- theStorageLiveFileProvider
to provide directory and file names.- Returns:
- a new
StorageConfiguration
instance. - See Also:
Configuration()
,StorageConfiguration.New(StorageLiveFileProvider)
,StorageConfiguration.Builder
-
ConfigurationBuilder
Creates a newStorageConfiguration.Builder
.For a detailed explanation see
StorageConfiguration.Builder()
.- Returns:
- a new
StorageConfiguration.Builder
instance. - See Also:
Configuration()
,Configuration(StorageLiveFileProvider)
,StorageConfiguration.Builder()
,StorageConfiguration.Builder
-
HousekeepingController
Creates a newStorageHousekeepingController
.For a detailed explanation see
StorageHousekeepingController.New()
.- Returns:
- a new
StorageHousekeepingController
instance. - See Also:
HousekeepingController(long, long)
,StorageHousekeepingController.New()
,StorageHousekeepingController.Defaults
-
HousekeepingController
public static final StorageHousekeepingController HousekeepingController(long housekeepingIntervalMs, long housekeepingTimeBudgetNs)Creates a newStorageHousekeepingController
.For a detailed explanation see
StorageHousekeepingController.New(long, long)
.- Parameters:
housekeepingIntervalMs
- the interval in milliseconds that the storage threads shall execute their various housekeeping actions (like cache clearing checks, file consolidation, etc.). Must be greater than zero.housekeepingTimeBudgetNs
- the time budget in nanoseconds that each storage thread will use to perform a housekeeping action. This is a best effort value, not a strictly reliable border value. This means a housekeeping action can occasionally take slightly longer than specified here. Must be greater than zero.- Returns:
- a new
StorageHousekeepingController
instance. - See Also:
HousekeepingController()
,StorageHousekeepingController.New(long, long)
-
EntityCacheEvaluator
Creates a newStorageEntityCacheEvaluator
.For a detailed explanation see
StorageEntityCacheEvaluator.New()
.- Returns:
- a new
StorageEntityCacheEvaluator
instance. - See Also:
EntityCacheEvaluator(long)
,EntityCacheEvaluator(long, long)
,StorageEntityCacheEvaluator.New()
-
EntityCacheEvaluator
Creates a newStorageEntityCacheEvaluator
.For a detailed explanation see
StorageEntityCacheEvaluator.New(long)
.- Parameters:
timeoutMs
- the time (in milliseconds, greater than 0) of not being read (the "age"), after which a particular entity's data will be cleared from the Storage's internal cache.- Returns:
- a new
StorageEntityCacheEvaluator
instance. - Throws:
NumberRangeException
- if the passed value is equal to or lower than 0.- See Also:
EntityCacheEvaluator()
,EntityCacheEvaluator(long, long)
,StorageEntityCacheEvaluator.New(long)
-
EntityCacheEvaluator
public static final StorageEntityCacheEvaluator EntityCacheEvaluator(long timeoutMs, long threshold)Creates a newStorageEntityCacheEvaluator
.For a detailed explanation see
StorageEntityCacheEvaluator.New(long, long)
.- Parameters:
timeoutMs
- the time (in milliseconds, greater than 0) of not being read (the "age"), after which a particular entity's data will be cleared from the Storage's internal cache.threshold
- an abstract value (greater than 0) to evaluate the product of size and age of an entity in relation to the current cache size in order to determine if the entity's data shall be cleared from the cache.- Returns:
- a new
StorageEntityCacheEvaluator
instance. - Throws:
NumberRangeException
- if any of the passed values is equal to or lower than 0.- See Also:
EntityCacheEvaluator()
,EntityCacheEvaluator(long)
,StorageEntityCacheEvaluator.New(long, long)
-
ChannelCountProvider
Creates a newStorageChannelCountProvider
.For a detailed explanation see
StorageChannelCountProvider.New()
.- Returns:
- a new
StorageChannelCountProvider
instance. - See Also:
ChannelCountProvider(int)
,StorageChannelCountProvider.New()
-
ChannelCountProvider
Creates a newStorageChannelCountProvider
.For a detailed explanation see
StorageChannelCountProvider.New(int)
.- Parameters:
channelCount
- the number of channels. Must be a 2^n number with n greater than or equal 0.- Returns:
- a new
StorageChannelCountProvider
instance. - Throws:
IllegalArgumentException
- if the passed value is higher than the value returned byStorageChannelCountProvider.Validation.maximumChannelCount()
-
DataFileEvaluator
Creates a newStorageDataFileEvaluator
.For a detailed explanation see
StorageDataFileEvaluator.New()
.- Returns:
- a new
StorageDataFileEvaluator
instance. - See Also:
DataFileEvaluator(int, int)
,DataFileEvaluator(int, int, double)
,StorageDataFileEvaluator.New()
-
DataFileEvaluator
public static final StorageDataFileEvaluator DataFileEvaluator(int fileMinimumSize, int fileMaximumSize)Creates a newStorageDataFileEvaluator
.For a detailed explanation see
StorageDataFileEvaluator.New(int, int)
.- Parameters:
fileMinimumSize
- the minimum file size in bytes that a single storage file must have. Smaller files will be dissolved.fileMaximumSize
- the maximum file size in bytes that a single storage file may have. Larger files will be dissolved.
Note that a file can exceed this limit if it contains a single entity that already exceeds the limit. E.g. an int array with 10 million elements would be about 40 MB in size and would exceed a file size limit of, for example, 30 MB.- Returns:
- a new
StorageDataFileEvaluator
instance. - See Also:
DataFileEvaluator()
,DataFileEvaluator(int, int, double)
,StorageDataFileEvaluator.New(int, int)
-
DataFileEvaluator
public static final StorageDataFileEvaluator DataFileEvaluator(int fileMinimumSize, int fileMaximumSize, double minimumUseRatio)Creates a newStorageDataFileEvaluator
.For a detailed explanation see
StorageDataFileEvaluator.New(int, int, double)
.- Parameters:
fileMinimumSize
- the minimum file size in bytes that a single storage file must have. Smaller files will be dissolved.fileMaximumSize
- the maximum file size in bytes that a single storage file may have. Larger files will be dissolved.
Note that a file can exceed this limit if it contains a single entity that already exceeds the limit. E.g. an int array with 10 million elements would be about 40 MB in size and would exceed a file size limit of, for example, 30 MB.minimumUseRatio
- 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.- Returns:
- a new
StorageDataFileEvaluator
instance. - See Also:
DataFileEvaluator()
,DataFileEvaluator(int, int)
,StorageDataFileEvaluator.New(int, int, double)
-
DataFileEvaluator
public static final StorageDataFileEvaluator DataFileEvaluator(int fileMinimumSize, int fileMaximumSize, double minimumUseRatio, boolean cleanUpHeadFile)Creates a newStorageDataFileEvaluator
.For a detailed explanation see
StorageDataFileEvaluator.New(int, int, double, boolean)
.- Parameters:
fileMinimumSize
- the minimum file size in bytes that a single storage file must have. Smaller files will be dissolved.fileMaximumSize
- the maximum file size in bytes that a single storage file may have. Larger files will be dissolved.
Note that a file can exceed this limit if it contains a single entity that already exceeds the limit. E.g. an int array with 10 million elements would be about 40 MB in size and would exceed a file size limit of, for example, 30 MB.minimumUseRatio
- 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.cleanUpHeadFile
- a flag defining wether the current head file (the only file actively written to) shall be subjected to file cleanups as well.- Returns:
- a new
StorageDataFileEvaluator
instance. - See Also:
DataFileEvaluator()
,DataFileEvaluator(int, int)
,DataFileEvaluator(int, int, double)
,StorageDataFileEvaluator.New(int, int, double, boolean)
-
BackupSetup
Creates a newStorageBackupSetup
.For a detailed explanation see
StorageBackupSetup.New(ADirectory)
.- Parameters:
backupDirectory
- the directory where the backup shall be located.- Returns:
- a new
StorageBackupSetup
instance. - See Also:
StorageBackupSetup.New(StorageBackupFileProvider)
,StorageBackupHandler
-
BackupSetup
Creates a newStorageBackupSetup
.For a detailed explanation see
StorageBackupSetup.New(ADirectory)
.- Parameters:
backupDirectory
- the directory where the backup shall be located.- Returns:
- a new
StorageBackupSetup
instance. - See Also:
StorageBackupSetup.New(ADirectory)
,StorageBackupHandler
-
BackupSetup
Creates a newStorageBackupSetup
.For a detailed explanation see
StorageBackupSetup.New(ADirectory)
.- Parameters:
backupDirectoryPath
- the directory where the backup shall be located.- Returns:
- a new
StorageBackupSetup
instance. - See Also:
StorageBackupSetup.New(ADirectory)
,StorageBackupSetup.New(StorageBackupFileProvider)
,StorageBackupHandler
-
BackupSetup
Creates a newStorageBackupSetup
.For a detailed explanation see
StorageBackupSetup.New(StorageBackupFileProvider)
.- Parameters:
backupFileProvider
- theStorageBackupFileProvider
to define where the backup files will be located.- Returns:
- a new
StorageBackupSetup
instance. - See Also:
StorageBackupSetup.New(StorageBackupFileProvider)
,StorageBackupHandler
-
LockFileSetupProvider
Creates a newStorageLockFileSetup.Provider
.For a detailed explanation see
StorageLockFileSetup.Provider()
.- Returns:
- a new
StorageLockFileSetup.Provider
instance. - See Also:
StorageLockFileSetup
,LockFileSetupProvider(Charset)
,LockFileSetupProvider(long)
,LockFileSetupProvider(Charset, long)
-
LockFileSetupProvider
Creates a newStorageLockFileSetup.Provider
.For a detailed explanation see
StorageLockFileSetup.Provider(Charset)
.- Parameters:
charset
- theCharset
to be used for the lock file content.- Returns:
- a new
StorageLockFileSetup.Provider
instance. - See Also:
StorageLockFileSetup
,LockFileSetupProvider()
,LockFileSetupProvider(long)
,LockFileSetupProvider(Charset, long)
-
LockFileSetupProvider
Creates a newStorageLockFileSetup.Provider
.For a detailed explanation see
StorageLockFileSetup.Provider(long)
.- Parameters:
updateInterval
- the update interval in ms.- Returns:
- a new
StorageLockFileSetup.Provider
instance. - See Also:
StorageLockFileSetup
,LockFileSetupProvider()
,LockFileSetupProvider(Charset)
,LockFileSetupProvider(Charset, long)
-
LockFileSetupProvider
public static StorageLockFileSetup.Provider LockFileSetupProvider(Charset charset, long updateInterval)Creates a newStorageLockFileSetup.Provider
.For a detailed explanation see
StorageLockFileSetup.Provider(Charset, long)
.- Parameters:
charset
- theCharset
to be used for the lock file content.updateInterval
- the update interval in ms.- Returns:
- a new
StorageLockFileSetup.Provider
instance. - See Also:
StorageLockFileSetup
,LockFileSetupProvider()
,LockFileSetupProvider(Charset)
,LockFileSetupProvider(long)
-
consolidate
public static final <C extends StorageConnection> C consolidate(C storageConnection, StorageEntityCacheEvaluator entityEvaluator)Consolidates the storage system represented by the passedStorageConnection
by calling
StorageConnection.issueFullGarbageCollection()
StorageConnection.issueFullFileCheck()
StorageConnection.issueFullCacheCheck(StorageEntityCacheEvaluator)
in that order.Depending on the passed functions, this call can do anything from cleaning/optimizing the storage a little to fully reorganize/optimize the storage files, clear the complete cache and making the storage virtually dormant until the next store.
- Type Parameters:
C
- the storage connection type- Parameters:
storageConnection
- The connection to the storage that shall be consolidated.entityEvaluator
- The function evaluating whether to clear an entity from the cache.
May be null to indicate the use of the live configuration as a default.- Returns:
- the passed storageConnection instance.
-
consolidate
Callsconsolidate(StorageConnection, StorageEntityCacheEvaluator)
with null as additional parameters (causing live configuration to be used instead).- Type Parameters:
C
- the storage connection type- Parameters:
storageConnection
- The connection to the storage that shall be consolidated.- Returns:
- the passed storageConnection instance.
-