The following methods on a PSpace
allow for making new IPersistable
objects
persist.
An IPersistable
has an OID
allocated if and only if it persists on secondary storage.
$adt+ PSpace
{
...
void MakeObjectPersist(OidLow affiliateOidLow, ptr<IPersistable> po);
OID AllocateOid(OidHigh oidHigh, bool useIncrementalOidAllocations);
OidHigh GetOidHighForOidAllocations() const;
void SetOidHighForOidAllocations(OidHigh oidHigh, bool useIncrementalOidAllocations);
bool MakeObjectPersistWithGivenOID(ptr<IPersistable> po, OID oid, bool trace);
void DeclareReachable(ptr<const IPersistable> parent, ptr<const IPersistable> child, bool trace);
void MakeReachableObjectsPersist(ptr<IPersistable> po);
};
Only the thread with write access to the PSpace
is allowed to allocate OIDs to objects. Therefore
in the following functions we don't need to be concerned with multiple threads.
void MakeObjectPersist(OidLow affiliateOidLow, ptr<IPersistable> po)
po
must not have an OID
already.
po
is allocated an oid affiliated with affiliateOidLow
and added to the PSpace
.
No trace is performed (i.e. to allocate oids to objects reachable from po
).
Must be called by a thread that has an exclusive lock on the associated CSpace
.
OID AllocateOid(OidHigh oidHigh, bool useIncrementalOidAllocations)
OidHigh GetOidHighForOidAllocations() const
void SetOidHighForOidAllocations(OidHigh oidHigh, bool useIncrementalOidAllocations)
We provide the means for the OidHigh
used for OID
allocations to be temporarily overidden. A thread
achieves that by pushing a new OidHigh
and later popping it.
bool MakeObjectPersistWithGivenOID(ptr<IPersistable> po, OID oid, bool trace)
po
must not have an OID
allocated.
Allocates oid
to po
, and runs a trace from po
to allocate any additional OIDs as required.
If trace
is true then use IObjectVisitor
to recursively allocate OIDs to IPersistable
objects.
Must be called by a thread that has an exclusive lock on the associated CSpace
.
Returns false if there is already an object in the ROT with the given oid.
void DeclareReachable(ptr<const IPersistable> parent, ptr<const IPersistable> child, bool trace)
Must be called by a thread that has an exclusive lock on the associated CSpace
Declare the fact that child has become reachable from parent.
This will run a full trace from child, allocating an OID
to child and any additional objects
reachable from child.
Must be called by a thread that has an exclusive lock on the associated CSpace
void MakeReachableObjectsPersist(ptr<IPersistable> po)
Make all objects reachable from po
persist. Assumes po
is already persistent.
Must be called by a thread that has an exclusive lock on the associated CSpace
.