It is assumed that at a sufficiently coarse granularity, persistent objects form trees. This allows for efficient, asynchronous tree processing algorithms to be used to delete or copy many gigabytes of objects.
Interface IPersistable
has two methods VisitPrefs()
and RepresentsSubTree()
which are relevant.
$interface+ IPersistable : IObject
{
void VisitPrefs(IPrefVisitor& v) const;
bool RepresentsSubTree() const;
void Serialise(Archive& ar) const;
void Deserialise(InputArchive& ar);
void OnCreate(bool local);
PersistObjState& GetPersistObjState() const;
};
VisitPrefs()
must visit all outgoing prefs of the given IPersistable
object.
Note that as far as VisitPrefs()
is concerned all prefs are treated equally (whether they represent
internal/external pointers or back pointers etc).
RepresentsSubTree()
returns true if and only if the object represents the root of an isolated
sub-tree.
In the following diagram we have three coarse nodes (in rectangular boxes) denoted N1, N2, N3 that form a tree.
Objects r1,r2,r3 are the only objects for which RepresentsSubTree()
returns true.
Note how a number of objects may be associated with a single coarse node. It is assumed that all the objects in a coarse node can easily fit into memory at the same time. Therefore tracing garbage collection or cloning of a single coarse node is reasonable.
N1 is a parent of N2 and N3. Let's focus on the rules on prefs between parent N1 and child N2. The rules are as follows...
RepresentsSubTree()
returns true.