uptimetracker

package
v1.14.1-db-metrics-fix Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrValidationIDNotFound = errors.New("validationID not found")

Functions

This section is empty.

Types

type UptimeTracker

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

UptimeTracker tracks uptime information for validators

func New

func New(
	validatorState validators.State,
	subnetID ids.ID,
	db database.Database,
	clock *mockable.Clock,
) (*UptimeTracker, error)

New returns a new instance of UptimeTracker

func (*UptimeTracker) Connect

func (u *UptimeTracker) Connect(nodeID ids.NodeID) error

Connect starts tracking a node. Nodes that are activated and connected will be treated as online.

func (*UptimeTracker) Disconnect

func (u *UptimeTracker) Disconnect(nodeID ids.NodeID) error

Disconnect stops tracking a node. Disconnected nodes are treated as being offline.

func (*UptimeTracker) GetUptime

func (u *UptimeTracker) GetUptime(validationID ids.ID) (
	time.Duration,
	time.Time,
	error,
)

GetUptime returns the uptime of the validator corresponding to validationID

func (*UptimeTracker) Shutdown

func (u *UptimeTracker) Shutdown() error

Shutdown stops tracking uptimes and writes our state.

func (*UptimeTracker) Sync

func (u *UptimeTracker) Sync(ctx context.Context) error

Sync updates the validator set and writes our state. Sync starts tracking uptimes for all active validators the first time it is called.

Jump to

Keyboard shortcuts

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