sender

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: BSD-3-Clause Imports: 9 Imported by: 15

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 GetAcceptedFrontier message for chain [chainID] to validators in [validatorIDs].
	// The validator should reply by [deadline].
	// Returns the IDs of validators that may receive the message.
	// If we're not connected to a validator in [validatorIDs], for example,
	// it will not be included in the return value.
	GetAcceptedFrontier(validatorIDs ids.ShortSet, chainID ids.ID, requestID uint32, deadline time.Duration) []ids.ShortID
	AcceptedFrontier(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerIDs []ids.ID)

	GetAccepted(validatorIDs ids.ShortSet, chainID ids.ID, requestID uint32, deadline time.Duration, containerIDs []ids.ID) []ids.ShortID
	Accepted(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerIDs []ids.ID)

	// Request ancestors of container [containerID] in chain [chainID] from validator [validatorID].
	// The validator should reply by [deadline].
	// Returns true if the validator may receive the message.
	// If we're not connected to [validatorID], for example, returns false.
	GetAncestors(validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Duration, containerID ids.ID) bool
	MultiPut(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containers [][]byte)

	Get(validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Duration, containerID ids.ID) bool
	Put(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerID ids.ID, container []byte)

	PushQuery(validatorIDs ids.ShortSet, chainID ids.ID, requestID uint32, deadline time.Duration, containerID ids.ID, container []byte) []ids.ShortID
	PullQuery(validatorIDs ids.ShortSet, chainID ids.ID, requestID uint32, deadline time.Duration, containerID ids.ID) []ids.ShortID
	Chits(validatorID ids.ShortID, chainID ids.ID, requestID uint32, votes []ids.ID)

	Gossip(chainID ids.ID, containerID ids.ID, container []byte)
}

ExternalSender sends consensus messages to other validators Right now this is implemented in the networking package

type ExternalSenderTest

type ExternalSenderTest struct {
	T *testing.T
	B *testing.B

	CantGetAcceptedFrontier, CantAcceptedFrontier,
	CantGetAccepted, CantAccepted,
	CantGetAncestors, CantMultiPut,
	CantGet, CantPut,
	CantPullQuery, CantPushQuery, CantChits,
	CantGossip bool

	GetAcceptedFrontierF func(validatorIDs ids.ShortSet, chainID ids.ID, requestID uint32, deadline time.Duration) []ids.ShortID
	AcceptedFrontierF    func(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerIDs []ids.ID)

	GetAcceptedF func(validatorIDs ids.ShortSet, chainID ids.ID, requestID uint32, deadline time.Duration, containerIDs []ids.ID) []ids.ShortID
	AcceptedF    func(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerIDs []ids.ID)

	GetAncestorsF func(validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Duration, containerID ids.ID) bool
	MultiPutF     func(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containers [][]byte)

	GetF func(validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Duration, containerID ids.ID) bool
	PutF func(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerID ids.ID, container []byte)

	PushQueryF func(validatorIDs ids.ShortSet, chainID ids.ID, requestID uint32, deadline time.Duration, containerID ids.ID, container []byte) []ids.ShortID
	PullQueryF func(validatorIDs ids.ShortSet, chainID ids.ID, requestID uint32, deadline time.Duration, containerID ids.ID) []ids.ShortID
	ChitsF     func(validatorID ids.ShortID, chainID ids.ID, requestID uint32, votes []ids.ID)

	GossipF func(chainID ids.ID, containerID ids.ID, container []byte)
}

ExternalSenderTest is a test sender

func (*ExternalSenderTest) Accepted

func (s *ExternalSenderTest) Accepted(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerIDs []ids.ID)

Accepted calls AcceptedF 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) AcceptedFrontier

func (s *ExternalSenderTest) AcceptedFrontier(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerIDs []ids.ID)

AcceptedFrontier calls AcceptedFrontierF 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) Chits

func (s *ExternalSenderTest) Chits(vdr ids.ShortID, chainID ids.ID, requestID uint32, votes []ids.ID)

Chits calls ChitsF 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) Default

func (s *ExternalSenderTest) Default(cant bool)

Default set the default callable value to [cant]

func (*ExternalSenderTest) Get

func (s *ExternalSenderTest) Get(vdr ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Duration, vtxID ids.ID) bool

