Documentation ¶
Overview ¶
Package handler is a generated GoMock package.
Index ¶
- Variables
- type Engine
- type EngineManager
- type Handler
- type Message
- type MessageQueue
- type MockHandler
- func (m *MockHandler) AwaitStopped(arg0 context.Context) (time.Duration, error)
- func (m *MockHandler) Context() *snow.ConsensusContext
- func (m *MockHandler) EXPECT() *MockHandlerMockRecorder
- func (m *MockHandler) GetEngineManager() *EngineManager
- func (m *MockHandler) HealthCheck(arg0 context.Context) (any, error)
- func (m *MockHandler) Len() int
- func (m *MockHandler) Push(arg0 context.Context, arg1 Message)
- func (m *MockHandler) RegisterTimeout(arg0 time.Duration)
- func (m *MockHandler) SetEngineManager(arg0 *EngineManager)
- func (m *MockHandler) SetOnStopped(arg0 func())
- func (m *MockHandler) ShouldHandle(arg0 ids.NodeID) bool
- func (m *MockHandler) Start(arg0 context.Context, arg1 bool)
- func (m *MockHandler) Stop(arg0 context.Context)
- func (m *MockHandler) StopWithError(arg0 context.Context, arg1 error)
- type MockHandlerMockRecorder
- func (mr *MockHandlerMockRecorder) AwaitStopped(arg0 any) *gomock.Call
- func (mr *MockHandlerMockRecorder) Context() *gomock.Call
- func (mr *MockHandlerMockRecorder) GetEngineManager() *gomock.Call
- func (mr *MockHandlerMockRecorder) HealthCheck(arg0 any) *gomock.Call
- func (mr *MockHandlerMockRecorder) Len() *gomock.Call
- func (mr *MockHandlerMockRecorder) Push(arg0, arg1 any) *gomock.Call
- func (mr *MockHandlerMockRecorder) RegisterTimeout(arg0 any) *gomock.Call
- func (mr *MockHandlerMockRecorder) SetEngineManager(arg0 any) *gomock.Call
- func (mr *MockHandlerMockRecorder) SetOnStopped(arg0 any) *gomock.Call
- func (mr *MockHandlerMockRecorder) ShouldHandle(arg0 any) *gomock.Call
- func (mr *MockHandlerMockRecorder) Start(arg0, arg1 any) *gomock.Call
- func (mr *MockHandlerMockRecorder) Stop(arg0 any) *gomock.Call
- func (mr *MockHandlerMockRecorder) StopWithError(arg0, arg1 any) *gomock.Call
Constants ¶
This section is empty.
Variables ¶
var ErrNotConnectedEnoughStake = errors.New("not connected to enough stake")
Functions ¶
This section is empty.
Types ¶
type Engine ¶ added in v1.11.10
type Engine struct { StateSyncer common.StateSyncer Bootstrapper common.BootstrapableEngine Consensus common.Engine }
Engine is a wrapper around a consensus engine's components.
type EngineManager ¶ added in v1.11.10
EngineManager resolves the engine that should be used given the current execution context of the chain.
func (*EngineManager) Get ¶ added in v1.11.10
func (e *EngineManager) Get(engineType p2p.EngineType) *Engine
Get returns the engine corresponding to the provided type if possible. If an engine type is not specified, the initial engine type is returned.
type Handler ¶
type Handler interface { common.Timer health.Checker Context() *snow.ConsensusContext // ShouldHandle returns true if the node with the given ID is allowed to send // messages to this chain. If the node is not allowed to send messages to // this chain, the message should be dropped. ShouldHandle(nodeID ids.NodeID) bool SetEngineManager(engineManager *EngineManager) GetEngineManager() *EngineManager SetOnStopped(onStopped func()) Start(ctx context.Context, recoverPanic bool) Push(ctx context.Context, msg Message) Len() int Stop(ctx context.Context) StopWithError(ctx context.Context, err error) // AwaitStopped returns an error if the call would block and [ctx] is done. // Even if [ctx] is done when passed into this function, this function will // return a nil error if it will not block. AwaitStopped(ctx context.Context) (time.Duration, error) }
func New ¶ added in v1.11.10
func New( ctx *snow.ConsensusContext, validators validators.Manager, msgFromVMChan <-chan common.Message, gossipFrequency time.Duration, threadPoolSize int, resourceTracker tracker.ResourceTracker, subnetConnector validators.SubnetConnector, subnet subnets.Subnet, peerTracker commontracker.Peers, p2pTracker *p2p.PeerTracker, reg prometheus.Registerer, ) (Handler, error)
Initialize this consensus handler [engine] must be initialized before initializing this handler
type Message ¶ added in v1.11.10
type Message struct { // The original message from the peer message.InboundMessage // The desired engine type to execute this message. If not specified, // the current executing engine type is used. EngineType p2p.EngineType }
Message defines individual messages that have been parsed from the network and are now pending execution from the chain.
type MessageQueue ¶ added in v1.11.10
type MessageQueue interface { // Add a message. // // If called after [Shutdown], the message will immediately be marked as // having been handled. Push(context.Context, Message) // Remove and return a message and its context. // // If there are no available messages, this function will block until a // message becomes available or the queue is [Shutdown]. Pop() (context.Context, Message, bool) // Returns the number of messages currently on the queue Len() int // Shutdown and empty the queue. Shutdown() }
func NewMessageQueue ¶ added in v1.11.10
func NewMessageQueue( log logging.Logger, subnetID ids.ID, vdrs validators.Manager, cpuTracker tracker.Tracker, metricsNamespace string, reg prometheus.Registerer, ) (MessageQueue, error)
type MockHandler ¶ added in v1.11.10
type MockHandler struct {
// contains filtered or unexported fields
}
MockHandler is a mock of Handler interface.
func NewMockHandler ¶ added in v1.11.10
func NewMockHandler(ctrl *gomock.Controller) *MockHandler
NewMockHandler creates a new mock instance.
func (*MockHandler) AwaitStopped ¶ added in v1.11.10
AwaitStopped mocks base method.
func (*MockHandler) Context ¶ added in v1.11.10
func (m *MockHandler) Context() *snow.ConsensusContext
Context mocks base method.
func (*MockHandler) EXPECT ¶ added in v1.11.10
func (m *MockHandler) EXPECT() *MockHandlerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockHandler) GetEngineManager ¶ added in v1.11.10
func (m *MockHandler) GetEngineManager() *EngineManager
GetEngineManager mocks base method.
func (*MockHandler) HealthCheck ¶ added in v1.11.10
func (m *MockHandler) HealthCheck(arg0 context.Context) (any, error)
HealthCheck mocks base method.
func (*MockHandler) Push ¶ added in v1.11.10
func (m *MockHandler) Push(arg0 context.Context, arg1 Message)
Push mocks base method.
func (*MockHandler) RegisterTimeout ¶ added in v1.11.10
func (m *MockHandler) RegisterTimeout(arg0 time.Duration)
RegisterTimeout mocks base method.
func (*MockHandler) SetEngineManager ¶ added in v1.11.10
func (m *MockHandler) SetEngineManager(arg0 *EngineManager)
SetEngineManager mocks base method.
func (*MockHandler) SetOnStopped ¶ added in v1.11.10
func (m *MockHandler) SetOnStopped(arg0 func())
SetOnStopped mocks base method.
func (*MockHandler) ShouldHandle ¶ added in v1.11.10
func (m *MockHandler) ShouldHandle(arg0 ids.NodeID) bool
ShouldHandle mocks base method.
func (*MockHandler) Start ¶ added in v1.11.10
func (m *MockHandler) Start(arg0 context.Context, arg1 bool)
Start mocks base method.
func (*MockHandler) Stop ¶ added in v1.11.10
func (m *MockHandler) Stop(arg0 context.Context)
Stop mocks base method.
func (*MockHandler) StopWithError ¶ added in v1.11.10
func (m *MockHandler) StopWithError(arg0 context.Context, arg1 error)
StopWithError mocks base method.
type MockHandlerMockRecorder ¶ added in v1.11.10
type MockHandlerMockRecorder struct {
// contains filtered or unexported fields
}
MockHandlerMockRecorder is the mock recorder for MockHandler.
func (*MockHandlerMockRecorder) AwaitStopped ¶ added in v1.11.10
func (mr *MockHandlerMockRecorder) AwaitStopped(arg0 any) *gomock.Call
AwaitStopped indicates an expected call of AwaitStopped.
func (*MockHandlerMockRecorder) Context ¶ added in v1.11.10
func (mr *MockHandlerMockRecorder) Context() *gomock.Call
Context indicates an expected call of Context.
func (*MockHandlerMockRecorder) GetEngineManager ¶ added in v1.11.10
func (mr *MockHandlerMockRecorder) GetEngineManager() *gomock.Call
GetEngineManager indicates an expected call of GetEngineManager.
func (*MockHandlerMockRecorder) HealthCheck ¶ added in v1.11.10
func (mr *MockHandlerMockRecorder) HealthCheck(arg0 any) *gomock.Call
HealthCheck indicates an expected call of HealthCheck.
func (*MockHandlerMockRecorder) Len ¶ added in v1.11.10
func (mr *MockHandlerMockRecorder) Len() *gomock.Call
Len indicates an expected call of Len.
func (*MockHandlerMockRecorder) Push ¶ added in v1.11.10
func (mr *MockHandlerMockRecorder) Push(arg0, arg1 any) *gomock.Call
Push indicates an expected call of Push.
func (*MockHandlerMockRecorder) RegisterTimeout ¶ added in v1.11.10
func (mr *MockHandlerMockRecorder) RegisterTimeout(arg0 any) *gomock.Call
RegisterTimeout indicates an expected call of RegisterTimeout.
func (*MockHandlerMockRecorder) SetEngineManager ¶ added in v1.11.10
func (mr *MockHandlerMockRecorder) SetEngineManager(arg0 any) *gomock.Call
SetEngineManager indicates an expected call of SetEngineManager.
func (*MockHandlerMockRecorder) SetOnStopped ¶ added in v1.11.10
func (mr *MockHandlerMockRecorder) SetOnStopped(arg0 any) *gomock.Call
SetOnStopped indicates an expected call of SetOnStopped.
func (*MockHandlerMockRecorder) ShouldHandle ¶ added in v1.11.10
func (mr *MockHandlerMockRecorder) ShouldHandle(arg0 any) *gomock.Call
ShouldHandle indicates an expected call of ShouldHandle.
func (*MockHandlerMockRecorder) Start ¶ added in v1.11.10
func (mr *MockHandlerMockRecorder) Start(arg0, arg1 any) *gomock.Call
Start indicates an expected call of Start.
func (*MockHandlerMockRecorder) Stop ¶ added in v1.11.10
func (mr *MockHandlerMockRecorder) Stop(arg0 any) *gomock.Call
Stop indicates an expected call of Stop.
func (*MockHandlerMockRecorder) StopWithError ¶ added in v1.11.10
func (mr *MockHandlerMockRecorder) StopWithError(arg0, arg1 any) *gomock.Call
StopWithError indicates an expected call of StopWithError.