Documentation ¶
Index ¶
- type ChainRouter
- func (cr *ChainRouter) AddChain(chain handler.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) 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 ExternalHandler
- type HealthConfig
- type InboundHandler
- type InboundHandlerFunc
- type InternalHandler
- type Router
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.Handler)
AddChain registers the specified chain so that incoming messages can be routed to it
func (*ChainRouter) Benched ¶
func (cr *ChainRouter) Benched(chainID ids.ID, validatorID ids.ShortID)
Benched routes an incoming notification that a validator was benched
func (*ChainRouter) Connected ¶
func (cr *ChainRouter) Connected(validatorID ids.ShortID, nodeVersion version.Application)
Connected routes an incoming notification that a validator was just connected
func (*ChainRouter) Disconnected ¶
func (cr *ChainRouter) Disconnected(validatorID ids.ShortID)
Disconnected routes an incoming notification that a validator was connected
func (*ChainRouter) HandleInbound ¶
func (cr *ChainRouter) HandleInbound(msg message.InboundMessage)
func (*ChainRouter) HealthCheck ¶
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, 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.
func (*ChainRouter) RegisterRequest ¶
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 ExternalHandler ¶
type ExternalHandler interface { InboundHandler Connected(nodeID ids.ShortID, nodeVersion version.Application) Disconnected(nodeID ids.ShortID) }
ExternalHandler handles messages from external parties
type HealthConfig ¶
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 InboundHandler ¶
type InboundHandler interface {
HandleInbound(msg message.InboundMessage)
}
InboundHandler handles inbound messages
type InboundHandlerFunc ¶
type InboundHandlerFunc func(msg message.InboundMessage)
The ExternalRouterFunc type is an adapter to allow the use of ordinary functions as ExternalRouters. If f is a function with the appropriate signature, ExternalRouterFunc(f) is an ExternalRouter that calls f.
func (InboundHandlerFunc) HandleInbound ¶
func (f InboundHandlerFunc) HandleInbound(msg message.InboundMessage)
type InternalHandler ¶
type InternalHandler interface { benchlist.Benchable RegisterRequest( nodeID ids.ShortID, chainID ids.ID, requestID uint32, op message.Op, ) }
InternalHandler deals with messages internal to this node
type Router ¶
type Router interface { ExternalHandler InternalHandler Initialize( nodeID ids.ShortID, log logging.Logger, msgCreator message.Creator, timeouts *timeout.Manager, shutdownTimeout time.Duration, criticalChains ids.Set, onFatal func(exitCode int), healthConfig HealthConfig, metricsNamespace string, metricsRegisterer prometheus.Registerer, ) error Shutdown() AddChain(chain handler.Handler) health.Checker }
Router routes consensus messages to the Handler of the consensus engine that the messages are intended for