router

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainRouter

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

ChainRouter routes incoming messages from the validator network to the consensus engines that the messages are intended for. Note that consensus engines are uniquely identified by the ID of the chain that they are working on.

func (*ChainRouter) Accepted

func (sr *ChainRouter) Accepted(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerIDs ids.Set)

Accepted routes an incoming Accepted request from the validator with ID [validatorID] to the consensus engine working on the chain with ID [chainID]

func (*ChainRouter) AcceptedFrontier

func (sr *ChainRouter) AcceptedFrontier(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerIDs ids.Set)

AcceptedFrontier routes an incoming AcceptedFrontier request from the validator with ID [validatorID] to the consensus engine working on the chain with ID [chainID]

func (*ChainRouter) AddChain

func (sr *ChainRouter) AddChain(chain *Handler)

AddChain registers the specified chain so that incoming messages can be routed to it

func (*ChainRouter) Chits

func (sr *ChainRouter) Chits(validatorID ids.ShortID, chainID ids.ID, requestID uint32, votes ids.Set)

Chits routes an incoming Chits message from the validator with ID [validatorID] to the consensus engine working on the chain with ID [chainID]

func (*ChainRouter) Get

func (sr *ChainRouter) Get(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerID ids.ID)

Get routes an incoming Get request from the validator with ID [validatorID] to the consensus engine working on the chain with ID [chainID]

func (*ChainRouter) GetAccepted

func (sr *ChainRouter) GetAccepted(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerIDs ids.Set)

GetAccepted routes an incoming GetAccepted request from the validator with ID [validatorID] to the consensus engine working on the chain with ID [chainID]

func (*ChainRouter) GetAcceptedFailed

func (sr *ChainRouter) GetAcceptedFailed(validatorID ids.ShortID, chainID ids.ID, requestID uint32)

GetAcceptedFailed routes an incoming GetAcceptedFailed request from the validator with ID [validatorID] to the consensus engine working on the chain with ID [chainID]

func (*ChainRouter) GetAcceptedFrontier

func (sr *ChainRouter) GetAcceptedFrontier(validatorID ids.ShortID, chainID ids.ID, requestID uint32)

GetAcceptedFrontier routes an incoming GetAcceptedFrontier request from the validator with ID [validatorID] to the consensus engine working on the chain with ID [chainID]

func (*ChainRouter) GetAcceptedFrontierFailed

func (sr *ChainRouter) GetAcceptedFrontierFailed(validatorID ids.ShortID, chainID ids.ID, requestID uint32)

GetAcceptedFrontierFailed routes an incoming GetAcceptedFrontierFailed request from the validator with ID [validatorID] to the consensus engine working on the chain with ID [chainID]

func (*ChainRouter) GetAncestors added in v0.5.3

func (sr *ChainRouter) GetAncestors(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerID ids.ID)

GetAncestors routes an incoming GetAncestors message from the validator with ID [validatorID] to the consensus engine working on the chain with ID [chainID] The maximum number of ancestors to respond with is define in snow/engine/commong/bootstrapper.go

func (*ChainRouter) GetAncestorsFailed added in v0.5.3

func (sr *ChainRouter) GetAncestorsFailed(validatorID ids.ShortID, chainID ids.ID, requestID uint32)

GetAncestorsFailed routes an incoming GetAncestorsFailed message from the validator with ID [validatorID] to the consensus engine working on the chain with ID [chainID]

func (*ChainRouter) GetFailed

func (sr *ChainRouter) GetFailed(validatorID ids.ShortID, chainID ids.ID, requestID uint32)

GetFailed routes an incoming GetFailed message from the validator with ID [validatorID] to the consensus engine working on the chain with ID [chainID]

func (*ChainRouter) Gossip added in v0.5.0

func (sr *ChainRouter) Gossip()

Gossip accepted containers

func (*ChainRouter) Initialize

func (sr *ChainRouter) Initialize(
	log logging.Logger,
	timeouts *timeout.Manager,
	gossipFrequency time.Duration,
	closeTimeout time.Duration,
)

Initialize the router.

When this router receives an incoming message, it cancels the timeout in [timeouts] associated with the request that caused the incoming message, if applicable.

