uptime

package
v1.11.12 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: BSD-3-Clause Imports: 10 Imported by: 8

Documentation

Overview

Package uptime is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Calculator

type Calculator interface {
	CalculateUptime(nodeID ids.NodeID, subnetID ids.ID) (time.Duration, time.Time, error)
	CalculateUptimePercent(nodeID ids.NodeID, subnetID ids.ID) (float64, error)
	// CalculateUptimePercentFrom expects [startTime] to be truncated (floored) to the nearest second
	CalculateUptimePercentFrom(nodeID ids.NodeID, subnetID ids.ID, startTime time.Time) (float64, error)
}
var NoOpCalculator Calculator = noOpCalculator{}

type LockedCalculator

type LockedCalculator interface {
	Calculator

	SetCalculator(isBootstrapped *utils.Atomic[bool], lock sync.Locker, newC Calculator)
}

func NewLockedCalculator

func NewLockedCalculator() LockedCalculator

type Manager

type Manager interface {
	Tracker
	Calculator
}

func NewManager

func NewManager(state State, clk *mockable.Clock) Manager

type MockCalculator added in v1.9.2

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

MockCalculator is a mock of Calculator interface.

func NewMockCalculator added in v1.9.2

func NewMockCalculator(ctrl *gomock.Controller) *MockCalculator

NewMockCalculator creates a new mock instance.

func (*MockCalculator) CalculateUptime added in v1.9.2

func (m *MockCalculator) CalculateUptime(arg0 ids.NodeID, arg1 ids.ID) (time.Duration, time.Time, error)

CalculateUptime mocks base method.

func (*MockCalculator) CalculateUptimePercent added in v1.9.2

func (m *MockCalculator) CalculateUptimePercent(arg0 ids.NodeID, arg1 ids.ID) (float64, error)

CalculateUptimePercent mocks base method.

func (*MockCalculator) CalculateUptimePercentFrom added in v1.9.2

func (m *MockCalculator) CalculateUptimePercentFrom(arg0 ids.NodeID, arg1 ids.ID, arg2 time.Time) (float64, error)

CalculateUptimePercentFrom mocks base method.

func (*MockCalculator) EXPECT added in v1.9.2

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

type MockCalculatorMockRecorder added in v1.9.2

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

MockCalculatorMockRecorder is the mock recorder for MockCalculator.

func (*MockCalculatorMockRecorder) CalculateUptime added in v1.9.2

func (mr *MockCalculatorMockRecorder) CalculateUptime(arg0, arg1 any) *gomock.Call

CalculateUptime indicates an expected call of CalculateUptime.

func (*MockCalculatorMockRecorder) CalculateUptimePercent added in v1.9.2

func (mr *MockCalculatorMockRecorder) CalculateUptimePercent(arg0, arg1 any) *gomock.Call

CalculateUptimePercent indicates an expected call of CalculateUptimePercent.

func (*MockCalculatorMockRecorder) CalculateUptimePercentFrom added in v1.9.2

func (mr *MockCalculatorMockRecorder) CalculateUptimePercentFrom(arg0, arg1, arg2 any) *gomock.Call

CalculateUptimePercentFrom indicates an expected call of CalculateUptimePercentFrom.

type State

type State interface {
	// GetUptime returns [upDuration] and [lastUpdated] of [nodeID] on
	// [subnetID].
	// Returns [database.ErrNotFound] if [nodeID] isn't currently a validator of
	// the subnet.
	GetUptime(
		nodeID ids.NodeID,
		subnetID ids.ID,
	) (upDuration time.Duration, lastUpdated time.Time, err error)

	// SetUptime updates [upDuration] and [lastUpdated] of [nodeID] on
	// [subnetID].
	// Returns [database.ErrNotFound] if [nodeID] isn't currently a validator of
	// the subnet.
	// Invariant: expects [lastUpdated] to be truncated (floored) to the nearest
	//            second.
	SetUptime(
		nodeID ids.NodeID,
		subnetID ids.ID,
		upDuration time.Duration,
		lastUpdated time.Time,
	) error

	// GetStartTime returns the time that [nodeID] started validating
	// [subnetID].
	// Returns [database.ErrNotFound] if [nodeID] isn't currently a validator of
	// the subnet.
	GetStartTime(
		nodeID ids.NodeID,
		subnetID ids.ID,
	) (startTime time.Time, err error)
}

type TestState

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

func NewTestState

func NewTestState() *TestState

func (*TestState) AddNode

func (s *TestState) AddNode(nodeID ids.NodeID, subnetID ids.ID, startTime time.Time)

func (*TestState) GetStartTime

func (s *TestState) GetStartTime(nodeID ids.NodeID, subnetID ids.ID) (time.Time, error)

func (*TestState) GetUptime

func (s *TestState) GetUptime(nodeID ids.NodeID, subnetID ids.ID) (time.Duration, time.Time, error)

func (*TestState) SetUptime

func (s *TestState) SetUptime(nodeID ids.NodeID, subnetID ids.ID, upDuration time.Duration, lastUpdated time.Time) error

type Tracker

type Tracker interface {
	StartTracking(nodeIDs []ids.NodeID, subnetID ids.ID) error
	StopTracking(nodeIDs []ids.NodeID, subnetID ids.ID) error

	Connect(nodeID ids.NodeID, subnetID ids.ID) error
	IsConnected(nodeID ids.NodeID, subnetID ids.ID) bool
	Disconnect(nodeID ids.NodeID) error
}

Jump to

Keyboard shortcuts

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