A DeltaRW is associated with a WorkingSetMachine
and allows for sending and receiving the operations used to synchronise the mutable objects with a remote
WorkingSetMachine
using Operational Transformation.
A DeltaRW communicates with exactly one remote DeltaRW using a fully symmetric message based protocol.
A DeltaRW is stateful, so therefore local and remote DeltaRWs must be paired for the life of the session.
A DeltaRW is not concerned with creating or managing internal threads or sockets for IPC. Instead deltas are read/written synchronously to a given input or output archive.
A DeltaRW is defined in the Xc++ language as an $adt:
$adt+ DeltaRW
{
void Close();
// Reader
InputArchive DeserialiseNextDelta(InputArchive ar, bool& appliedChanges);
// Writer
void Init(const VecTime& rhv);
bool HaveChangesToSend() const;
bool WriteNextDelta(Archive& ar);
};
void Close()
Must be called without a lock on the CSpace. It is not necessary to have set the CSpace/PSpace in TLS.
InputArchive DeserialiseNextDelta(InputArchive ar, bool& appliedChanges)
Read and apply the next delta from 'ar' which is an InputArchive. Sets 'appliedChanges' if changes were actually applied. Requires an exclusive lock on the associated CSpace, and CSpace/PSpace to be set in TLS
void Init(const VecTime& rhv)
Must be called exactly once, and before all other public methods in this class. Requires an exclusive lock on the associated CSpace, and CSpace/PSpace to be set in TLS
bool HaveChangesToSend() const
Are there changes waiting to be sent? Requires a lock on the associated CSpace, and CSpace/PSpace to be set in TLS
bool WriteNextDelta(Archive& ar)
Write the next delta to ar. Returns false if nothing to write. Requires a lock on the associated CSpace, and CSpace/PSpace to be set in TLS