This router also fires a gossip event every [gossipFrequency] to the engine, notifying the engine it should gossip it's accepted set.

func (*ChainRouter) MultiPut added in v0.5.3

func (sr *ChainRouter) MultiPut(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containers [][]byte)

MultiPut routes an incoming MultiPut message from the validator with ID [validatorID] to the consensus engine working on the chain with ID [chainID]

func (*ChainRouter) PullQuery

func (sr *ChainRouter) PullQuery(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerID ids.ID)

PullQuery routes an incoming PullQuery request from the validator with ID [validatorID] to the consensus engine working on the chain with ID [chainID]

func (*ChainRouter) PushQuery

func (sr *ChainRouter) PushQuery(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerID ids.ID, container []byte)

PushQuery routes an incoming PushQuery request from the validator with ID [validatorID] to the consensus engine working on the chain with ID [chainID]

func (*ChainRouter) Put

func (sr *ChainRouter) Put(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerID ids.ID, container []byte)

Put routes an incoming Put request from the validator with ID [validatorID] to the consensus engine working on the chain with ID [chainID]

func (*ChainRouter) QueryFailed

func (sr *ChainRouter) QueryFailed(validatorID ids.ShortID, chainID ids.ID, requestID uint32)

QueryFailed routes an incoming QueryFailed message from the validator with ID [validatorID] to the consensus engine working on the chain with ID [chainID]

func (*ChainRouter) RemoveChain

func (sr *ChainRouter) RemoveChain(chainID ids.ID)

RemoveChain removes the specified chain so that incoming messages can't be routed to it

func (*ChainRouter) Shutdown

func (sr *ChainRouter) Shutdown()

Shutdown shuts down this router

type ExternalRouter

type ExternalRouter interface {
	GetAcceptedFrontier(validatorID ids.ShortID, chainID ids.ID, requestID uint32)
	AcceptedFrontier(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerIDs ids.Set)
	GetAccepted(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerIDs ids.Set)
	Accepted(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerIDs ids.Set)
	Get(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerID ids.ID)
	GetAncestors(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerID ids.ID)
	Put(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerID ids.ID, container []byte)
	MultiPut(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containers [][]byte)
	PushQuery(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerID ids.ID, container []byte)
	PullQuery(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerID ids.ID)
	Chits(validatorID ids.ShortID, chainID ids.ID, requestID uint32, votes ids.Set)
}

ExternalRouter routes messages from the network to the Handler of the consensus engine that the message is intended for

type Handler added in v0.5.0

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

Handler passes incoming messages from the network to the consensus engine (Actually, it receives the incoming messages from a ChainRouter, but same difference)

func (*Handler) Accepted added in v0.5.0

func (h *Handler) Accepted(validatorID ids.ShortID, requestID uint32, containerIDs ids.Set) bool

Accepted passes a Accepted message received from the network to the consensus engine.

func (*Handler) AcceptedFrontier added in v0.5.0

func (h *Handler) AcceptedFrontier(validatorID ids.ShortID, requestID uint32, containerIDs ids.Set) bool

AcceptedFrontier passes a AcceptedFrontier message received from the network to the consensus engine.

func (*Handler) Chits added in v0.5.0

func (h *Handler) Chits(validatorID ids.ShortID, requestID uint32, votes ids.Set) bool

Chits passes a Chits message received from the network to the consensus engine.

func (*Handler) Context added in v0.5.0

func (h *Handler) Context() *snow.Context

Context of this Handler

func (*Handler) Dispatch added in v0.5.0

func (h *Handler) Dispatch()

Dispatch waits for incoming messages from the network and, when they arrive, sends them to the consensus engine

func (*Handler) Get added in v0.5.0

func (h *Handler) Get(validatorID ids.ShortID, requestID uint32, containerID ids.ID) bool

Get passes a Get message received from the network to the consensus engine.

func (*Handler) GetAccepted added in v0.5.0

func (h *Handler) GetAccepted(validatorID ids.ShortID, requestID uint32, containerIDs ids.Set) bool

GetAccepted passes a GetAccepted message received from the network to the consensus engine.

func (*Handler) GetAcceptedFailed added in v0.5.0

func (h *Handler) GetAcceptedFailed(validatorID ids.ShortID, requestID uint32) bool

