public interface StorageManager extends StorageController, StorageConnection, DatabasePart
For all intents and purposes, a StorageManager instance represents the storage of a database in the
Java application that uses it. It is used for starting and stopping storage managements threads,
call storage-level utility functionality like clearing the low-level data cache, cleaning up / condensing
storage files or calling the storage-level garbage collector to remove data that has become unreachable in the
entity graph. This type also allows querying the used StorageConfiguration or the
StorageTypeDictionary that defines the persistent structure of all handled types.
For the most cases, only the methods root(), setRoot(Object), start() and
shutdown() are important. Everything else is used for moreless advanced purposes and should only be used
with good knowledge about the effects caused by it.
A StorageManager instance is also implicitely a StorageConnection, so that developers don't
need to care about connections at all if a single connection suffices.
StorageConnection.Default| Modifier and Type | Method and Description |
|---|---|
StorageConfiguration |
configuration()
Returns the
StorageConfiguration used to initialize this StorageManager instance. |
StorageConnection |
createConnection()
Creates a new
StorageConnection instance. |
default Object |
customRoot()
Deprecated.
will be removed in version 8
|
Database |
database()
Returns the
Database instance this StorageManager is associated with. |
default String |
databaseName()
Alias for
return this.database().databaseName(); |
one.microstream.reference.Reference<Object> |
defaultRoot()
Deprecated.
will be removed in version 8
|
Object |
root()
Return the persistent object graph's root object, without specific typing.
|
Object |
setRoot(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. |
boolean |
shutdown()
Issues a command to shut down all active threads managing the storage.
|
StorageManager |
start()
"Starts" the storage controlled by this
StorageController instance, 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. |
default long |
storeDefaultRoot()
Deprecated.
will be removed in version 8
|
long |
storeRoot()
Stores the registered root instance (as returned by
root()) by using the default storing logic
by calling StorageConnection.createStorer() to create the Storer to be used.Depending on the storer logic, storing the root instance can cause many other object to be stored, as well. |
StorageTypeDictionary |
typeDictionary()
Returns the
StorageTypeDictionary that contains a completely list of types currently known to /
handled by the storage represented by this StorageManager instance. |
one.microstream.persistence.types.PersistenceRootsView |
viewRoots()
Returns a read-only view on all technical root instance registered in this
StorageManager instance.See the description in PersistenceRootsView for details. |
checkAcceptingTasks, close, initializationDuration, initializationTime, isAcceptingTasks, isRunning, isShutdown, isShuttingDown, isStartingUp, operationModeTimeisActivecreateEagerStorer, createLazyStorer, createStorageStatistics, createStorer, exportChannels, exportChannels, exportTypes, exportTypes, getObject, importFiles, issueCacheCheck, issueCacheCheck, issueFileCheck, issueFullBackup, issueFullBackup, issueFullCacheCheck, issueFullCacheCheck, issueFullFileCheck, issueFullGarbageCollection, issueGarbageCollection, New, persistenceManager, store, storeAll, storeAllStorageConfiguration configuration()
StorageConfiguration used to initialize this StorageManager instance.StorageTypeDictionary typeDictionary()
StorageTypeDictionary that contains a completely list of types currently known to /
handled by the storage represented by this StorageManager instance. This list grows dynamically
as so far unknown types are discovered, analyzed, mapped and added on the fly by a store.StorageTypeDictionary.StorageManager start()
StorageController instance, with "starting" meaning:start in interface StorageControllerboolean shutdown()
shutdown in interface StorageControllertrue after a successful shutdown or false
if an internal InterruptedException happened.StorageConnection createConnection()
StorageConnection instance. See the type description for details.StorageManager instance. Just use it instead.StorageConnection instance.Object root()
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);
Object setRoot(Object newRoot)
newRoot - the new root instance to be set.long storeRoot()
root()) by using the default storing logic
by calling StorageConnection.createStorer() to create the Storer to be used.StorageConnection.createLazyStorer(), all recursively referenced
instances that are not yet known to the persistent context (i.e. have an associated objectId registered in the
context's PersistenceObjectRegistry) are stored as well.one.microstream.persistence.types.PersistenceRootsView viewRoots()
StorageManager instance.PersistenceRootsView for details.PersistenceRootsView instance allowing to iterate all technical root instances.@Deprecated one.microstream.reference.Reference<Object> defaultRoot()
root() and setRoot(Object) instead.Reference to the root object.@Deprecated default Object customRoot()
root() instead, for which this method is an alias.@Deprecated default long storeDefaultRoot()
storeRoot() instead, for which this method is an alias.Database database()
Database instance this StorageManager is associated with.
See its description for details.Database instance.default String databaseName()
return this.database().databaseName();databaseName in interface DatabasePartDatabase.Copyright © 2022 MicroStream Software. All rights reserved.