Class EmbeddedStorageManager.Default
- All Implemented Interfaces:
- AutoCloseable,- PersistenceStoring,- Persister,- Unpersistable,- LazyReferenceManager.Controller,- ObjectSwizzling,- DatabasePart,- EmbeddedStorageManager,- StorageActivePart,- StorageConnection,- StorageController,- StorageManager
- Enclosing interface:
- EmbeddedStorageManager
public static final class EmbeddedStorageManager.Default extends Object implements EmbeddedStorageManager, Unpersistable, LazyReferenceManager.Controller
- 
Nested Class SummaryNested classes/interfaces inherited from interface one.microstream.storage.types.EmbeddedStorageManagerEmbeddedStorageManager.Default
- 
Constructor SummaryConstructors Constructor Description Default()
- 
Method SummaryModifier and Type Method Description voidcheckAcceptingTasks()StorageConfigurationconfiguration()Returns theStorageConfigurationused to initialize thisStorageManagerinstance.StorageConnectioncreateConnection()Creates a newStorageConnectioninstance.StorageRawFileStatisticscreateStorageStatistics()Creates aStorageRawFileStatisticsinstance, (obviously) containing raw file statistics about every channel in the storage.StorercreateStorer()Creates a newStorerinstance with default storing behavior.Databasedatabase()Returns theDatabaseinstance thisStorageManageris associated with.Reference<Object>defaultRoot()Deprecated.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.voidimportFiles(XGettingEnum<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.longinitializationTime()booleanisAcceptingTasks()booleanisActive()Queries whether the part is actually active right now.booleanisRunning()booleanisShuttingDown()booleanisStartingUp()booleanissueCacheCheck(long nanoTimeBudget)Issues a storage cache 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.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, PersistenceTypeDictionaryExporter typeDictionaryExporter)Issues a full backup of the whole storage to be executed.voidissueFullCacheCheck()Issues a full storage cache check to be executed.voidissueFullCacheCheck(StorageEntityCacheEvaluator entityEvaluator)Same asStorageConnection.issueFullCacheCheck(), but with using the passedStorageEntityCacheEvaluatorlogic instead of the configured one.voidissueFullFileCheck()Issues a full storage file check to be executed.voidissueFullGarbageCollection()Issues a full garbage collection 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.booleanmayRun()longoperationModeTime()PersistenceManager<Binary>persistenceManager()Objectroot()Return the persistent object graph's root object, without specific typing.ObjectsetRoot(Object newRoot)Sets the passed instance as the new root for the persistent object graph.
 Note that this will replace the old root instance, potentially resulting in wiping the whole database.booleanshutdown()Issues a command to shut down all active threads managing the storage.EmbeddedStorageManager.Defaultstart()"Starts" the storage controlled by thisStorageControllerinstance, with "starting" meaning:
 Reading, indexing and potentially caching all the persisted data in the storage. Starting storage managing threads to execute requests like storing, loading and issued utility functions.longstoreRoot()Stores the registered root instance (as returned byStorageManager.root()) by using the default storing logic by callingStorageConnection.createStorer()to create theStorerto be used.
 Depending on the storer logic, storing the root instance can cause many other object to be stored, as well.StorageTypeDictionarytypeDictionary()Returns theStorageTypeDictionarythat contains a completely list of types currently known to / handled by the storage represented by thisStorageManagerinstance.PersistenceRootsViewviewRoots()Returns a read-only view on all technical root instance registered in thisStorageManagerinstance.
 See the description inPersistenceRootsViewfor details.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface one.microstream.storage.types.StorageConnectioncreateEagerStorer, createLazyStorer, exportChannels, exportTypes, getObject, issueFullBackup, store, storeAll, storeAllMethods inherited from interface one.microstream.storage.types.StorageControllerclose, initializationDuration, isShutdownMethods inherited from interface one.microstream.storage.types.StorageManagercustomRoot, databaseName, storeDefaultRoot
- 
Constructor Details- 
Defaultpublic Default()
 
- 
- 
Method Details- 
databaseDescription copied from interface:StorageManagerReturns theDatabaseinstance thisStorageManageris associated with. See its description for details.- Specified by:
- databasein interface- StorageManager
- Returns:
- the associated Databaseinstance.
 
- 
rootDescription copied from interface:StorageManagerReturn the persistent object graph's root object, without specific typing.If a specifically typed root instance reference is desired, it is preferable to hold a properly typed constant reference to it and let the storage initialization use that instance as the root. 
 See the following code snippet on how to do that:static final MyAppRoot ROOT = new MyAppRoot(); static final StorageManager STORAGE = EmbeddedStorage.start(ROOT);- Specified by:
- rootin interface- StorageManager
- Returns:
- the persistent object graph's root object.
 
