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 voidclose()Closes all ties to outside resources, if applicable.<C extends Consumer<Object>>
Ccollect(C collector, long... objectIds)voidconsolidate()PersistenceStorer<M>createEagerStorer()PersistenceStorer<M>createLazyStorer()PersistenceLoader<M>createLoader()PersistenceRegisterercreateRegisterer()PersistenceStorer<M>createStorer()PersistenceStorer<M>createStorer(PersistenceStorer.Creator<M> storerCreator)longcurrentObjectId()longensureObjectId(Object object)longensureObjectId(Object object, PersistenceAcceptor newObjectIdCallback)Objectget()ObjectgetObject(long objectId)ByteOrdergetTargetByteOrder()ObjectlookupObject(long objectId)longlookupObjectId(Object object)PersistenceObjectRegistryobjectRegistry()PersistenceSource<M>source()longstore(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.voidstoreAll(Iterable<?> instances)Convenience method toPersistenceStoring.store(Object)all instances of anIterabletype, 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 passedIterablecannot 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()PersistenceTypeDictionarytypeDictionary()PersistenceManager.Default<M>updateCurrentObjectId(long currentObjectId)voidupdateMetadata(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:
getTargetByteOrderin interfaceByteOrderTargeting<M>
-
objectRegistry
public final PersistenceObjectRegistry objectRegistry()
- Specified by:
objectRegistryin interfacePersistenceManager<M>
-
typeDictionary
public final PersistenceTypeDictionary typeDictionary()
- Specified by:
typeDictionaryin interfacePersistenceManager<M>
-
consolidate
public final void consolidate()
- Specified by:
consolidatein interfacePersistenceObjectManager
-
createLazyStorer
public final PersistenceStorer<M> createLazyStorer()
- Specified by:
createLazyStorerin interfacePersistenceManager<M>
-
createStorer
public final PersistenceStorer<M> createStorer()
- Specified by:
createStorerin interfacePersistenceManager<M>
-
createEagerStorer
public final PersistenceStorer<M> createEagerStorer()
- Specified by:
createEagerStorerin interfacePersistenceManager<M>
-
createStorer
public final PersistenceStorer<M> createStorer(PersistenceStorer.Creator<M> storerCreator)
- Specified by:
createStorerin interfacePersistenceManager<M>
-
createRegisterer
public final PersistenceRegisterer createRegisterer()
- Specified by:
createRegistererin interfacePersistenceManager<M>
-
store
public final long store(Object object)
Description copied from interface:PersistenceStoringStores 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:
storein 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:PersistenceStoringConvenience method toPersistenceStoring.store(Object)multiple instances. The passed array (maybe implicitely created by the compiler) itself is NOT stored.- Specified by:
storeAllin 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:PersistenceStoringConvenience method toPersistenceStoring.store(Object)all instances of anIterabletype, 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 passedIterablecannot 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:
storeAllin interfacePersistenceStoring- Parameters:
instances- multiple root instances of the subgraphs of required instances to be stored.
-
ensureObjectId
public final long ensureObjectId(Object object)
- Specified by:
ensureObjectIdin interfacePersistenceObjectManager
-
ensureObjectId
public final long ensureObjectId(Object object, PersistenceAcceptor newObjectIdCallback)
- Specified by:
ensureObjectIdin interfacePersistenceObjectManager
-
currentObjectId
public long currentObjectId()
- Specified by:
currentObjectIdin interfacePersistenceManager<M>- Specified by:
currentObjectIdin interfacePersistenceObjectIdHolder- Specified by:
currentObjectIdin interfacePersistenceObjectManager
-
lookupObjectId
public final long lookupObjectId(Object object)
- Specified by:
lookupObjectIdin interfacePersistenceObjectIdLookup
-
lookupObject
public final Object lookupObject(long objectId)
- Specified by:
lookupObjectin interfacePersistenceObjectLookup
-
get
public final Object get()
- Specified by:
getin interfacePersistenceRetrieving
-
collect
public final <C extends Consumer<Object>> C collect(C collector, long... objectIds)
- Specified by:
collectin interfacePersistenceRetrieving
-
getObject
public final Object getObject(long objectId)
- Specified by:
getObjectin interfacePersistenceObjectRetriever- Specified by:
getObjectin interfacePersistenceRetrieving- Specified by:
getObjectin interfacePersistenceSourceSupplier<M>
-
createLoader
public final PersistenceLoader<M> createLoader()
- Specified by:
createLoaderin interfacePersistenceManager<M>
-
source
public final PersistenceSource<M> source()
- Specified by:
sourcein interfacePersistenceManager<M>- Specified by:
sourcein interfacePersistenceSourceSupplier<M>
-
target
public final PersistenceTarget<M> target()
- Specified by:
targetin interfacePersistenceManager<M>
-
close
public void close()
Description copied from interface:PersistenceManagerCloses all ties to outside resources, if applicable. Typ- Specified by:
closein interfacePersistenceManager<M>
-
updateCurrentObjectId
public PersistenceManager.Default<M> updateCurrentObjectId(long currentObjectId)
- Specified by:
updateCurrentObjectIdin interfacePersistenceManager<M>- Specified by:
updateCurrentObjectIdin interfacePersistenceObjectIdHolder- Specified by:
updateCurrentObjectIdin interfacePersistenceObjectManager
-
updateMetadata
public void updateMetadata(PersistenceTypeDictionary typeDictionary, long highestTypeId, long highestObjectId)
- Specified by:
updateMetadatain interfacePersistenceManager<M>
-
-