Documentation ¶
Index ¶
- type ChainRouter
- func (cr *ChainRouter) Accepted(validatorID ids.ShortID, chainID ids.ID, requestID uint32, ...)
- func (cr *ChainRouter) AcceptedFrontier(validatorID ids.ShortID, chainID ids.ID, requestID uint32, ...)
- func (cr *ChainRouter) AddChain(chain *Handler)
- func (cr *ChainRouter) Benched(chainID ids.ID, validatorID ids.ShortID)
- func (cr *ChainRouter) Chits(validatorID ids.ShortID, chainID ids.ID, requestID uint32, votes []ids.ID, ...)
- func (cr *ChainRouter) Connected(validatorID ids.ShortID)
- func (cr *ChainRouter) Disconnected(validatorID ids.ShortID)
- func (cr *ChainRouter) EndInterval()
- func (cr *ChainRouter) Get(validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Time, ...)
- func (cr *ChainRouter) GetAccepted(validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Time, ...)
- func (cr *ChainRouter) GetAcceptedFailed(validatorID ids.ShortID, chainID ids.ID, requestID uint32)
- func (cr *ChainRouter) GetAcceptedFrontier(validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Time, ...)
- func (cr *ChainRouter) GetAcceptedFrontierFailed(validatorID ids.ShortID, chainID ids.ID, requestID uint32)
- func (cr *ChainRouter) GetAncestors(validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Time, ...)
- func (cr *ChainRouter) GetAncestorsFailed(validatorID ids.ShortID, chainID ids.ID, requestID uint32)
- func (cr *ChainRouter) GetFailed(validatorID ids.ShortID, chainID ids.ID, requestID uint32)
- func (cr *ChainRouter) Gossip()
- func (cr *ChainRouter) HealthCheck() (interface{}, error)
- func (cr *ChainRouter) Initialize(nodeID ids.ShortID, log logging.Logger, timeoutManager *timeout.Manager, ...) error
- func (cr *ChainRouter) MultiPut(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containers [][]byte, ...)
- func (cr *ChainRouter) PullQuery(validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Time, ...)
- func (cr *ChainRouter) PushQuery(validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Time, ...)
- func (cr *ChainRouter) Put(validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerID ids.ID, ...)
- func (cr *ChainRouter) QueryFailed(validatorID ids.ShortID, chainID ids.ID, requestID uint32)
- func (cr *ChainRouter) RegisterRequest(validatorID ids.ShortID, chainID ids.ID, requestID uint32, ...)
- func (cr *ChainRouter) Shutdown()
- func (cr *ChainRouter) Unbenched(chainID ids.ID, validatorID ids.ShortID)
- type ExternalRouter
- type Handler
- func (h *Handler) Accepted(nodeID ids.ShortID, requestID uint32, containerIDs []ids.ID, ...)
- func (h *Handler) AcceptedFrontier(nodeID ids.ShortID, requestID uint32, containerIDs []ids.ID, ...)
- func (h *Handler) Chits(nodeID ids.ShortID, requestID uint32, votes []ids.ID, onDoneHandling func())
- func (h *Handler) Connected(nodeID ids.ShortID)
- func (h *Handler) Context() *snow.Context
- func (h *Handler) Disconnected(nodeID ids.ShortID)
- func (h *Handler) Dispatch()
- func (h *Handler) Engine() common.Engine
- func (h *Handler) Get(nodeID ids.ShortID, requestID uint32, deadline time.Time, containerID ids.ID, ...)
- func (h *Handler) GetAccepted(nodeID ids.ShortID, requestID uint32, deadline time.Time, ...)
- func (h *Handler) GetAcceptedFailed(nodeID ids.ShortID, requestID uint32)
- func (h *Handler) GetAcceptedFrontier(nodeID ids.ShortID, requestID uint32, deadline time.Time, ...)
- func (h *Handler) GetAcceptedFrontierFailed(nodeID ids.ShortID, requestID uint32)
- func (h *Handler) GetAncestors(nodeID ids.ShortID, requestID uint32, deadline time.Time, containerID ids.ID, ...)
- func (h *Handler) GetAncestorsFailed(nodeID ids.ShortID, requestID uint32)
- func (h *Handler) GetFailed(nodeID ids.ShortID, requestID uint32)
- func (h *Handler) Gossip()
- func (h *Handler) Initialize(engine common.Engine, validators validators.Set, ...) error
- func (h *Handler) MultiPut(nodeID ids.ShortID, requestID uint32, containers [][]byte, ...)
- func (h *Handler) PullQuery(nodeID ids.ShortID, requestID uint32, deadline time.Time, containerID ids.ID, ...)
- func (h *Handler) PushQuery(nodeID ids.ShortID, requestID uint32, deadline time.Time, containerID ids.ID, ...)
- func (h *Handler) Put(nodeID ids.ShortID, requestID uint32, containerID ids.ID, container []byte, ...)
- func (h *Handler) QueryFailed(nodeID ids.ShortID, requestID uint32)
- 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) Accepted ¶
func (cr *ChainRouter) Accepted( validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerIDs []ids.ID, onFinishedHandling func(), )
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 (cr *ChainRouter) AcceptedFrontier( validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerIDs []ids.ID, onFinishedHandling func(), )
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 (cr *ChainRouter) AddChain(chain *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) Chits ¶
func (cr *ChainRouter) Chits( validatorID ids.ShortID, chainID ids.ID, requestID uint32, votes []ids.ID, onFinishedHandling func(), )
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) Connected ¶
func (cr *ChainRouter) Connected(validatorID ids.ShortID)
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) EndInterval ¶
func (cr *ChainRouter) EndInterval()
EndInterval notifies the chains that the current CPU interval has ended TODO remove?
func (*ChainRouter) Get ¶
func (cr *ChainRouter) Get( validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Time, containerID ids.ID, onFinishedHandling func(), )
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 (cr *ChainRouter) GetAccepted( validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Time, containerIDs []ids.ID, onFinishedHandling func(), )
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 (cr *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 (cr *ChainRouter) GetAcceptedFrontier( validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Time, onFinishedHandling func(), )
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 (cr *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 ¶
func (cr *ChainRouter) GetAncestors( validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Time, containerID ids.ID, onFinishedHandling func(), )
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 defined in snow/engine/commong/bootstrapper.go
func (*ChainRouter) GetAncestorsFailed ¶
func (cr *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 ¶
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) 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, 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) MultiPut ¶
func (cr *ChainRouter) MultiPut( validatorID ids.ShortID, chainID ids.ID, requestID uint32, containers [][]byte, onFinishedHandling func(), )
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 (cr *ChainRouter) PullQuery( validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Time, containerID ids.ID, onFinishedHandling func(), )
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 (cr *ChainRouter) PushQuery( validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Time, containerID ids.ID, container []byte, onFinishedHandling func(), )
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 (cr *ChainRouter) Put( validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerID ids.ID, container []byte, onFinishedHandling func(), )
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 ¶
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) RegisterRequest ¶
func (cr *ChainRouter) RegisterRequest( validatorID ids.ShortID, chainID ids.ID, requestID uint32, msgType constants.MsgType, )
RegisterRequests 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 sent the validator was [msgType]. Every registered request must be cleared either by receiving a valid reply and passing it to the appropriate chain or by a call to GetFailed, GetAncestorsFailed, etc. This method registers a timeout that calls such methods if we don't get a reply in time.
type ExternalRouter ¶
type ExternalRouter interface { RegisterRequest( validatorID ids.ShortID, chainID ids.ID, requestID uint32, msgType constants.MsgType, ) GetAcceptedFrontier( validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Time, onFinishedHandling func(), ) AcceptedFrontier( validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerIDs []ids.ID, onFinishedHandling func(), ) GetAccepted( validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Time, containerIDs []ids.ID, onFinishedHandling func(), ) Accepted( validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerIDs []ids.ID, onFinishedHandling func(), ) GetAncestors( validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Time, containerID ids.ID, onFinishedHandling func(), ) MultiPut( validatorID ids.ShortID, chainID ids.ID, requestID uint32, containers [][]byte, onFinishedHandling func(), ) Get( validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Time, containerID ids.ID, onFinishedHandling func(), ) Put( validatorID ids.ShortID, chainID ids.ID, requestID uint32, containerID ids.ID, container []byte, onFinishedHandling func(), ) PushQuery( validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Time, containerID ids.ID, container []byte, onFinishedHandling func(), ) PullQuery( validatorID ids.ShortID, chainID ids.ID, requestID uint32, deadline time.Time, containerID ids.ID, onFinishedHandling func(), ) Chits( validatorID ids.ShortID, chainID ids.ID, requestID uint32, votes []ids.ID, onFinishedHandling func(), ) }
ExternalRouter routes messages from the network to the Handler of the consensus engine that the message is intended for
type Handler ¶
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 ¶
func (h *Handler) Accepted( nodeID ids.ShortID, requestID uint32, containerIDs []ids.ID, onDoneHandling func(), )
Accepted passes a Accepted message received from the network to the consensus engine.
func (*Handler) AcceptedFrontier ¶
func (h *Handler) AcceptedFrontier( nodeID ids.ShortID, requestID uint32, containerIDs []ids.ID, onDoneHandling func(), )
AcceptedFrontier passes a AcceptedFrontier message received from the network to the consensus engine.
func (*Handler) Chits ¶
func (h *Handler) Chits(nodeID ids.ShortID, requestID uint32, votes []ids.ID, onDoneHandling func())
Chits passes a Chits message received from the network to the consensus engine.
func (*Handler) Disconnected ¶
Disconnected passes a new connection notification to the consensus engine
func (*Handler) Dispatch ¶
func (h *Handler) Dispatch()
Dispatch waits for incoming messages from the router and, when they arrive, sends them to the consensus engine
func (*Handler) Get ¶
func (h *Handler) Get( nodeID ids.ShortID, requestID uint32, deadline time.Time, containerID ids.ID, onDoneHandling func(), )
Get passes a Get message received from the network to the consensus engine.
func (*Handler) GetAccepted ¶
func (h *Handler) GetAccepted( nodeID ids.ShortID, requestID uint32, deadline time.Time, containerIDs []ids.ID, onDoneHandling func(), )
GetAccepted passes a GetAccepted message received from the network to the consensus engine.
func (*Handler) GetAcceptedFailed ¶
GetAcceptedFailed passes a GetAcceptedFailed message received from the network to the consensus engine.
func (*Handler) GetAcceptedFrontier ¶
func (h *Handler) GetAcceptedFrontier( nodeID ids.ShortID, requestID uint32, deadline time.Time, onDoneHandling func(), )
GetAcceptedFrontier passes a GetAcceptedFrontier message received from the network to the consensus engine.
func (*Handler) GetAcceptedFrontierFailed ¶
GetAcceptedFrontierFailed passes a GetAcceptedFrontierFailed message received from the network to the consensus engine.
func (*Handler) GetAncestors ¶
func (h *Handler) GetAncestors( nodeID ids.ShortID, requestID uint32, deadline time.Time, containerID ids.ID, onDoneHandling func(), )
GetAncestors passes a GetAncestors message received from the network to the consensus engine.
func (*Handler) GetAncestorsFailed ¶
GetAncestorsFailed passes a GetAncestorsFailed message to the consensus engine.
func (*Handler) Gossip ¶
func (h *Handler) Gossip()
Gossip passes a gossip request to the consensus engine
func (*Handler) Initialize ¶
func (h *Handler) Initialize( engine common.Engine, validators validators.Set, msgFromVMChan <-chan common.Message, metricsNamespace string, metricsRegisterer prometheus.Registerer, ) error
Initialize this consensus handler [engine] must be initialized before initializing this handler
func (*Handler) MultiPut ¶
func (h *Handler) MultiPut( nodeID ids.ShortID, requestID uint32, containers [][]byte, onDoneHandling func(), )
MultiPut passes a MultiPut message received from the network to the consensus engine.
func (*Handler) PullQuery ¶
func (h *Handler) PullQuery( nodeID ids.ShortID, requestID uint32, deadline time.Time, containerID ids.ID, onDoneHandling func(), )
PullQuery passes a PullQuery message received from the network to the consensus engine.
func (*Handler) PushQuery ¶
func (h *Handler) PushQuery( nodeID ids.ShortID, requestID uint32, deadline time.Time, containerID ids.ID, container []byte, onDoneHandling func(), )
PushQuery passes a PushQuery message received from the network to the consensus engine.
func (*Handler) Put ¶
func (h *Handler) Put( nodeID ids.ShortID, requestID uint32, containerID ids.ID, container []byte, onDoneHandling func(), )
Put passes a Put message received from the network to the consensus engine.
func (*Handler) QueryFailed ¶
QueryFailed passes a QueryFailed message received from the network to the consensus engine.
func (*Handler) StartShutdown ¶
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 ¶
type HealthConfig struct { // Reports unhealthy if we drop more than [MaxDropRate] of messages MaxDropRate float64 // 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 // Reports unhealthy if more than this number of requests are outstanding. // Must be > 0 MaxOutstandingRequests int // Reports unhealthy if there is a request outstanding for longer than this MaxOutstandingDuration time.Duration // Reports unhealthy if there is at least 1 outstanding not processed // before this mark MaxRunTimeRequests time.Duration }
HealthConfig describes parameters for router health checks.
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) Connected(validatorID ids.ShortID) Disconnected(validatorID ids.ShortID) benchlist.Benchable }
InternalRouter deals with messages internal to this node
type Router ¶
type Router interface { ExternalRouter InternalRouter Initialize( nodeID ids.ShortID, log logging.Logger, 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