Documentation
¶
Index ¶
Constants ¶
const ( // equal and larger msg types are committee messages // those with smaller are reserved by the package for heartbeat and handshake messages FirstCommitteeMsgCode = byte(0x10) MsgTypeReserved = byte(0) MsgTypeHandshake = byte(1) MsgTypeMsgChunk = byte(2) )
const PluginName = "Peering"
PluginName is the name of the database plugin.
Variables ¶
var EventPeerMessageReceived = events.NewEvent(func(handler interface{}, params ...interface{}) { handler.(func(_ *PeerMessage))(params[0].(*PeerMessage)) })
Functions ¶
func MyNetworkId ¶
func MyNetworkId() string
func SendMsgToPeers ¶
func SendMsgToPeers(msg *PeerMessage, ts int64, peers ...*Peer) uint16
SendMsgToPeers sends same msg to all peers in the slice which are not nil with the same timestamp return number of successfully sent messages and timestamp
Types ¶
type Peer ¶
represents point-to-point TCP connection between two qnodes and another it is used as transport for message exchange Another end is always using the same connection the Peer takes care about exchanging heartbeat messages. It keeps last several received heartbeats as "lad" data to be able to calculate how synced/unsynced clocks of peer are.
func UsePeer ¶
adds new connection to the peer pool if it already exists, returns existing connection added to the pool is picked by loops which will try to establish connection
func (*Peer) SendMsg ¶
func (peer *Peer) SendMsg(msg *PeerMessage) error