- 
setRootDescription copied from interface:StorageManagerSets the passed instance as the new root for the persistent object graph.
 Note that this will replace the old root instance, potentially resulting in wiping the whole database.- Specified by:
- setRootin interface- StorageManager
- Parameters:
- newRoot- the new root instance to be set.
- Returns:
- the passed newRoot to allow fluent usage of this method.
 
- 
storeRootpublic long storeRoot()Description copied from interface:StorageManagerStores the registered root instance (as returned byStorageManager.root()) by using the default storing logic by callingStorageConnection.createStorer()to create theStorerto be used.
 Depending on the storer logic, storing the root instance can cause many other object to be stored, as well. For example for the default behavior (as implemented inStorageConnection.createLazyStorer(), all recursively referenced instances that are not yet known to the persistent context (i.e. have an associated objectId registered in the context'sPersistenceObjectRegistry) are stored as well.- Specified by:
- storeRootin interface- StorageManager
- Returns:
- the root instance's objectId.
 
- 
viewRootsDescription copied from interface:StorageManagerReturns a read-only view on all technical root instance registered in thisStorageManagerinstance.
 See the description inPersistenceRootsViewfor details.- Specified by:
- viewRootsin interface- StorageManager
- Returns:
- a new PersistenceRootsViewinstance allowing to iterate all technical root instances.
 
- 
persistenceManager- Specified by:
- persistenceManagerin interface- StorageConnection
- Returns:
- the PersistenceManagerused by thisStorageConnection.
 
- 
createStorerDescription copied from interface:StorageConnectionCreates a newStorerinstance with default storing behavior. The default is lazy storing. SeePersister.createLazyStorer().- Specified by:
- createStorerin interface- Persister
- Specified by:
- createStorerin interface- StorageConnection
- Returns:
- the newly created Storerinstance.
 
- 
mayRunpublic boolean mayRun()- Specified by:
- mayRunin interface- LazyReferenceManager.Controller
 
- 
startDescription copied from interface:StorageManager"Starts" the storage controlled by thisStorageControllerinstance, with "starting" meaning:
 - Reading, indexing and potentially caching all the persisted data in the storage.
- Starting storage managing threads to execute requests like storing, loading and issued utility functions.
 - Specified by:
- startin interface- EmbeddedStorageManager
- Specified by:
- startin interface- StorageController
- Specified by:
- startin interface- StorageManager
- Returns:
- this to allow writing of fluent code.
 
- 
shutdownpublic final boolean shutdown()Description copied from interface:StorageManagerIssues a command to shut down all active threads managing the storage.- Specified by:
- shutdownin interface- StorageController
- Specified by:
- shutdownin interface- StorageManager
- Returns:
- trueafter a successful shutdown or- falseif an internal- InterruptedExceptionhappened.
 
- 
isAcceptingTaskspublic final boolean isAcceptingTasks()- Specified by:
- isAcceptingTasksin interface- StorageController
 
- 
isRunningpublic final boolean isRunning()- Specified by:
- isRunningin interface- StorageController
 
- 
isActivepublic final boolean isActive()Description copied from interface:StorageActivePartQueries whether the part is actually active right now. This might returntrueeven despite some "running" flag being set tofalsebecause there might be one last loop cycle execution before checking the "running" flag again.- Specified by:
- isActivein interface- StorageActivePart
- Returns:
- if the part is actually active right now.
 
- 
isStartingUppublic final boolean isStartingUp()- Specified by:
- isStartingUpin interface- StorageController
 
- 
isShuttingDownpublic final boolean isShuttingDown()- Specified by:
- isShuttingDownin interface- StorageController
 
- 
checkAcceptingTaskspublic final void checkAcceptingTasks()- Specified by:
- checkAcceptingTasksin interface- StorageController
 
- 
configurationDescription copied from interface:StorageManagerReturns theStorageConfigurationused to initialize thisStorageManagerinstance.- Specified by:
- configurationin interface- StorageManager
- Returns:
- the used configuration.
 
- 
typeDictionaryDescription copied from interface:StorageManagerReturns theStorageTypeDictionarythat contains a completely list of types currently known to / handled by the storage represented by thisStorageManagerinstance. This list grows dynamically as so far unknown types are discovered, analyzed, mapped and added on the fly by a store.- Specified by:
- typeDictionaryin interface- StorageManager
- Returns:
- thr current StorageTypeDictionary.
 
- 
createConnectionDescription copied from interface:StorageManagerCreates a newStorageConnectioninstance. See the type description for details.
 Not that while it makes sense on an architectural level to have a connecting mechanism between application logic and storage level, there is currently no need to create additional connections beyond the intrinsic one held inside aStorageManagerinstance. Just use it instead.- Specified by:
- createConnectionin interface- StorageManager
- Returns:
- a new StorageConnectioninstance.
 
- 
initializationTimepublic final long initializationTime()- Specified by:
- initializationTimein interface- StorageController
 
- 
operationModeTimepublic final long operationModeTime()- Specified by:
- operationModeTimein interface- StorageController
 
- 
issueFullGarbageCollectionpublic final void issueFullGarbageCollection()Description copied from interface:StorageConnectionIssues a full garbage collection to be executed. Depending on the size of the database, the available cache, used hardware, etc., this can take any amount of time.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. - Specified by:
- issueFullGarbageCollectionin interface- StorageConnection
- See Also:
- StorageConnection.issueGarbageCollection(long)
 
- 
issueGarbageCollectionpublic 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 occured since the last completed garbage sweep, this method will have no effect and return immediately.- Specified by:
- issueGarbageCollectionin interface- StorageConnection
- 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()
 
- 
issueFullFileCheckpublic final void issueFullFileCheck()Description copied from interface:StorageConnectionIssues a full storage file check to be executed. Depending on the size of the database, the available cache, used hardware, etc., this can take any amount of time.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()- Specified by:
- issueFullFileCheckin interface- StorageConnection
- See Also:
- StorageConnection.issueFileCheck(long)
 
- 
issueFileCheckpublic 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 occured since the last completed check, this method will have no effect and return immediately.- Specified by:
- issueFileCheckin interface- StorageConnection
- Parameters:
- nanoTimeBudget- the time budget in nanoseconds to be used to perform file checking.
- Returns:
- whether the returned call has completed file checking.
 
- 
issueFullCacheCheckpublic final void issueFullCacheCheck()Description copied from interface:StorageConnectionIssues a full storage cache check to be executed. Depending on the size of the database, the available cache, used hardware, etc., this can take any amount of time.Cache checking evaluates every cache entity data about being worth to be kept in cache according to the configured StorageEntityCacheEvaluatorlogic. 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.
- 
issueFullCacheCheckDescription copied from interface:StorageConnectionSame asStorageConnection.issueFullCacheCheck(), but with using the passedStorageEntityCacheEvaluatorlogic instead of the configured one.- Specified by:
- issueFullCacheCheckin interface- StorageConnection
- Parameters:
- entityEvaluator- the entity cache evaluation logic to be used for the call.
- See Also:
- StorageConnection.issueFullCacheCheck(),- StorageConnection.issueCacheCheck(long),- StorageConnection.issueCacheCheck(long,StorageEntityCacheEvaluator)
 
- 
issueCacheCheckpublic final boolean issueCacheCheck(long nanoTimeBudget)Description copied from interface:StorageConnectionIssues a storage cache 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 the used cache size is 0, this method will have no effect and return immediately.- Specified by:
- issueCacheCheckin interface- StorageConnection
- Parameters:
- nanoTimeBudget- the time budget in nanoseconds to be used to perform cache checking.
- 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,StorageEntityCacheEvaluator)
 
- 
issueCacheCheckpublic 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 interface- StorageConnection
- entityEvaluator- the entity cache evaluation logic to be used for the call.
- See Also:
- StorageConnection.issueFullCacheCheck(),- StorageConnection.issueFullCacheCheck(StorageEntityCacheEvaluator),- StorageConnection.issueCacheCheck(long)
 
- 
issueFullBackuppublic final void issueFullBackup(StorageLiveFileProvider targetFileProvider, 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 interface- StorageConnection
- Parameters:
- targetFileProvider- file provider for backup files
 
- 
createStorageStatisticsDescription copied from interface:StorageConnectionCreates aStorageRawFileStatisticsinstance, (obviously) containing raw file statistics about every channel in the storage.- Specified by:
- createStorageStatisticsin interface- StorageConnection
- Returns:
- a StorageRawFileStatisticsinstance based on the current state.
 
- 
exportChannelspublic final 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 interface- StorageConnection
- Parameters:
- fileProvider- the- StorageLiveFileProviderlogic to be used for the export.
- performGarbageCollection- whether a- StorageConnection.issueFullGarbageCollection()shall be issued before performing the export.
 
- 
exportTypespublic final 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 interface- StorageConnection
- Parameters:
- exportFileProvider- the- StorageEntityTypeExportFileProviderlogic to be used.
- isExportType- a- Predicateselecting which type's entity data to be exported.
- Returns:
- a StorageEntityTypeExportStatisticsinformation instance about the completed export.
- See Also:
- StorageConnection.exportTypes(StorageEntityTypeExportFileProvider)
 
- 
importFilesDescription 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 interface- StorageConnection
- Parameters:
- importFiles- the files whose native binary content shall be imported.
 
- 
defaultRootDeprecated.Description copied from interface:StorageManagerThis method is deprecated due to simplified root handling and will be removed in a future version.
 It is advised to useStorageManager.root()andStorageManager.setRoot(Object)instead.- Specified by:
- defaultRootin interface- StorageManager
- Returns:
- a mutable Referenceto the root object.
 
 
-