Class PersistenceManager.Default<D>
- java.lang.Object
-
- one.microstream.persistence.types.PersistenceManager.Default<D>
-
- All Implemented Interfaces:
ByteOrderTargeting<PersistenceManager<D>>
,PersistenceManager<D>
,PersistenceObjectIdHolder
,PersistenceObjectIdLookup
,PersistenceObjectLookup
,PersistenceObjectManager
,PersistenceRetrieving
,PersistenceSourceSupplier<D>
,PersistenceStoring
,PersistenceSwizzlingLookup
,Persister
,Unpersistable
,ObjectSwizzling
,Cloneable<PersistenceObjectManager>
- Enclosing interface:
- PersistenceManager<D>
public static final class PersistenceManager.Default<D> extends Object implements PersistenceManager<D>, 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<D>
-
-
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
createEagerStorer()
PersistenceStorer
createLazyStorer()
PersistenceLoader
createLoader()
PersistenceRegisterer
createRegisterer()
PersistenceStorer
createStorer()
PersistenceStorer
createStorer(PersistenceStorer.Creator<D> 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<D>
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<D>
target()
PersistenceTypeDictionary
typeDictionary()
PersistenceManager.Default<D>
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
updateMetadata
-
Methods inherited from interface one.microstream.persistence.types.PersistenceObjectManager
Clone
-
-
-
-
Method Detail
-
getTargetByteOrder
public final ByteOrder getTargetByteOrder()
- Specified by:
getTargetByteOrder
in interfaceByteOrderTargeting<D>
-
objectRegistry
public final PersistenceObjectRegistry objectRegistry()
- Specified by:
objectRegistry
in interfacePersistenceManager<D>
-
typeDictionary
public final PersistenceTypeDictionary typeDictionary()
- Specified by:
typeDictionary
in interfacePersistenceManager<D>
-
consolidate
public final void consolidate()
- Specified by:
consolidate
in interfacePersistenceObjectManager
-
createLazyStorer
public final PersistenceStorer createLazyStorer()
- Specified by:
createLazyStorer
in interfacePersistenceManager<D>
- Specified by:
createLazyStorer
in interfacePersister
-
createStorer
public final PersistenceStorer createStorer()
- Specified by:
createStorer
in interfacePersistenceManager<D>
- Specified by:
createStorer
in interfacePersister
-
createEagerStorer
public final PersistenceStorer createEagerStorer()
- Specified by:
createEagerStorer
in interfacePersistenceManager<D>
- Specified by:
createEagerStorer
in interfacePersister
-
createStorer
public final PersistenceStorer createStorer(PersistenceStorer.Creator<D> storerCreator)
- Specified by:
createStorer
in interfacePersistenceManager<D>
-
createRegisterer
public final PersistenceRegisterer createRegisterer()
- Specified by:
createRegisterer
in interfacePersistenceManager<D>
-
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
- Specified by:
store
in interfacePersister
- 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
- Specified by:
storeAll
in interfacePersister
- 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
- Specified by:
storeAll
in interfacePersister
- 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<D>
- 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 interfaceObjectSwizzling
- Specified by:
getObject
in interfacePersistenceRetrieving
- Specified by:
getObject
in interfacePersistenceSourceSupplier<D>
- Specified by:
getObject
in interfacePersister
-
createLoader
public final PersistenceLoader createLoader()
- Specified by:
createLoader
in interfacePersistenceManager<D>
-
source
public final PersistenceSource<D> source()
- Specified by:
source
in interfacePersistenceManager<D>
- Specified by:
source
in interfacePersistenceSourceSupplier<D>
-
target
public final PersistenceTarget<D> target()
- Specified by:
target
in interfacePersistenceManager<D>
-
close
public void close()
Description copied from interface:PersistenceManager
Closes all ties to outside resources, if applicable. Typ- Specified by:
close
in interfacePersistenceManager<D>
-
updateCurrentObjectId
public PersistenceManager.Default<D> updateCurrentObjectId(long currentObjectId)
- Specified by:
updateCurrentObjectId
in interfacePersistenceManager<D>
- 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<D>
-
-