GetAcceptedFailed passes a GetAcceptedFailed message received from the network to the consensus engine.

func (*Handler) GetAcceptedFrontier added in v0.5.0

func (h *Handler) GetAcceptedFrontier(validatorID ids.ShortID, requestID uint32) bool

GetAcceptedFrontier passes a GetAcceptedFrontier message received from the network to the consensus engine.

func (*Handler) GetAcceptedFrontierFailed added in v0.5.0

func (h *Handler) GetAcceptedFrontierFailed(validatorID ids.ShortID, requestID uint32) bool

GetAcceptedFrontierFailed passes a GetAcceptedFrontierFailed message received from the network to the consensus engine.

func (*Handler) GetAncestors added in v0.5.3

func (h *Handler) GetAncestors(validatorID ids.ShortID, requestID uint32, containerID ids.ID) bool

GetAncestors passes a GetAncestors message received from the network to the consensus engine.

func (*Handler) GetAncestorsFailed added in v0.5.3

func (h *Handler) GetAncestorsFailed(validatorID ids.ShortID, requestID uint32) bool

GetAncestorsFailed passes a GetAncestorsFailed message to the consensus engine.

func (*Handler) GetFailed added in v0.5.0

func (h *Handler) GetFailed(validatorID ids.ShortID, requestID uint32) bool

GetFailed passes a GetFailed message to the consensus engine.

func (*Handler) Gossip added in v0.5.0

func (h *Handler) Gossip() bool

Gossip passes a gossip request to the consensus engine

func (*Handler) Initialize added in v0.5.0

func (h *Handler) Initialize(
	engine common.Engine,
	msgChan <-chan common.Message,
	bufferSize int,
	namespace string,
	metrics prometheus.Registerer,
)

Initialize this consensus handler

func (*Handler) MultiPut added in v0.5.3

func (h *Handler) MultiPut(validatorID ids.ShortID, requestID uint32, containers [][]byte) bool

MultiPut passes a MultiPut message received from the network to the consensus engine.

func (*Handler) Notify added in v0.5.0

func (h *Handler) Notify(msg common.Message) bool

Notify ...

func (*Handler) PullQuery added in v0.5.0

func (h *Handler) PullQuery(validatorID ids.ShortID, requestID uint32, blockID ids.ID) bool

PullQuery passes a PullQuery message received from the network to the consensus engine.

func (*Handler) PushQuery added in v0.5.0

func (h *Handler) PushQuery(validatorID ids.ShortID, requestID uint32, blockID ids.ID, block []byte) bool

PushQuery passes a PushQuery message received from the network to the consensus engine.

func (*Handler) Put added in v0.5.0

func (h *Handler) Put(validatorID ids.ShortID, requestID uint32, containerID ids.ID, container []byte) bool

Put passes a Put message received from the network to the consensus engine.

func (*Handler) QueryFailed added in v0.5.0

func (h *Handler) QueryFailed(validatorID ids.ShortID, requestID uint32) bool

QueryFailed passes a QueryFailed message received from the network to the consensus engine.

func (*Handler) Shutdown added in v0.5.0

func (h *Handler) Shutdown()

Shutdown shuts down the dispatcher

type InternalRouter

type InternalRouter interface {
	GetAcceptedFrontierFailed(validatorID ids.ShortID, chainID ids.ID, requestID uint32)
	GetAcceptedFailed(validatorID ids.ShortID, chainID ids.ID, requestID uint32)
	GetFailed(validatorID ids.ShortID, chainID ids.ID, requestID uint32)
	GetAncestorsFailed(validatorID ids.ShortID, chainID ids.ID, requestID uint32)
	QueryFailed(validatorID ids.ShortID, chainID ids.ID, requestID uint32)
}

InternalRouter deals with messages internal to this node

type Router

type Router interface {
	ExternalRouter
	InternalRouter

	AddChain(chain *Handler)
	RemoveChain(chainID ids.ID)
	Shutdown()
	Initialize(
		log logging.Logger,
		timeouts *timeout.Manager,
		gossipFrequency,
		shutdownTimeout time.Duration,
	)
}

Router routes consensus messages to the Handler of the consensus engine that the messages are intended for

Jump to

Keyboard shortcuts

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