4 "github.com/vapor/netsync/peers"
7 // BroadcastMsg the message that can be broadcast
9 type BroadcastMsg struct {
14 // NewBroadcastMsg create concrete broadcast message, implement peers.BroadcastMsg interface.
15 func NewBroadcastMsg(msg ConsensusMessage, transChan byte) *BroadcastMsg {
22 // GetChan get message transfer channel.
23 func (b *BroadcastMsg) GetChan() byte {
27 // GetMsg get ConsensusMessage.
28 func (b *BroadcastMsg) GetMsg() interface{} {
29 return struct{ ConsensusMessage }{b.msg}
32 // MsgString get a string representation of the message.
33 func (b *BroadcastMsg) MsgString() string {
37 // MarkSendRecord mark send message record to prevent messages from being sent repeatedly.
38 func (b *BroadcastMsg) MarkSendRecord(ps *peers.PeerSet, peers []string) {
39 b.msg.BroadcastMarkSendRecord(ps, peers)
42 // FilterTargetPeers filter target peers to filter the nodes that need to send messages.
43 func (b *BroadcastMsg) FilterTargetPeers(ps *peers.PeerSet) []string {
44 return b.msg.BroadcastFilterTargetPeers(ps)