sender

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: BSD-3-Clause Imports: 11 Imported by: 0

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

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 v0.2.3

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.ConsensusContext

Context of this sender

func (*Sender) Initialize

func (s *Sender) Initialize(
	ctx *snow.ConsensusContext,
	msgCreator message.Creator,
	sender ExternalSender,
	router router.Router,
	timeouts *timeout.Manager,
	appGossipValidatorSize int,
	appGossipNonValidatorSize int,
	gossipAcceptedFrontierSize int,
) error

Initialize this sender

func (*Sender) SendAccepted added in v0.2.3

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

func (*Sender) SendAcceptedFrontier added in v0.2.3

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

func (*Sender) SendAncestors added in v0.5.1

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

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

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

SendAppGossip sends an application-level gossip message.

func (*Sender) SendAppGossipSpecific added in v0.2.3

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

func (*Sender) SendAppRequest added in v0.2.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 v0.2.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 v0.2.3

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

SendChits sends chits

func (*Sender) SendGet added in v0.2.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 v0.2.3

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

func (*Sender) SendGetAcceptedFrontier added in v0.2.3

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

func (*Sender) SendGetAncestors added in v0.2.3

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

func (*Sender) SendGossip added in v0.2.3

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

SendGossip gossips the provided container

func (*Sender) SendPullQuery added in v0.2.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 v0.2.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 v0.2.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