uptime

package
v1.0.0-genesis Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2025 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager interface {
	// IsValidator returns whether the node ID is currently a validator
	IsValidator(nodeID ids.NodeID, subnetID ids.ID) bool

	// StartTracking starts tracking the uptime of the specified validator
	StartTracking(nodeIDs []ids.NodeID, subnetID ids.ID) error

	// StopTracking stops tracking the uptime of the specified validator
	StopTracking(nodeIDs []ids.NodeID, subnetID ids.ID) error

	// Connect marks the validator as connected
	Connect(nodeID ids.NodeID, subnetID ids.ID) error

	// Disconnect marks the validator as disconnected
	Disconnect(nodeID ids.NodeID) error

	// GetUptime returns the uptime of the validator as a percentage
	CalculateUptime(nodeID ids.NodeID, subnetID ids.ID) (time.Duration, time.Time, error)

	// GetUptimePercent returns the uptime of the validator as a percentage
	CalculateUptimePercent(nodeID ids.NodeID, subnetID ids.ID) (float64, error)

	// GetUptimePercentFrom returns the uptime of the validator as a percentage
	// from the specified start time
	CalculateUptimePercentFrom(nodeID ids.NodeID, subnetID ids.ID, startTime time.Time) (float64, error)
}

Manager tracks validator uptimes

type TestManager

type TestManager interface {
	Manager

	// SetTime sets the current time for testing
	SetTime(time.Time)
}

TestManager extends Manager for testing

Jump to

Keyboard shortcuts

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