sender

package
v1.6.5-rc.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2021 License: BSD-3-Clause Imports: 11 Imported by: 12

Documentation

Index

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 added in v0.8.0

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.

func (*ExternalSenderTest) Send added in v1.6.4

func (s *ExternalSenderTest) Send(
	msg message.OutboundMessage,
	nodeIDs ids.ShortSet,
	subnetID ids.ID,
	validatorOnly bool,
) ids.ShortSet

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 (*Sender) Context

func (s *Sender) Context() *snow.Context

Context of this sender

func (*Sender) Initialize

func (s *Sender) Initialize(
	ctx *snow.Context,
	msgCreator message.Creator,
	sender ExternalSender,
	router router.Router,
	timeouts *timeout.Manager,
	metricsNamespace string,
	metricsRegisterer prometheus.Registerer,
	appGossipValidatorSize int,
	appGossipNonValidatorSize int,
	gossipAcceptedFrontierSize int,
) error

Initialize this sender

func (*Sender) SendAccepted added in v1.5.3

func (s *Sender) SendAccepted(nodeID ids.ShortID, requestID uint32, containerIDs []ids.ID)

func (*Sender) SendAcceptedFrontier added in v1.5.3

func (s *Sender) SendAcceptedFrontier(nodeID ids.ShortID, requestID uint32, containerIDs []ids.ID)

func (*Sender) SendAppGossip added in v1.5.3

func (s *Sender) SendAppGossip(appGossipBytes []byte) error

SendAppGossip sends an application-level gossip message.

func (*Sender) SendAppGossipSpecific added in v1.6.2

func (s *Sender) SendAppGossipSpecific(nodeIDs ids.ShortSet, appGossipBytes []byte) error

func (*Sender) SendAppRequest added in v1.5.3

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 added in v1.5.3

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) SendChits added in v1.5.3

func (s *Sender) SendChits(nodeID ids.ShortID, requestID uint32, votes []ids.ID)

SendChits sends chits

func (*Sender) SendGet added in v1.5.3

func (s *Sender) SendGet(nodeID ids.ShortID, requestID uint32, containerID ids.ID)

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 added in v1.5.3

func (s *Sender) SendGetAccepted(nodeIDs ids.ShortSet, requestID uint32, containerIDs []ids.ID)

func (*Sender) SendGetAcceptedFrontier added in v1.5.3

func (s *Sender) SendGetAcceptedFrontier(nodeIDs ids.ShortSet, requestID uint32)

func (*Sender) SendGetAncestors added in v1.5.3

func (s *Sender) SendGetAncestors(nodeID ids.ShortID, requestID uint32, containerID ids.ID)

func (*Sender) SendGossip added in v1.5.3

func (s *Sender) SendGossip(containerID ids.ID, container []byte)

SendGossip gossips the provided container

func (*Sender) SendMultiPut added in v1.5.3

func (s *Sender) SendMultiPut(nodeID ids.ShortID, requestID uint32, containers [][]byte)

SendMultiPut sends a MultiPut message to the consensus engine running on the specified chain on the specified node. The MultiPut message gives the recipient the contents of several containers.

func (*Sender) SendPullQuery added in v1.5.3

func (s *Sender) SendPullQuery(nodeIDs ids.ShortSet, requestID uint32, containerID ids.ID)

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 added in v1.5.3

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 added in v1.5.3

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL