timeout

package
v1.11.5-alpha Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package timeout is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager interface {
	// Start the manager. Must be called before any other method.
	// Should be called in a goroutine.
	Dispatch()
	// TimeoutDuration returns the current timeout duration.
	TimeoutDuration() time.Duration
	// IsBenched returns true if messages to [nodeID] regarding [chainID]
	// should not be sent over the network and should immediately fail.
	IsBenched(nodeID ids.NodeID, chainID ids.ID) bool
	// Register the existence of the given chain.
	// Must be called before any method calls that use the
	// ID of the chain.
	RegisterChain(ctx *snow.ConsensusContext) error
	// RegisterRequest notes that we expect a response of type [op] from
	// [nodeID] for chain [chainID]. If we don't receive a response in
	// time, [timeoutHandler] is executed.
	RegisterRequest(
		nodeID ids.NodeID,
		chainID ids.ID,
		measureLatency bool,
		requestID ids.RequestID,
		timeoutHandler func(),
	)
	// Registers that we would have sent a request to a validator but they
	// are unreachable because they are benched or because of network conditions
	// (e.g. we're not connected), so we didn't send the query. For the sake
	// of calculating the average latency and network timeout, we act as
	// though we sent the validator a request and it timed out.
	RegisterRequestToUnreachableValidator()
	// Registers that [nodeID] sent us a response of type [op]
	// for the given chain. The response corresponds to the given
	// requestID we sent them. [latency] is the time between us
	// sending them the request and receiving their response.
	RegisterResponse(
		nodeID ids.NodeID,
		chainID ids.ID,
		requestID ids.RequestID,
		op message.Op,
		latency time.Duration,
	)
	// Mark that we no longer expect a response to this request we sent.
	// Does not modify the timeout.
	RemoveRequest(requestID ids.RequestID)

	// Stops the manager.
	Stop()
}

Manages timeouts for requests sent to peers.

func NewManager

func NewManager(
	timeoutConfig *timer.AdaptiveTimeoutConfig,
	benchlistMgr benchlist.Manager,
	metricsNamespace string,
	metricsRegister prometheus.Registerer,
) (Manager, error)

type MockManager

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

MockManager is a mock of Manager interface.

func NewMockManager

func NewMockManager(ctrl *gomock.Controller) *MockManager

NewMockManager creates a new mock instance.

func (*MockManager) Dispatch

func (m *MockManager) Dispatch()

Dispatch mocks base method.

func (*MockManager) EXPECT

func (m *MockManager) EXPECT() *MockManagerMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockManager) IsBenched

func (m *MockManager) IsBenched(arg0 ids.NodeID, arg1 ids.ID) bool

IsBenched mocks base method.

func (*MockManager) RegisterChain

func (m *MockManager) RegisterChain(arg0 *snow.ConsensusContext) error

RegisterChain mocks base method.

func (*MockManager) RegisterRequest

func (m *MockManager) RegisterRequest(arg0 ids.NodeID, arg1 ids.ID, arg2 bool, arg3 ids.RequestID, arg4 func())

RegisterRequest mocks base method.

func (*MockManager) RegisterRequestToUnreachableValidator

func (m *MockManager) RegisterRequestToUnreachableValidator()

RegisterRequestToUnreachableValidator mocks base method.

func (*MockManager) RegisterResponse

func (m *MockManager) RegisterResponse(arg0 ids.NodeID, arg1 ids.ID, arg2 ids.RequestID, arg3 message.Op, arg4 time.Duration)

RegisterResponse mocks base method.

func (*MockManager) RemoveRequest

func (m *MockManager) RemoveRequest(arg0 ids.RequestID)

RemoveRequest mocks base method.

func (*MockManager) Stop

func (m *MockManager) Stop()

Stop mocks base method.

func (*MockManager) TimeoutDuration

func (m *MockManager) TimeoutDuration() time.Duration

TimeoutDuration mocks base method.

type MockManagerMockRecorder

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

MockManagerMockRecorder is the mock recorder for MockManager.

func (*MockManagerMockRecorder) Dispatch

func (mr *MockManagerMockRecorder) Dispatch() *gomock.Call

Dispatch indicates an expected call of Dispatch.

func (*MockManagerMockRecorder) IsBenched

func (mr *MockManagerMockRecorder) IsBenched(arg0, arg1 any) *gomock.Call

IsBenched indicates an expected call of IsBenched.

func (*MockManagerMockRecorder) RegisterChain

func (mr *MockManagerMockRecorder) RegisterChain(arg0 any) *gomock.Call

RegisterChain indicates an expected call of RegisterChain.

func (*MockManagerMockRecorder) RegisterRequest

func (mr *MockManagerMockRecorder) RegisterRequest(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call

RegisterRequest indicates an expected call of RegisterRequest.

func (*MockManagerMockRecorder) RegisterRequestToUnreachableValidator

func (mr *MockManagerMockRecorder) RegisterRequestToUnreachableValidator() *gomock.Call

RegisterRequestToUnreachableValidator indicates an expected call of RegisterRequestToUnreachableValidator.

func (*MockManagerMockRecorder) RegisterResponse

func (mr *MockManagerMockRecorder) RegisterResponse(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call

RegisterResponse indicates an expected call of RegisterResponse.

func (*MockManagerMockRecorder) RemoveRequest

func (mr *MockManagerMockRecorder) RemoveRequest(arg0 any) *gomock.Call

RemoveRequest indicates an expected call of RemoveRequest.

func (*MockManagerMockRecorder) Stop

func (mr *MockManagerMockRecorder) Stop() *gomock.Call

Stop indicates an expected call of Stop.

func (*MockManagerMockRecorder) TimeoutDuration

func (mr *MockManagerMockRecorder) TimeoutDuration() *gomock.Call

TimeoutDuration indicates an expected call of TimeoutDuration.

Jump to

Keyboard shortcuts

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