Package one.microstream.storage.types
Class StorageConnection.Default
java.lang.Object
one.microstream.storage.types.StorageConnection.Default
- All Implemented Interfaces:
PersistenceStoring
,Persister
,Unpersistable
,ObjectSwizzling
,StorageConnection
- Enclosing interface:
- StorageConnection
public static final class StorageConnection.Default extends Object implements StorageConnection, Unpersistable
-
Nested Class Summary
Nested classes/interfaces inherited from interface one.microstream.storage.types.StorageConnection
StorageConnection.Default
-
Constructor Summary
Constructors Constructor Description Default()
-
Method Summary
Modifier and Type Method Description StorageRawFileStatistics
createStorageStatistics()
Creates aStorageRawFileStatistics
instance, (obviously) containing raw file statistics about every channel in the storage.void
exportChannels(StorageLiveFileProvider fileProvider, boolean performGarbageCollection)
Exports the data of all channels in the storage by using the passedStorageLiveFileProvider
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.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.void
importFiles(XGettingEnum<AFile> importFiles)
Imports all files specified by the passed Enum (ordered set) ofAFile
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.boolean
issueCacheCheck(long nanoTimeBudget, StorageEntityCacheEvaluator entityEvaluator)
Same asStorageConnection.issueCacheCheck(long)
, but with using the passedStorageEntityCacheEvaluator
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 passednanoTimeBudget
.
When the time budget is used up, the checking logic will keep the current progress and continue there at the next opportunity.void
issueFullBackup(StorageLiveFileProvider targetFileProvider, PersistenceTypeDictionaryExporter typeDictionaryExporter)
Issues a full backup of the whole storage to be executed.boolean
issueGarbageCollection(long nanoTimeBudget)
Issues garbage collection to be executed, limited to the time budget in nanoseconds specified by the passednanoTimeBudget
.
When the time budget is used up, the garbage collector will keep the current progress and continue there at the next opportunity.PersistenceManager<Binary>
persistenceManager()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface one.microstream.storage.types.StorageConnection
createEagerStorer, createLazyStorer, createStorer, exportChannels, exportTypes, getObject, issueCacheCheck, issueFullBackup, issueFullCacheCheck, issueFullCacheCheck, issueFullFileCheck, issueFullGarbageCollection, store, storeAll, storeAll
-
Constructor Details
-
Default
public Default()
-
-
Method Details
-
persistenceManager
- Specified by:
persistenceManager
in interfaceStorageConnection
- Returns:
- the
PersistenceManager
used by thisStorageConnection
.
-
issueGarbageCollection
public final boolean issueGarbageCollection(long nanoTimeBudget)Description copied from interface:StorageConnection
Issues garbage collection to be executed, limited to the time budget in nanoseconds specified by the passednanoTimeBudget
.
When the time budget is used up, the garbage collector will keep the current progress and continue there at the next opportunity. The same progress marker is used by the implicit housekeeping, so both mechanisms will continue on the same progress.
If no store has occured since the last completed garbage sweep, this method will have no effect and return immediately.- Specified by:
issueGarbageCollection
in interfaceStorageConnection
- Parameters:
nanoTimeBudget
- the time budget in nanoseconds to be used to perform garbage collection.- Returns:
- whether the returned call has completed garbage collection.
- See Also:
StorageConnection.issueFullGarbageCollection()
-
issueFileCheck
public final boolean issueFileCheck(long nanoTimeBudget)Description copied from interface:StorageConnection
Issues a storage file check to be executed, limited to the time budget in nanoseconds specified by the passednanoTimeBudget
.
When the time budget is used up, the checking logic will keep the current progress and continue there at the next opportunity. The same progress marker is used by the implicit housekeeping, so both mechanisms will continue on the same progress.
If no store has occured since the last completed check, this method will have no effect and return immediately.- Specified by:
issueFileCheck
in interfaceStorageConnection
- Parameters:
nanoTimeBudget
- the time budget in nanoseconds to be used to perform file checking.- Returns:
- whether the returned call has completed file checking.
-
issueCacheCheck
public final boolean issueCacheCheck(long nanoTimeBudget, StorageEntityCacheEvaluator entityEvaluator)Description copied from interface:StorageConnection
Same asStorageConnection.issueCacheCheck(long)
, but with using the passedStorageEntityCacheEvaluator
logic instead of the configured one.- Specified by:
issueCacheCheck
in interfaceStorageConnection
entityEvaluator
- the entity cache evaluation logic to be used for the call.- See Also:
StorageConnection.issueFullCacheCheck()
,StorageConnection.issueFullCacheCheck(StorageEntityCacheEvaluator)
,StorageConnection.issueCacheCheck(long)
-
issueFullBackup
public final void issueFullBackup(StorageLiveFileProvider targetFileProvider, PersistenceTypeDictionaryExporter typeDictionaryExporter)Description copied from interface:StorageConnection
Issues a full backup of the whole storage to be executed. Keep in mind that this could result in a very long running operation, depending on the storage size.
Although the full backup may be a valid solution in some circumstances, the incremental backup should be preferred, since it is by far more efficient.- Specified by:
issueFullBackup
in interfaceStorageConnection
- Parameters:
targetFileProvider
- file provider for backup files
-
createStorageStatistics
Description copied from interface:StorageConnection
Creates aStorageRawFileStatistics
instance, (obviously) containing raw file statistics about every channel in the storage.- Specified by:
createStorageStatistics
in interfaceStorageConnection
- Returns:
- a
StorageRawFileStatistics
instance based on the current state.
-
exportChannels
Description copied from interface:StorageConnection
Exports the data of all channels in the storage by using the passedStorageLiveFileProvider
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. This is useful to safely create a complete copy of the storage, e.g. a full backup.- Specified by:
exportChannels
in interfaceStorageConnection
- Parameters:
fileProvider
- theStorageLiveFileProvider
logic to be used for the export.performGarbageCollection
- whether aStorageConnection.issueFullGarbageCollection()
shall be issued before performing the export.
-
exportTypes
public StorageEntityTypeExportStatistics exportTypes(StorageEntityTypeExportFileProvider exportFileProvider, Predicate<? super StorageEntityTypeHandler> isExportType)Description copied from interface:StorageConnection
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. Converters can be used to transform the data into a different, for example human readable, form like CSV.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.
- Specified by:
exportTypes
in interfaceStorageConnection
- Parameters:
exportFileProvider
- theStorageEntityTypeExportFileProvider
logic to be used.isExportType
- aPredicate
selecting which type's entity data to be exported.- Returns:
- a
StorageEntityTypeExportStatistics
information instance about the completed export. - See Also:
StorageConnection.exportTypes(StorageEntityTypeExportFileProvider)
-
importFiles
Description copied from interface:StorageConnection
Imports all files specified by the passed Enum (ordered set) ofAFile
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. If they already exist in the storage (identified by their ObjectId), their current data will be replaced by the imported data.
Note that importing data that is not reachable from any root entity will have no effect and will eventually be deleted by the garbage collector.- Specified by:
importFiles
in interfaceStorageConnection
- Parameters:
importFiles
- the files whose native binary content shall be imported.
-