7.8. Callbacks to Replicas

Whenever the Core makes “important” change to an object, it calls its object_updated() virtual method. This method has single argument reason. Replication protocols will call this callback method with reason set to one of the following values:

Table 7.5. Replication-related object_update() reasons
Reason value [a]Used when
REPLICA_CREATEDSignalled after a new instance of object replica has been created and initialized. Properties of the replica are still invalid at this time. Both REPLICA_UPDATE and REPLICA_UPDATE object changes will be signalled after REPLICA_CREATED.
REPLICA_UPDATESignalled before update of replica properties.
REPLICA_CREATEDSignalled after update of replica properties.
REPLICA_DESTROYSignalled before destruction of a replica.

[a] The type of the reason argument is enumeration UpdateReason defined in class Object. Therefore fully-qualified name of the REPLICA_CREATED (for example) is Massiv::Core::Object::REPLICA_CREATED.

Replication protocols ensure that replication update always contains up-to-date versions of all objects belonging to a replication group. If multiple objects are created by the update, REPLICA_CREATED callback will be signalled on all new objects as they are instantiated. All objects will be created before contents of any object is updated.

If multiple objects are destroyed by an update, REPLICA_DESTROY callback will be signalled on all objects-to-destroy before any object is actually destroyed.

REPLICA_UPDATE and REPLICA_UDPATED callbacks are signalled as objects are updated. Therefore you should not assume anything about validity of pointers and about objects belonging to the replication group of the updated objects when handling these callbacks.

[Note]Note

Refer to Massiv Core Reference Guide for more information about all available object callbacks.