lighthouse.peer
¶lighthouse.peer.
Peer
(name, ip, port=None)[source]¶Bases: object
This class represents a host running a lighthouse reporter.
When a reporter script tells its discovery method that a node is up, it includes information about itself via this class so that writer scripts reading that information can coordinate their peers.
This is helpful for HAProxy as a way to generate “peers” config stanzas so instances of HAProxy in a given cluster can share stick-table data.
current
()[source]¶Helper method for getting the current peer of whichever host we’re running on.
deserialize
(value)[source]¶Generates a Peer instance via a JSON string of the sort generated
by Peer.deserialize
.
The name
and ip
keys are required to be present in the JSON map,
if the port
key is not present the default is used.