1 #ifndef ZGPeerSettings_h
2 #define ZGPeerSettings_h
5 #include "message/Message.h"
10 class PZGHeartbeatThreadState;
36 : _systemName(systemName)
37 , _numDatabases(numDatabases)
38 , _systemIsOnLocalhostOnly(systemIsOnLocalhostOnly)
40 , _heartbeatsPerSecond(6)
41 , _heartbeatsBeforeFullyAttached(4)
42 , _maxMissingHeartbeats(4)
43 , _beaconsPerSecond(4)
44 , _outgoingHeartbeatPacketIDCounter(0)
82 void SetPeerAttributes(
const ConstMessageRef & peerAttributes) {_optPeerAttributes = peerAttributes;}
129 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
130 friend class zg_private::PZGHeartbeatThreadState;
135 bool _systemIsOnLocalhostOnly;
136 ConstMessageRef _optPeerAttributes;
138 uint32 _heartbeatsPerSecond;
139 uint32 _heartbeatsBeforeFullyAttached;
140 uint32 _maxMissingHeartbeats;
141 uint32 _beaconsPerSecond;
142 Hashtable<uint32, uint64> _maxUpdateLogSizeBytes;
143 mutable uint32 _outgoingHeartbeatPacketIDCounter;
This immutable class holds various read-only settings that will be used to define the peer's behavior...
uint64 GetMaximumUpdateLogSizeForDatabase(uint32 whichDB) const
Returns the maximum number of bytes of RAM we should be allowed to use for the update-log of the spec...
void SetBeaconsPerSecond(uint32 bps)
Set the number of times we should send a "beacon" multicast packet per second, if we are the senior p...
const ConstMessageRef & GetPeerAttributes() const
Returns a reference to this peer's peer-attributes Message (as specified earlier via SetPeerAttribute...
The zg namespace contains the public API of the ZG library.
uint32 GetMaxNumMissingHeartbeats() const
Returns the max-missing-heartbeats-before-a-peer-is-declared-offline value for this peer (currently d...
void SetHeartbeatsPerSecond(uint32 hps)
Set the number of times we should send a "heartbeat" multicast packet per second. ...
uint32 GetBeaconsPerSecond() const
Returns the number-of-beacon-packets-to-send-per-second value for this peer (currently defaults to 4)...
uint8 GetNumDatabases() const
Returns the number of databases that will be present in this ZG system (as specified by our construct...
bool IsSystemOnLocalhostOnly() const
Returns true iff this ZG system is meant to be contained entirely within a single host computer (as s...
void SetHeartbeatsBeforeFullyAttached(uint32 hb)
Sets the number of heartbeat-periods that must elapse after our startup, before we declare ourselves ...
void SetPeerAttributes(const ConstMessageRef &peerAttributes)
Set the peer attributes that should be associated with this peer.
uint32 GetHeartbeatsBeforeFullyAttached() const
Returns the num-heartbeats-before-peer-considers-itself-fully-attached value this peer (currently def...
uint16 GetPeerType() const
Returns the PEER_TYPE_* value of this peer (currently only PEER_TYPE_FULL_PEER is supported) ...
void SetMaxNumMissingHeartbeats(uint32 hb)
Sets the number of heartbeat-periods that must go by without hearing any heartbeats from a source...
uint32 GetHeartbeatsPerSecond() const
Returns the heartbeats-per-second value for htis peer (currently defaults to 6)
The zg_private namespace is an undocumented namespace where the ZG library keeps all of its private i...
void SetMaximumUpdateLogSizeForDatabase(uint32 whichDB, uint64 maxNumBytes)
Call this to set the maximum number of bytes of RAM the specified database should be allowed to use f...
ZGPeerSettings(const String &systemName, uint8 numDatabases, bool systemIsOnLocalhostOnly, uint16 peerType=PEER_TYPE_FULL_PEER)
Constructor.
const String & GetSystemName() const
Returns the ZG system's system name (as specified in our constructor)