1 #ifndef IDatabaseObject_h
2 #define IDatabaseObject_h
4 #include "util/RefCount.h"
30 virtual status_t
SetFromArchive(
const ConstMessageRef & archive) = 0;
36 virtual status_t
SaveToArchive(
const MessageRef & archive)
const = 0;
64 virtual ConstMessageRef
SeniorUpdate(
const ConstMessageRef & seniorDoMsg) = 0;
71 virtual status_t
JuniorUpdate(
const ConstMessageRef & juniorDoMsg) = 0;
107 const Hashtable<ZGPeerID, ConstMessageRef> &
GetOnlinePeers()
const;
This is an abstract interface for an object that can provide us with network-clock-time values...
An interface for an object that represents the full contents of a ZG database.
const ZGDatabasePeerSession * GetDatabasePeerSession() const
As above, but returns a const/read-only pointer.
const Hashtable< ZGPeerID, ConstMessageRef > & GetOnlinePeers() const
Returns a table of the currently online peers (and their attributes), or an empty table if we have no...
virtual uint64 GetNetworkTime64ForRunTime64(uint64 runTime64TimeStamp) const
Returns the network time corresponding to a given local time, or 0 if we have no ZGDatabasePeerSessio...
virtual uint32 CalculateChecksum() const =0
This method should be implemented to recalculate the database's current checksum from scratch...
virtual status_t SaveToArchive(const MessageRef &archive) const =0
Should be implemented to save this object's entire state into (archive).
virtual ConstMessageRef SeniorUpdate(const ConstMessageRef &seniorDoMsg)=0
Should update this object's state using the passed-in senior-do-Message (whose semantics are left up ...
This is a convenience class; it is the same as a ZGPeerSession except that it also knows how to creat...
virtual void SetToDefaultState()=0
Should be implemented to set this object to its default/just-default-constructed state.
The zg namespace contains the public API of the ZG library.
virtual uint64 GetRunTime64ForNetworkTime64(uint64 networkTime64TimeStamp) const
Returns the local time corresponding to a given network time, or 0 if we have no ZGDatabasePeerSessio...
IDatabaseObject()
Default Constructor.
virtual status_t JuniorUpdate(const ConstMessageRef &juniorDoMsg)=0
Should update this object's state using the passed-in junior-do-Messsage (that was previously returne...
virtual status_t SetFromArchive(const ConstMessageRef &archive)=0
Should be implemented to replace this object's entire state with the state contained in (archive) ...
virtual ~IDatabaseObject()
Destructor.
virtual int64 GetToNetworkTimeOffset() const
Returns the number of microseconds that should be added to a GetRunTime64() value to turn it into a G...
A ZGPeerID is a 128-bit integer that uniquely represents a particular peer in a ZG system...
virtual uint64 GetNetworkTime64() const
Returns the current network time, or 0 if we have no ZGDatabasePeerSession.
virtual String ToString() const =0
Should return this object's state as a human-readable string.
bool IsPeerOnline(const ZGPeerID &pid) const
Returns true iff the peer with the specified ID is currently on line.
virtual uint32 GetCurrentChecksum() const =0
Should return the current checksum of this object.
const IDatabaseObject * GetDatabaseObject(uint32 whichDatabase) const
Returns a read-only pointer to the specified IDatabaseObject held by our ZGDatabasePeerSession, or NULL if we don't have a ZGDatabasePeerSession or if the specified database doesn't exist.
ZGDatabasePeerSession * GetDatabasePeerSession()
Returns a pointer to the ZGDatabasePeerSession object that created us, or NULL if this object was not...