timeout

package
v1.10.18-rc.2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: BSD-3-Clause Imports: 14 Imported by: 23

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 added in v1.7.10

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

type MockManager added in v1.9.4

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

MockManager is a mock of Manager interface.

func NewMockManager added in v1.9.4

func NewMockManager(ctrl *gomock.Controller) *MockManager

NewMockManager creates a new mock instance.

func (*MockManager) Dispatch added in v1.9.4

func (m *MockManager) Dispatch()

Dispatch mocks base method.

func (*MockManager) EXPECT added in v1.9.4

func (m *MockManager) EXPECT() *MockManagerMockRecorder

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

func (*MockManager) IsBenched added in v1.9.4

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

IsBenched mocks base method.

func (*MockManager) RegisterChain added in v1.9.4

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

RegisterChain mocks base method.

func (*MockManager) RegisterRequest added in v1.9.4

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

RegisterRequest mocks base method.

func (*MockManager) RegisterRequestToUnreachableValidator added in v1.9.4

func (m *MockManager) RegisterRequestToUnreachableValidator()

RegisterRequestToUnreachableValidator mocks base method.

func (*MockManager) RegisterResponse added in v1.9.4

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 added in v1.9.4

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

RemoveRequest mocks base method.

func (*MockManager) Stop added in v1.10.14

func (m *MockManager) Stop()

Stop mocks base method.

func (*MockManager) TimeoutDuration added in v1.9.4

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

TimeoutDuration mocks base method.

type MockManagerMockRecorder added in v1.9.4

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

MockManagerMockRecorder is the mock recorder for MockManager.

func (*MockManagerMockRecorder) Dispatch added in v1.9.4

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

Dispatch indicates an expected call of Dispatch.

func (*MockManagerMockRecorder) IsBenched added in v1.9.4

func (mr *MockManagerMockRecorder) IsBenched(arg0, arg1 interface{}) *gomock.Call

IsBenched indicates an expected call of IsBenched.

func (*MockManagerMockRecorder) RegisterChain added in v1.9.4

func (mr *MockManagerMockRecorder) RegisterChain(arg0 interface{}) *gomock.Call

RegisterChain indicates an expected call of RegisterChain.

func (*MockManagerMockRecorder) RegisterRequest added in v1.9.4

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

RegisterRequest indicates an expected call of RegisterRequest.

func (*MockManagerMockRecorder) RegisterRequestToUnreachableValidator added in v1.9.4

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

RegisterRequestToUnreachableValidator indicates an expected call of RegisterRequestToUnreachableValidator.

func (*MockManagerMockRecorder) RegisterResponse added in v1.9.4

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

RegisterResponse indicates an expected call of RegisterResponse.

func (*MockManagerMockRecorder) RemoveRequest added in v1.9.4

func (mr *MockManagerMockRecorder) RemoveRequest(arg0 interface{}) *gomock.Call

RemoveRequest indicates an expected call of RemoveRequest.

func (*MockManagerMockRecorder) Stop added in v1.10.14

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

Stop indicates an expected call of Stop.

func (*MockManagerMockRecorder) TimeoutDuration added in v1.9.4

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