public interface StorageConnection
extends one.microstream.persistence.types.Persister
PersistenceManager instance, potentially exclusively created).
Note that this is a rather "internal" type that users usually do not have to use or care about.
Since StorageManager implements this interface, is is normally sufficient to use just that.
| Modifier and Type | Interface and Description |
|---|---|
static class |
StorageConnection.Default |
| Modifier and Type | Method and Description |
|---|---|
default one.microstream.persistence.types.Storer |
createEagerStorer() |
default one.microstream.persistence.types.Storer |
createLazyStorer() |
StorageRawFileStatistics |
createStorageStatistics()
Creates a
StorageRawFileStatistics instance, (obviously) containing raw file statistics about
every channel in the storage. |
default one.microstream.persistence.types.Storer |
createStorer() |
default void |
exportChannels(StorageLiveFileProvider fileProvider)
Alias for
this.exportChannels(fileHandler, true);. |
void |
exportChannels(StorageLiveFileProvider fileProvider,
boolean performGarbageCollection)
Exports the data of all channels in the storage by using the passed
StorageLiveFileProvider instance.This is basically a simple file copy applied to all files in the storage, however with the guaranteed safety of no other task / access to the storage's files intervening with the ongoing process. |
default StorageEntityTypeExportStatistics |
exportTypes(StorageEntityTypeExportFileProvider exportFileProvider)
Alias for
this.exportTypes(exportFileProvider, null);, meaning all types are exported. |
StorageEntityTypeExportStatistics |
exportTypes(StorageEntityTypeExportFileProvider exportFileProvider,
Predicate<? super StorageEntityTypeHandler> isExportType)
Exports the entity data of all selected types of all channels into one file per type.
The data will be in the native binary format used internally by the storage. |
default Object |
getObject(long objectId) |
void |
importFiles(one.microstream.collections.types.XGettingEnum<one.microstream.afs.types.AFile> importFiles)
Imports all files specified by the passed Enum (ordered set) of
AFile in order.The files are assumed to be in the native binary format used internally by the storage. All entities contained in the specified files will be imported. |
default boolean |
issueCacheCheck(long nanoTimeBudget)
Issues a storage cache check to be executed, limited to the time budget in nanoseconds specified
by the passed
nanoTimeBudget.When the time budget is used up, the checking logic will keep the current progress and continue there at the next opportunity. |
boolean |
issueCacheCheck(long nanoTimeBudget,
StorageEntityCacheEvaluator entityEvaluator)
Same as
issueCacheCheck(long), but with using the passed StorageEntityCacheEvaluator
logic instead of the configured one. |
boolean |
issueFileCheck(long nanoTimeBudget)
Issues a storage file check to be executed, limited to the time budget in nanoseconds specified
by the passed
nanoTimeBudget.When the time budget is used up, the checking logic will keep the current progress and continue there at the next opportunity. |
default void |
issueFullBackup(one.microstream.afs.types.ADirectory targetDirectory)
Issues a full backup of the whole storage to be executed.
|
void |
issueFullBackup(StorageLiveFileProvider targetFileProvider,
one.microstream.persistence.types.PersistenceTypeDictionaryExporter typeDictionaryExporter)
Issues a full backup of the whole storage to be executed.
|
default void |
issueFullCacheCheck()
Issues a full storage cache check to be executed.
|
default void |
issueFullCacheCheck(StorageEntityCacheEvaluator entityEvaluator)
Same as
issueFullCacheCheck(), but with using the passed StorageEntityCacheEvaluator
logic instead of the configured one. |
default void |
issueFullFileCheck()
Issues a full storage file check to be executed.
|
default void |
issueFullGarbageCollection()
Issues a full garbage collection to be executed.
|
boolean |
issueGarbageCollection(long nanoTimeBudget)
Issues garbage collection to be executed, limited to the time budget in nanoseconds specified
by the passed
nanoTimeBudget.When the time budget is used up, the garbage collector will keep the current progress and continue there at the next opportunity. |
static StorageConnection |
New(one.microstream.persistence.types.PersistenceManager<Binary> persistenceManager,
StorageRequestAcceptor connectionRequestAcceptor) |
one.microstream.persistence.types.PersistenceManager<Binary> |
persistenceManager() |
default long |
store(Object instance) |
default void |
storeAll(Iterable<?> instances) |
default long[] |
storeAll(Object... instances) |
default void issueFullGarbageCollection()
Garbage collection marks all persisted objects/records that are reachable from the root (mark phase) and once that is completed, all non-marked records are determined to be effectively unreachable and are thus deleted. This common mechanism in graph-organised data completely removes the need for any explicit deleting.
Note that the garbage collection on the storage level has nothing to do with the JVM's Garbage Collector on the heap level. While the technical principle is the same, both GCs are separate from each other and do not have anything to do with each other.
issueGarbageCollection(long)boolean issueGarbageCollection(long nanoTimeBudget)
nanoTimeBudget.nanoTimeBudget - the time budget in nanoseconds to be used to perform garbage collection.issueFullGarbageCollection()default void issueFullFileCheck()
File checking evaluates every storage data file about being either too small, too big or having too many logical "gaps" in it (created by storing newer versions of an object or by garbage collection). If one of those checks applies, the remaining live data in the file is moved to the current head file and once that is done, the source file (now consisting of 100% logical "gaps", making it effectively superfluous) is then deleted.
The exact logic is defined by StorageConfiguration.dataFileEvaluator()
issueFileCheck(long)boolean issueFileCheck(long nanoTimeBudget)
nanoTimeBudget.nanoTimeBudget - the time budget in nanoseconds to be used to perform file checking.default void issueFullCacheCheck()
Cache checking evaluates every cache entity data about being worth to be kept in cache according to
the configured StorageEntityCacheEvaluator logic. If deemed unworthy, its data will be cleared
from the cache and has to be loaded from the persistent form on the next reading access.
The check will run until the used cache size is 0 or every entity is checked at least once.
default void issueFullCacheCheck(StorageEntityCacheEvaluator entityEvaluator)
issueFullCacheCheck(), but with using the passed StorageEntityCacheEvaluator
logic instead of the configured one.entityEvaluator - the entity cache evaluation logic to be used for the call.issueFullCacheCheck(),
issueCacheCheck(long),
issueCacheCheck(long, StorageEntityCacheEvaluator)default boolean issueCacheCheck(long nanoTimeBudget)
nanoTimeBudget.nanoTimeBudget - the time budget in nanoseconds to be used to perform cache checking.issueFullCacheCheck(),
issueFullCacheCheck(StorageEntityCacheEvaluator),
issueCacheCheck(long, StorageEntityCacheEvaluator)boolean issueCacheCheck(long nanoTimeBudget,
StorageEntityCacheEvaluator entityEvaluator)
issueCacheCheck(long), but with using the passed StorageEntityCacheEvaluator
logic instead of the configured one.nanoTimeBudget - the time budget in nanoseconds to be used to perform cache checking.entityEvaluator - the entity cache evaluation logic to be used for the call.issueFullCacheCheck(),
issueFullCacheCheck(StorageEntityCacheEvaluator),
issueCacheCheck(long)default void issueFullBackup(one.microstream.afs.types.ADirectory targetDirectory)
StorageExceptionBackupFullBackupTargetNotEmpty exception
will be throwntargetDirectory - the directory to write the backup data intovoid issueFullBackup(StorageLiveFileProvider targetFileProvider, one.microstream.persistence.types.PersistenceTypeDictionaryExporter typeDictionaryExporter)
targetFileProvider - file provider for backup filestypeDictionaryExporter - custom type dictionary exporterStorageRawFileStatistics createStorageStatistics()
StorageRawFileStatistics instance, (obviously) containing raw file statistics about
every channel in the storage.StorageRawFileStatistics instance based on the current state.void exportChannels(StorageLiveFileProvider fileProvider, boolean performGarbageCollection)
StorageLiveFileProvider instance.fileProvider - the StorageLiveFileProvider logic to be used for the export.performGarbageCollection - whether a issueFullGarbageCollection() shall be issued before
performing the export.default void exportChannels(StorageLiveFileProvider fileProvider)
this.exportChannels(fileHandler, true);.fileProvider - the StorageLiveFileProvider logic to be used for the export.exportChannels(StorageLiveFileProvider, boolean)StorageEntityTypeExportStatistics exportTypes(StorageEntityTypeExportFileProvider exportFileProvider, Predicate<? super StorageEntityTypeHandler> isExportType)
This is useful to extract the data contained in the storage in a structured way, for example to migrate it into another storage system or to analyze it, like converting it into human readable form.
exportFileProvider - the StorageEntityTypeExportFileProvider logic to be used.isExportType - a Predicate selecting which type's entity data to be exported.StorageEntityTypeExportStatistics information instance about the completed export.exportTypes(StorageEntityTypeExportFileProvider)default StorageEntityTypeExportStatistics exportTypes(StorageEntityTypeExportFileProvider exportFileProvider)
this.exportTypes(exportFileProvider, null);, meaning all types are exported.exportFileProvider - the StorageEntityTypeExportFileProvider logic to be used.StorageEntityTypeExportStatistics information instance about the completed export.exportTypes(StorageEntityTypeExportFileProvider, Predicate)void importFiles(one.microstream.collections.types.XGettingEnum<one.microstream.afs.types.AFile> importFiles)
AFile in order.importFiles - the files whose native binary content shall be imported.one.microstream.persistence.types.PersistenceManager<Binary> persistenceManager()
PersistenceManager used by this StorageConnection.default long store(Object instance)
store in interface one.microstream.persistence.types.PersistenceStoringstore in interface one.microstream.persistence.types.Persisterdefault long[] storeAll(Object... instances)
storeAll in interface one.microstream.persistence.types.PersistenceStoringstoreAll in interface one.microstream.persistence.types.Persisterdefault void storeAll(Iterable<?> instances)
storeAll in interface one.microstream.persistence.types.PersistenceStoringstoreAll in interface one.microstream.persistence.types.Persisterdefault one.microstream.persistence.types.Storer createLazyStorer()
createLazyStorer in interface one.microstream.persistence.types.Persisterdefault one.microstream.persistence.types.Storer createStorer()
createStorer in interface one.microstream.persistence.types.Persisterdefault one.microstream.persistence.types.Storer createEagerStorer()
createEagerStorer in interface one.microstream.persistence.types.Persisterdefault Object getObject(long objectId)
getObject in interface one.microstream.reference.ObjectSwizzlinggetObject in interface one.microstream.persistence.types.Persisterstatic StorageConnection New(one.microstream.persistence.types.PersistenceManager<Binary> persistenceManager, StorageRequestAcceptor connectionRequestAcceptor)
Copyright © 2022 MicroStream Software. All rights reserved.