Class PersistenceManager.Default<M>
- java.lang.Object
-
- one.microstream.persistence.types.PersistenceManager.Default<M>
-
- All Implemented Interfaces:
ByteOrderTargeting<PersistenceManager<M>>
,PersistenceManager<M>
,PersistenceObjectIdHolder
,PersistenceObjectIdLookup
,PersistenceObjectLookup
,PersistenceObjectManager
,PersistenceObjectRetriever
,PersistenceRetrieving
,PersistenceSourceSupplier<M>
,PersistenceStoring
,PersistenceSwizzlingLookup
,Unpersistable
,Cloneable<PersistenceObjectManager>
- Enclosing interface:
- PersistenceManager<M>
public static final class PersistenceManager.Default<M> extends Object implements PersistenceManager<M>, Unpersistable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface one.microstream.persistence.types.ByteOrderTargeting
ByteOrderTargeting.Mutable<T extends ByteOrderTargeting.Mutable<?>>
-
Nested classes/interfaces inherited from interface one.microstream.persistence.types.PersistenceManager
PersistenceManager.Default<M>
-
-
Constructor Summary
Constructors Constructor Description Default()
-
Method Summary
Modifier and Type Method Description void
close()
Closes all ties to outside resources, if applicable.<C extends Consumer<Object>>
Ccollect(C collector, long... objectIds)
void
consolidate()
PersistenceStorer<M>
createEagerStorer()
PersistenceStorer<M>
createLazyStorer()
PersistenceLoader<M>
createLoader()
PersistenceRegisterer
createRegisterer()
PersistenceStorer<M>
createStorer()
PersistenceStorer<M>
createStorer(PersistenceStorer.Creator<M> storerCreator)
long
currentObjectId()
long
ensureObjectId(Object object)
long
ensureObjectId(Object object, PersistenceAcceptor newObjectIdCallback)
Object
get()
Object
getObject(long objectId)
ByteOrder
getTargetByteOrder()
Object
lookupObject(long objectId)
long
lookupObjectId(Object object)
PersistenceObjectRegistry
objectRegistry()
PersistenceSource<M>
source()
long
store(Object object)
Stores the passed instance in any case and all referenced instances of persistable references recursively, but stores referenced instances only if they are newly encountered (e.g.void
storeAll(Iterable<?> instances)
Convenience method toPersistenceStoring.store(Object)
all instances of anIterable
type, usually a collection.
The passed instance itself is NOT stored.
Note that this method does not return an array of objectIds, since the amount of instances supplied by the passedIterable
cannot be known until after all instances have been stored and the memory and performance overhead to collect them dynamically would not be worth it in most cases since the returned array is hardly ever needed.long[]
storeAll(Object... instances)
Convenience method toPersistenceStoring.store(Object)
multiple instances.PersistenceTarget<M>
target()
PersistenceTypeDictionary
typeDictionary()
PersistenceManager.Default<M>
updateCurrentObjectId(long currentObjectId)
void
updateMetadata(PersistenceTypeDictionary typeDictionary, long highestTypeId, long highestObjectId)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface one.microstream.persistence.types.ByteOrderTargeting
isByteOrderMismatch
-
Methods inherited from interface one.microstream.persistence.types.PersistenceManager
storeSelfStoring, updateMetadata
-
Methods inherited from interface one.microstream.persistence.types.PersistenceObjectManager
Clone
-
-
-
-
Method Detail
-
getTargetByteOrder
public final ByteOrder getTargetByteOrder()
- Specified by:
getTargetByteOrder
in interfaceByteOrderTargeting<M>
-
objectRegistry
public final PersistenceObjectRegistry objectRegistry()
- Specified by:
objectRegistry
in interfacePersistenceManager<M>
-
typeDictionary
public final PersistenceTypeDictionary typeDictionary()
- Specified by:
typeDictionary
in interfacePersistenceManager<M>
-
consolidate
public final void consolidate()
- Specified by:
consolidate
in interfacePersistenceObjectManager
-
createLazyStorer
public final PersistenceStorer<M> createLazyStorer()
- Specified by:
createLazyStorer
in interfacePersistenceManager<M>
-
createStorer
public final PersistenceStorer<M> createStorer()
- Specified by:
createStorer
in interfacePersistenceManager<M>
-
createEagerStorer
public final PersistenceStorer<M> createEagerStorer()
- Specified by:
createEagerStorer
in interfacePersistenceManager<M>
-
createStorer
public final PersistenceStorer<M> createStorer(PersistenceStorer.Creator<M> storerCreator)
- Specified by:
createStorer
in interfacePersistenceManager<M>
-
createRegisterer
public final PersistenceRegisterer createRegisterer()
- Specified by:
createRegisterer
in interfacePersistenceManager<M>
-
store
public final long store(Object object)
Description copied from interface:PersistenceStoring
Stores the passed instance in any case and all referenced instances of persistable references recursively, but stores referenced instances only if they are newly encountered (e.g. don't have an id associated with them in the object registry, yet and are therefore required to be handled). This is useful for the common case of just storing an updated instance and potentially newly created instances along with it while skipping all existing (and normally unchanged) referenced instances.- Specified by:
store
in interfacePersistenceStoring
- Parameters:
object
- the root instance of the subgraph of required instances to be stored.- Returns:
- the object id representing the passed instance.
-
storeAll
public final long[] storeAll(Object... instances)
Description copied from interface:PersistenceStoring
Convenience method toPersistenceStoring.store(Object)
multiple instances. The passed array (maybe implicitely created by the compiler) itself is NOT stored.- Specified by:
storeAll
in interfacePersistenceStoring
- Parameters:
instances
- multiple root instances of the subgraphs of required instances to be stored.- Returns:
- an array containing the object ids representing the passed instances.
-
storeAll
public void storeAll(Iterable<?> instances)
Description copied from interface:PersistenceStoring
Convenience method toPersistenceStoring.store(Object)
all instances of anIterable
type, usually a collection.
The passed instance itself is NOT stored.
Note that this method does not return an array of objectIds, since the amount of instances supplied by the passedIterable
cannot be known until after all instances have been stored and the memory and performance overhead to collect them dynamically would not be worth it in most cases since the returned array is hardly ever needed. If it should be needed, the desired behavior can be easily achieved with a tiny custom-made utility method.- Specified by:
storeAll
in interfacePersistenceStoring
- Parameters:
instances
- multiple root instances of the subgraphs of required instances to be stored.
-
ensureObjectId
public final long ensureObjectId(Object object)
- Specified by:
ensureObjectId
in interfacePersistenceObjectManager
-
ensureObjectId
public final long ensureObjectId(Object object, PersistenceAcceptor newObjectIdCallback)
- Specified by:
ensureObjectId
in interfacePersistenceObjectManager
-
currentObjectId
public long currentObjectId()
- Specified by:
currentObjectId
in interfacePersistenceManager<M>
- Specified by:
currentObjectId
in interfacePersistenceObjectIdHolder
- Specified by:
currentObjectId
in interfacePersistenceObjectManager
-
lookupObjectId
public final long lookupObjectId(Object object)
- Specified by:
lookupObjectId
in interfacePersistenceObjectIdLookup
-
lookupObject
public final Object lookupObject(long objectId)
- Specified by:
lookupObject
in interfacePersistenceObjectLookup
-
get
public final Object get()
- Specified by:
get
in interfacePersistenceRetrieving
-
collect
public final <C extends Consumer<Object>> C collect(C collector, long... objectIds)
- Specified by:
collect
in interfacePersistenceRetrieving
-
getObject
public final Object getObject(long objectId)
- Specified by:
getObject
in interfacePersistenceObjectRetriever
- Specified by:
getObject
in interfacePersistenceRetrieving
- Specified by:
getObject
in interfacePersistenceSourceSupplier<M>
-
createLoader
public final PersistenceLoader<M> createLoader()
- Specified by:
createLoader
in interfacePersistenceManager<M>
-
source
public final PersistenceSource<M> source()
- Specified by:
source
in interfacePersistenceManager<M>
- Specified by:
source
in interfacePersistenceSourceSupplier<M>
-
target
public final PersistenceTarget<M> target()
- Specified by:
target
in interfacePersistenceManager<M>
-
close
public void close()
Description copied from interface:PersistenceManager
Closes all ties to outside resources, if applicable. Typ- Specified by:
close
in interfacePersistenceManager<M>
-
updateCurrentObjectId
public PersistenceManager.Default<M> updateCurrentObjectId(long currentObjectId)
- Specified by:
updateCurrentObjectId
in interfacePersistenceManager<M>
- Specified by:
updateCurrentObjectId
in interfacePersistenceObjectIdHolder
- Specified by:
updateCurrentObjectId
in interfacePersistenceObjectManager
-
updateMetadata
public void updateMetadata(PersistenceTypeDictionary typeDictionary, long highestTypeId, long highestObjectId)
- Specified by:
updateMetadata
in interfacePersistenceManager<M>
-
-