This immutable class holds various read-only settings that will be used to define the peer's behavior. More...
#include <ZGPeerSettings.h>
Public Member Functions | |
ZGPeerSettings (const String &systemName, uint8 numDatabases, bool systemIsOnLocalhostOnly, uint16 peerType=PEER_TYPE_FULL_PEER) | |
Constructor. More... | |
const String & | GetSystemName () const |
Returns the ZG system's system name (as specified in our constructor) More... | |
uint8 | GetNumDatabases () const |
Returns the number of databases that will be present in this ZG system (as specified by our constructor) More... | |
bool | IsSystemOnLocalhostOnly () const |
Returns true iff this ZG system is meant to be contained entirely within a single host computer (as specified in our constructor) More... | |
const ConstMessageRef & | GetPeerAttributes () const |
Returns a reference to this peer's peer-attributes Message (as specified earlier via SetPeerAttributes()). More... | |
uint16 | GetPeerType () const |
Returns the PEER_TYPE_* value of this peer (currently only PEER_TYPE_FULL_PEER is supported) More... | |
uint32 | GetHeartbeatsPerSecond () const |
Returns the heartbeats-per-second value for htis peer (currently defaults to 6) More... | |
uint32 | GetMaxNumMissingHeartbeats () const |
Returns the max-missing-heartbeats-before-a-peer-is-declared-offline value for this peer (currently defaults to 4) More... | |
uint32 | GetHeartbeatsBeforeFullyAttached () const |
Returns the num-heartbeats-before-peer-considers-itself-fully-attached value this peer (currently defaults to 4) More... | |
uint32 | GetBeaconsPerSecond () const |
Returns the number-of-beacon-packets-to-send-per-second value for this peer (currently defaults to 4) More... | |
void | SetPeerAttributes (const ConstMessageRef &peerAttributes) |
Set the peer attributes that should be associated with this peer. More... | |
void | SetHeartbeatsPerSecond (uint32 hps) |
Set the number of times we should send a "heartbeat" multicast packet per second. More... | |
void | SetHeartbeatsBeforeFullyAttached (uint32 hb) |
Sets the number of heartbeat-periods that must elapse after our startup, before we declare ourselves fully part of the peers group. More... | |
void | SetMaxNumMissingHeartbeats (uint32 hb) |
Sets the number of heartbeat-periods that must go by without hearing any heartbeats from a source, before we will decide that that source has gone offline. More... | |
void | SetBeaconsPerSecond (uint32 bps) |
Set the number of times we should send a "beacon" multicast packet per second, if we are the senior peer. More... | |
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 for its database-update-log records. More... | |
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 specified database. More... | |
This immutable class holds various read-only settings that will be used to define the peer's behavior.
These settings are not allowed to change during the lifetime of the peer.
Definition at line 25 of file ZGPeerSettings.h.
|
inline |
Constructor.
systemName | Name of the system this peer will participate in. All peers in a system by definition use the same system name. |
numDatabases | The number of replicated databases this system should maintain. |
systemIsOnLocalhostOnly | If true, we'll send/receive multicast packets on loopback interfaces only. If false, we'll use all interfaces. |
peerType | One of the PEER_TYPE_* values. Defaults to PEER_TYPE_FULL_PEER, meaning that this peer is willing to handle both junior-peer and senior-peer duties, if necessary. |
Definition at line 35 of file ZGPeerSettings.h.
|
inline |
Returns the number-of-beacon-packets-to-send-per-second value for this peer (currently defaults to 4)
Definition at line 76 of file ZGPeerSettings.h.
|
inline |
Returns the num-heartbeats-before-peer-considers-itself-fully-attached value this peer (currently defaults to 4)
Definition at line 73 of file ZGPeerSettings.h.
|
inline |
Returns the heartbeats-per-second value for htis peer (currently defaults to 6)
Definition at line 67 of file ZGPeerSettings.h.
|
inline |
Returns the maximum number of bytes of RAM we should be allowed to use for the update-log of the specified database.
whichDB | The database you want to retreive the RAM-usage limit for |
Definition at line 126 of file ZGPeerSettings.h.
|
inline |
Returns the max-missing-heartbeats-before-a-peer-is-declared-offline value for this peer (currently defaults to 4)
Definition at line 70 of file ZGPeerSettings.h.
|
inline |
Returns the number of databases that will be present in this ZG system (as specified by our constructor)
Definition at line 53 of file ZGPeerSettings.h.
|
inline |
Returns a reference to this peer's peer-attributes Message (as specified earlier via SetPeerAttributes()).
May return a NULL reference if no peer-attributes were ever specified.
Definition at line 61 of file ZGPeerSettings.h.
|
inline |
Returns the PEER_TYPE_* value of this peer (currently only PEER_TYPE_FULL_PEER is supported)
Definition at line 64 of file ZGPeerSettings.h.
|
inline |
Returns the ZG system's system name (as specified in our constructor)
Definition at line 50 of file ZGPeerSettings.h.
|
inline |
Returns true iff this ZG system is meant to be contained entirely within a single host computer (as specified in our constructor)
Definition at line 56 of file ZGPeerSettings.h.
|
inline |
Set the number of times we should send a "beacon" multicast packet per second, if we are the senior peer.
Beacon packets are used by the junior peers to verify that they haven't missed an update. They are sent only by the senior peer. Default value is 4 (i.e. one beacon packet every 250 milliseconds)
bps | The number of beacons per second to send (only if we are the senior peer). |
Definition at line 113 of file ZGPeerSettings.h.
|
inline |
Sets the number of heartbeat-periods that must elapse after our startup, before we declare ourselves fully part of the peers group.
During this initial period we simply listen to find out who else is currently out there and passively gather data about them, without trying to interfere with the operation of the existing system. Default value is 4 (i.e. we will wait for four heartbeat-intervals before trying to act as a full member of the system)
hb | The number of heartbeat intervals to wait for during our startup phase. |
Definition at line 99 of file ZGPeerSettings.h.
|
inline |
Set the number of times we should send a "heartbeat" multicast packet per second.
This value will also be used as the number of heartbeats we expect other peers in our group to send, so it is important that this value be the same on all peers in the sysetm Default value is 4 (i.e. one heartbeat every 250 milliseconds)
hps | The number of heartbeats per second to send, and to expect to receive. If set to 0, we'll act as if it was set to 1. |
Definition at line 90 of file ZGPeerSettings.h.
|
inline |
Call this to set the maximum number of bytes of RAM the specified database should be allowed to use for its database-update-log records.
If not specified for a given database, a default limit of two megabytes will be used.
whichDB | The database you want to specify a new limit for |
maxNumBytes | The new limit, in bytes. If set to 0, then the default limit will be reinstated for that database. |
Definition at line 121 of file ZGPeerSettings.h.
|
inline |
Sets the number of heartbeat-periods that must go by without hearing any heartbeats from a source, before we will decide that that source has gone offline.
Default value is 4 (i.e. we will wait for four heartbeat-intervals to go by without any heartbeats from a source, before declaring a source to be offline)
hb | The number of heartbeat intervals that will trigger an offline-state. |
Definition at line 106 of file ZGPeerSettings.h.
|
inline |
Set the peer attributes that should be associated with this peer.
Default is to have no attributes.
peerAttributes | Reference to a Message containing our attributes. Try to keep this small, as a zlib-compressed copy of this Message will be included in every heartbeat packet we send! |
Definition at line 82 of file ZGPeerSettings.h.