Documentation ¶
Index ¶
- type ChainRouter
- func (cr *ChainRouter) AddChain(chain *Handler)
- func (cr *ChainRouter) Benched(chainID ids.ID, validatorID ids.ShortID)
- func (cr *ChainRouter) Connected(validatorID ids.ShortID, nodeVersion version.Application)
- func (cr *ChainRouter) Disconnected(validatorID ids.ShortID)
- func (cr *ChainRouter) EndInterval()
- func (cr *ChainRouter) Gossip()
- func (cr *ChainRouter) HandleInbound(msg message.InboundMessage)
- func (cr *ChainRouter) HealthCheck() (interface{}, error)
- func (cr *ChainRouter) Initialize(nodeID ids.ShortID, log logging.Logger, msgCreator message.Creator, ...) error
- func (cr *ChainRouter) RegisterRequest(nodeID ids.ShortID, chainID ids.ID, requestID uint32, op message.Op)
- func (cr *ChainRouter) Shutdown()
- func (cr *ChainRouter) Unbenched(chainID ids.ID, validatorID ids.ShortID)
- type ExternalRouter
- type Handler
- func (h *Handler) Context() *snow.ConsensusContext
- func (h *Handler) Dispatch()
- func (h *Handler) Engine() common.Engine
- func (h *Handler) Gossip()
- func (h *Handler) Initialize(mc message.Creator, engine common.Engine, validators validators.Set, ...) error
- func (h *Handler) Push(msg message.InboundMessage)
- func (h *Handler) SetEngine(engine common.Engine)
- func (h *Handler) StartShutdown()
- func (h *Handler) Timeout()
- type HealthConfig
- type InternalRouter
- type Router
- type Timer
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) AddChain ¶
func (cr *ChainRouter) AddChain(chain *Handler)
AddChain registers the specified chain so that incoming messages can be routed to it
func (*ChainRouter) Benched ¶ added in v1.4.3
func (cr *ChainRouter) Benched(chainID ids.ID, validatorID ids.ShortID)
Benched routes an incoming notification that a validator was benched
func (*ChainRouter) Connected ¶ added in v0.8.2
func (cr *ChainRouter) Connected(validatorID ids.ShortID, nodeVersion version.Application)
Connected routes an incoming notification that a validator was just connected
func (*ChainRouter) Disconnected ¶ added in v0.8.2
func (cr *ChainRouter) Disconnected(validatorID ids.ShortID)
Disconnected routes an incoming notification that a validator was connected
func (*ChainRouter) EndInterval ¶ added in v0.8.0
func (cr *ChainRouter) EndInterval()
EndInterval notifies the chains that the current CPU interval has ended TODO remove?
func (*ChainRouter) Gossip ¶ added in v0.8.0
func (cr *ChainRouter) Gossip()
Gossip accepted containers
func (*ChainRouter) HandleInbound ¶ added in v1.6.4
func (cr *ChainRouter) HandleInbound(msg message.InboundMessage)
func (*ChainRouter) HealthCheck ¶ added in v1.2.1
func (cr *ChainRouter) HealthCheck() (interface{}, error)
HealthCheck returns results of router health checks. Returns: 1) Information about health check results 2) An error if the health check reports unhealthy
func (*ChainRouter) Initialize ¶
func (cr *ChainRouter) Initialize( nodeID ids.ShortID, log logging.Logger, msgCreator message.Creator, timeoutManager *timeout.Manager, gossipFrequency time.Duration, closeTimeout time.Duration, criticalChains ids.Set, onFatal func(exitCode int), healthConfig HealthConfig, metricsNamespace string, metricsRegisterer prometheus.Registerer, ) error
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) RegisterRequest ¶ added in v1.2.1
func (cr *ChainRouter) RegisterRequest( nodeID ids.ShortID, chainID ids.ID, requestID uint32, op message.Op, )
RegisterRequest marks that we should expect to receive a reply from the given validator regarding the given chain and the reply should have the given requestID. The type of message we expect is [op]. Every registered request must be cleared either by receiving a valid reply and passing it to the appropriate chain or by a timeout. This method registers a timeout that calls such methods if we don't get a reply in time.
type ExternalRouter ¶
type ExternalRouter interface { HandleInbound(msg message.InboundMessage) RegisterRequest( nodeID ids.ShortID, chainID ids.ID, requestID uint32, op message.Op, ) }
ExternalRouter routes messages from the network to the Handler of the consensus engine that the message is intended for
type Handler ¶ added in v0.8.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) Context ¶ added in v0.8.0
func (h *Handler) Context() *snow.ConsensusContext
Context of this Handler
func (*Handler) Dispatch ¶ added in v0.8.0
func (h *Handler) Dispatch()
Dispatch waits for incoming messages from the router and, when they arrive, sends them to the consensus engine
func (*Handler) Gossip ¶ added in v0.8.0
func (h *Handler) Gossip()
Gossip passes a gossip request to the consensus engine
func (*Handler) Initialize ¶ added in v0.8.0
func (h *Handler) Initialize( mc message.Creator, engine common.Engine, validators validators.Set, msgFromVMChan <-chan common.Message, ) error
Initialize this consensus handler [engine] must be initialized before initializing this handler
func (*Handler) Push ¶ added in v1.6.4
func (h *Handler) Push(msg message.InboundMessage)
Push the message onto the handler's queue
func (*Handler) SetEngine ¶ added in v0.8.0
SetEngine sets the engine for this handler to dispatch to
func (*Handler) StartShutdown ¶ added in v1.4.10
func (h *Handler) StartShutdown()
StartShutdown starts the shutdown process for this handler/engine. [h] must never be invoked again after calling this method. This method causes [shutdown] to eventually be called. [h.closed] is closed when this handler/engine are done shutting down.
type HealthConfig ¶ added in v1.2.1
type HealthConfig struct { // Reports unhealthy if we drop more than [MaxDropRate] of messages MaxDropRate float64 `json:"maxDropRate"` // Halflife of averager used to calculate the message drop rate // Must be > 0. // Larger value --> Drop rate affected less by recent messages MaxDropRateHalflife time.Duration `json:"maxDropRateHalflife"` // Reports unhealthy if more than this number of requests are outstanding. // Must be > 0 MaxOutstandingRequests int `json:"maxOutstandingRequests"` // Reports unhealthy if there is a request outstanding for longer than this MaxOutstandingDuration time.Duration `json:"maxOutstandingDuration"` // Reports unhealthy if there is at least 1 outstanding not processed // before this mark MaxRunTimeRequests time.Duration `json:"maxRunTimeRequests"` }
HealthConfig describes parameters for router health checks.
type InternalRouter ¶
type InternalRouter interface { benchlist.Benchable Connected(nodeID ids.ShortID, nodeVersion version.Application) Disconnected(nodeID ids.ShortID) }
InternalRouter deals with messages internal to this node
type Router ¶
type Router interface { ExternalRouter InternalRouter Initialize( nodeID ids.ShortID, log logging.Logger, msgCreator message.Creator, timeouts *timeout.Manager, gossipFrequency, shutdownTimeout time.Duration, criticalChains ids.Set, onFatal func(exitCode int), healthConfig HealthConfig, metricsNamespace string, metricsRegisterer prometheus.Registerer, ) error Shutdown() AddChain(chain *Handler) health.Checkable }
Router routes consensus messages to the Handler of the consensus engine that the messages are intended for