github.com/onflow/flow-go@v0.33.17/network/p2p/tracer/internal/rpc_send_entity.go (about) 1 package internal 2 3 import ( 4 "github.com/onflow/flow-go/model/flow" 5 p2pmsg "github.com/onflow/flow-go/network/p2p/message" 6 ) 7 8 // rpcSentEntity struct representing an RPC control message sent from local node. 9 // This struct implements the flow.Entity interface and uses messageID field deduplication. 10 type rpcSentEntity struct { 11 // messageID the messageID of the rpc control message. 12 messageID flow.Identifier 13 // controlMsgType the control message type. 14 controlMsgType p2pmsg.ControlMessageType 15 } 16 17 var _ flow.Entity = (*rpcSentEntity)(nil) 18 19 // ID returns the node ID of the sender, which is used as the unique identifier of the entity for maintenance and 20 // deduplication purposes in the cache. 21 func (r rpcSentEntity) ID() flow.Identifier { 22 return r.messageID 23 } 24 25 // Checksum returns the node ID of the sender, it does not have any purpose in the cache. 26 // It is implemented to satisfy the flow.Entity interface. 27 func (r rpcSentEntity) Checksum() flow.Identifier { 28 return r.messageID 29 } 30 31 // newRPCSentEntity returns a new rpcSentEntity. 32 func newRPCSentEntity(id flow.Identifier, controlMessageType p2pmsg.ControlMessageType) rpcSentEntity { 33 return rpcSentEntity{ 34 messageID: id, 35 controlMsgType: controlMessageType, 36 } 37 }