Package one.microstream.storage.types
Class StorageConnection.Default
- java.lang.Object
-
- one.microstream.storage.types.StorageConnection.Default
-
- All Implemented Interfaces:
one.microstream.persistence.types.PersistenceStoring,one.microstream.persistence.types.Persister,one.microstream.persistence.types.Unpersistable,one.microstream.reference.ObjectSwizzling,StorageConnection
- Enclosing interface:
- StorageConnection
public static final class StorageConnection.Default extends Object implements StorageConnection, one.microstream.persistence.types.Unpersistable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface one.microstream.storage.types.StorageConnection
StorageConnection.Default
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StorageRawFileStatisticscreateStorageStatistics()Creates aStorageRawFileStatisticsinstance, (obviously) containing raw file statistics about every channel in the storage.voidexportChannels(StorageLiveFileProvider fileProvider, boolean performGarbageCollection)Exports the data of all channels in the storage by using the passedStorageLiveFileProviderinstance.
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.StorageEntityTypeExportStatisticsexportTypes(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.voidimportData(one.microstream.collections.types.XGettingEnum<ByteBuffer> importData)Imports all data specified by the passed Enum (ordered set) ofByteBufferin order.
The buffers are assumed to be in the native binary format used internally by the storage.
All entities contained in the specified buffers will be imported.voidimportFiles(one.microstream.collections.types.XGettingEnum<one.microstream.afs.types.AFile> importFiles)Imports all files specified by the passed Enum (ordered set) ofAFilein 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.booleanissueCacheCheck(long nanoTimeBudget, StorageEntityCacheEvaluator entityEvaluator)Same asStorageConnection.issueCacheCheck(long), but with using the passedStorageEntityCacheEvaluatorlogic instead of the configured one.booleanissueFileCheck(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.voidissueFullBackup(StorageLiveFileProvider targetFileProvider, one.microstream.persistence.types.PersistenceTypeDictionaryExporter typeDictionaryExporter)Issues a full backup of the whole storage to be executed.booleanissueGarbageCollection(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.one.microstream.persistence.types.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, exportTypes, exportTypes, getObject, issueCacheCheck, issueFullBackup, issueFullCacheCheck, issueFullCacheCheck, issueFullFileCheck, issueFullGarbageCollection, store, storeAll, storeAll
-
-
-
-
Method Detail
-
persistenceManager
public one.microstream.persistence.types.PersistenceManager<Binary> persistenceManager()
- Specified by:
persistenceManagerin interfaceStorageConnection- Returns:
- the
PersistenceManagerused by thisStorageConnection.
-
issueGarbageCollection
public final boolean issueGarbageCollection(long nanoTimeBudget)
Description copied from interface:StorageConnectionIssues 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 occurred since the last completed garbage sweep, this method will have no effect and return immediately.- Specified by:
issueGarbageCollectionin 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:StorageConnectionIssues 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 occurred since the last completed check, this method will have no effect and return immediately.- Specified by:
issueFileCheckin 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:StorageConnectionSame asStorageConnection.issueCacheCheck(long), but with using the passedStorageEntityCacheEvaluatorlogic instead of the configured one.- Specified by:
issueCacheCheckin interfaceStorageConnection- Parameters:
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.- Returns:
- whether the used cache size is 0 or became 0 via the performed check.
- See Also:
StorageConnection.issueFullCacheCheck(),StorageConnection.issueFullCacheCheck(StorageEntityCacheEvaluator),StorageConnection.issueCacheCheck(long)
-
issueFullBackup
public final void issueFullBackup(StorageLiveFileProvider targetFileProvider, one.microstream.persistence.types.PersistenceTypeDictionaryExporter typeDictionaryExporter)
Description copied from interface:StorageConnectionIssues 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:
issueFullBackupin interfaceStorageConnection- Parameters:
targetFileProvider- file provider for backup filestypeDictionaryExporter- custom type dictionary exporter
-
createStorageStatistics
public StorageRawFileStatistics createStorageStatistics()
Description copied from interface:StorageConnectionCreates aStorageRawFileStatisticsinstance, (obviously) containing raw file statistics about every channel in the storage.- Specified by:
createStorageStatisticsin interfaceStorageConnection- Returns:
- a
StorageRawFileStatisticsinstance based on the current state.
-
exportChannels
public void exportChannels(StorageLiveFileProvider fileProvider, boolean performGarbageCollection)
Description copied from interface:StorageConnectionExports the data of all channels in the storage by using the passedStorageLiveFileProviderinstance.
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:
exportChannelsin interfaceStorageConnection- Parameters:
fileProvider- theStorageLiveFileProviderlogic 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:StorageConnectionExports 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:
exportTypesin interfaceStorageConnection- Parameters:
exportFileProvider- theStorageEntityTypeExportFileProviderlogic to be used.isExportType- aPredicateselecting which type's entity data to be exported.- Returns:
- a
StorageEntityTypeExportStatisticsinformation instance about the completed export. - See Also:
StorageConnection.exportTypes(StorageEntityTypeExportFileProvider)
-
importFiles
public void importFiles(one.microstream.collections.types.XGettingEnum<one.microstream.afs.types.AFile> importFiles)
Description copied from interface:StorageConnectionImports all files specified by the passed Enum (ordered set) ofAFilein 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:
importFilesin interfaceStorageConnection- Parameters:
importFiles- the files whose native binary content shall be imported.
-
importData
public void importData(one.microstream.collections.types.XGettingEnum<ByteBuffer> importData)
Description copied from interface:StorageConnectionImports all data specified by the passed Enum (ordered set) ofByteBufferin order.
The buffers are assumed to be in the native binary format used internally by the storage.
All entities contained in the specified buffers 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:
importDatain interfaceStorageConnection- Parameters:
importData- the files whose native binary content shall be imported.
-
-