Get calls GetF 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) GetAccepted

func (s *ExternalSenderTest) GetAccepted(validatorIDs ids.ShortSet, chainID ids.ID, requestID uint32, deadline time.Duration, containerIDs []ids.ID) []ids.ShortID

GetAccepted calls GetAcceptedF 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) GetAcceptedFrontier

func (s *ExternalSenderTest) GetAcceptedFrontier(validatorIDs ids.ShortSet, chainID ids.ID, requestID uint32, deadline time.Duration) []ids.ShortID

GetAcceptedFrontier calls GetAcceptedFrontierF 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) GetAncestors added in v0.8.0

func (s *ExternalSenderTest) GetAncestors(vdr ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Duration, vtxID ids.ID) bool

GetAncestors calls GetAncestorsF 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) Gossip added in v0.8.0

func (s *ExternalSenderTest) Gossip(chainID ids.ID, containerID ids.ID, container []byte)

Gossip calls GossipF 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) MultiPut added in v0.8.0

func (s *ExternalSenderTest) MultiPut(vdr ids.ShortID, chainID ids.ID, requestID uint32, vtxs [][]byte)

MultiPut calls MultiPutF 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) PullQuery

func (s *ExternalSenderTest) PullQuery(vdrs ids.ShortSet, chainID ids.ID, requestID uint32, deadline time.Duration, vtxID ids.ID) []ids.ShortID

PullQuery calls PullQueryF 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) PushQuery

func (s *ExternalSenderTest) PushQuery(vdrs ids.ShortSet, chainID ids.ID, requestID uint32, deadline time.Duration, vtxID ids.ID, vtx []byte) []ids.ShortID

PushQuery calls PushQueryF 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) Put

func (s *ExternalSenderTest) Put(vdr ids.ShortID, chainID ids.ID, requestID uint32, vtxID ids.ID, vtx []byte)

Put calls PutF 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 Sender

type Sender struct {
	// contains filtered or unexported fields
}

Sender sends consensus messages to other validators

func (*Sender) Accepted

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

Accepted ...

func (*Sender) AcceptedFrontier

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

AcceptedFrontier ...

func (*Sender) Chits

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

Chits sends chits

func (*Sender) Context

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

Context of this sender

func (*Sender) Get

func (s *Sender) Get(validatorID ids.ShortID, requestID uint32, containerID ids.ID)

Get sends a Get message to the consensus engine running on the specified chain to the specified validator. The Get message signifies that this consensus engine would like the recipient to send this consensus engine the specified container.

func (*Sender) GetAccepted

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

GetAccepted ...

func (*Sender) GetAcceptedFrontier

func (s *Sender) GetAcceptedFrontier(validatorIDs ids.ShortSet, requestID uint32)

GetAcceptedFrontier ...

func (*Sender) GetAncestors added in v0.8.0

func (s *Sender) GetAncestors(validatorID ids.ShortID, requestID uint32, containerID ids.ID)

GetAncestors sends a GetAncestors message

func (*Sender) Gossip added in v0.8.0

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

Gossip the provided container

func (*Sender) Initialize

func (s *Sender) Initialize(
	ctx *snow.Context,
	sender ExternalSender,
	router router.Router,
	timeouts *timeout.Manager,
	metricsNamespace string,
	metricsRegisterer prometheus.Registerer,
) error

Initialize this sender

func (*Sender) MultiPut added in v0.8.0

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

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

func (*Sender) PullQuery

func (s *Sender) PullQuery(validatorIDs ids.ShortSet, requestID uint32, containerID ids.ID)

PullQuery sends a PullQuery message to the consensus engines running on the specified chains on the specified validators. The PullQuery message signifies that this consensus engine would like each validator to send their preferred frontier.

func (*Sender) PushQuery

func (s *Sender) PushQuery(validatorIDs ids.ShortSet, requestID uint32, containerID ids.ID, container []byte)

PushQuery sends a PushQuery message to the consensus engines running on the specified chains on the specified validators. The PushQuery message signifies that this consensus engine would like each validator to send their preferred frontier given the existence of the specified container.

func (*Sender) Put

func (s *Sender) Put(validatorID ids.ShortID, requestID uint32, containerID ids.ID, container []byte)

Put sends a Put message to the consensus engine running on the specified chain on the specified validator. 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