Documentation ¶
Index ¶
- type ExternalSender
- type ExternalSenderTest
- type GossipConfig
- type Sender
- func (s *Sender) Accept(ctx *snow.ConsensusContext, containerID ids.ID, container []byte) error
- func (s *Sender) Context() *snow.ConsensusContext
- func (s *Sender) SendAccepted(nodeID ids.ShortID, requestID uint32, containerIDs []ids.ID)
- func (s *Sender) SendAcceptedFrontier(nodeID ids.ShortID, requestID uint32, containerIDs []ids.ID)
- func (s *Sender) SendAncestors(nodeID ids.ShortID, requestID uint32, containers [][]byte)
- func (s *Sender) SendAppGossip(appGossipBytes []byte) error
- func (s *Sender) SendAppGossipSpecific(nodeIDs ids.ShortSet, appGossipBytes []byte) error
- func (s *Sender) SendAppRequest(nodeIDs ids.ShortSet, requestID uint32, appRequestBytes []byte) error
- func (s *Sender) SendAppResponse(nodeID ids.ShortID, requestID uint32, appResponseBytes []byte) error
- func (s *Sender) SendChits(nodeID ids.ShortID, requestID uint32, votes []ids.ID)
- func (s *Sender) SendGet(nodeID ids.ShortID, requestID uint32, containerID ids.ID)
- func (s *Sender) SendGetAccepted(nodeIDs ids.ShortSet, requestID uint32, containerIDs []ids.ID)
- func (s *Sender) SendGetAcceptedFrontier(nodeIDs ids.ShortSet, requestID uint32)
- func (s *Sender) SendGetAncestors(nodeID ids.ShortID, requestID uint32, containerID ids.ID)
- func (s *Sender) SendGossip(containerID ids.ID, container []byte)
- func (s *Sender) SendPullQuery(nodeIDs ids.ShortSet, requestID uint32, containerID ids.ID)
- func (s *Sender) SendPushQuery(nodeIDs ids.ShortSet, requestID uint32, containerID ids.ID, container []byte)
- func (s *Sender) SendPut(nodeID ids.ShortID, requestID uint32, containerID ids.ID, container []byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExternalSender ¶
type ExternalSender interface { // Send a message to a specific set of nodes Send( msg message.OutboundMessage, nodeIDs ids.ShortSet, subnetID ids.ID, validatorOnly bool, ) ids.ShortSet // Send a message to a random group of nodes in a subnet. // Nodes are sampled based on their validator status. Gossip( msg message.OutboundMessage, subnetID ids.ID, validatorOnly bool, numValidatorsToSend int, numNonValidatorsToSend int, ) ids.ShortSet }
ExternalSender sends consensus messages to other validators Right now this is implemented in the networking package
type ExternalSenderTest ¶
type ExternalSenderTest struct { TB testing.TB CantSend, CantGossip bool SendF func(msg message.OutboundMessage, nodeIDs ids.ShortSet, subnetID ids.ID, validatorOnly bool) ids.ShortSet GossipF func(msg message.OutboundMessage, subnetID ids.ID, validatorOnly bool, numValidatorsToSend, numNonValidatorsToSend int) ids.ShortSet }
ExternalSenderTest is a test sender
func (*ExternalSenderTest) Default ¶
func (s *ExternalSenderTest) Default(cant bool)
Default set the default callable value to [cant]
func (*ExternalSenderTest) Gossip ¶
func (s *ExternalSenderTest) Gossip( msg message.OutboundMessage, subnetID ids.ID, validatorOnly bool, numValidatorsToSend int, numNonValidatorsToSend int, ) ids.ShortSet
Given a msg type, the corresponding mock function is called if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
type GossipConfig ¶
type Sender ¶
type Sender struct {
// contains filtered or unexported fields
}
Sender is a wrapper around an ExternalSender. Messages to this node are put directly into router rather than being sent over the network via the wrapped ExternalSender. Sender registers outbound requests with router so that router fires a timeout if we don't get a response to the request.
func New ¶
func New( ctx *snow.ConsensusContext, msgCreator message.Creator, sender ExternalSender, router router.Router, timeouts *timeout.Manager, gossipConfig GossipConfig, ) (*Sender, error)
func (*Sender) SendAccepted ¶
func (*Sender) SendAcceptedFrontier ¶
func (*Sender) SendAncestors ¶
SendAncestors sends an Ancestors message to the consensus engine running on the specified chain on the specified node. The Ancestors message gives the recipient the contents of several containers.
func (*Sender) SendAppGossip ¶
SendAppGossip sends an application-level gossip message.
func (*Sender) SendAppGossipSpecific ¶
func (*Sender) SendAppRequest ¶
func (s *Sender) SendAppRequest(nodeIDs ids.ShortSet, requestID uint32, appRequestBytes []byte) error
SendAppRequest sends an application-level request to the given nodes. The meaning of this request, and how it should be handled, is defined by the VM.
func (*Sender) SendAppResponse ¶
func (s *Sender) SendAppResponse(nodeID ids.ShortID, requestID uint32, appResponseBytes []byte) error
SendAppResponse sends a response to an application-level request from the given node
func (*Sender) SendGet ¶
SendGet sends a Get message to the consensus engine running on the specified chain to the specified node. The Get message signifies that this consensus engine would like the recipient to send this consensus engine the specified container.
func (*Sender) SendGetAccepted ¶
func (*Sender) SendGetAcceptedFrontier ¶
func (*Sender) SendGetAncestors ¶
func (*Sender) SendGossip ¶
SendGossip gossips the provided container
func (*Sender) SendPullQuery ¶
SendPullQuery sends a PullQuery message to the consensus engines running on the specified chains on the specified nodes. The PullQuery message signifies that this consensus engine would like each node to send their preferred frontier.
func (*Sender) SendPushQuery ¶
func (s *Sender) SendPushQuery(nodeIDs ids.ShortSet, requestID uint32, containerID ids.ID, container []byte)
SendPushQuery sends a PushQuery message to the consensus engines running on the specified chains on the specified nodes. The PushQuery message signifies that this consensus engine would like each node to send their preferred frontier given the existence of the specified container.
func (*Sender) SendPut ¶
func (s *Sender) SendPut(nodeID ids.ShortID, requestID uint32, containerID ids.ID, container []byte)
SendPut sends a Put message to the consensus engine running on the specified chain on the specified node. The Put message signifies that this consensus engine is giving to the recipient the contents of the specified container.