uptime

package
v1.16.20 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: GPL-3.0, LGPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPausableManager

func NewPausableManager(manager *Manager) interfaces.PausableManager

NewPausableManager takes a Manager and returns a PausableManager

Types

type Manager added in v0.8.8

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

Manager tracks validator uptime and connection status

func NewManager added in v0.8.8

func NewManager(state uptime.State, clock interface{}) *Manager

NewManager creates a new uptime manager

func (*Manager) CalculateUptime added in v0.8.8

func (m *Manager) CalculateUptime(nodeID ids.NodeID, netID ids.ID) (time.Duration, time.Duration, error)

CalculateUptime returns the uptime duration and total tracking duration for a node

func (*Manager) CalculateUptimePercent added in v0.8.8

func (m *Manager) CalculateUptimePercent(nodeID ids.NodeID, subnetID ids.ID) (float64, error)

CalculateUptimePercent returns the uptime percentage for a node

func (*Manager) CalculateUptimePercentFrom added in v0.8.8

func (m *Manager) CalculateUptimePercentFrom(nodeID ids.NodeID, subnetID ids.ID, _ time.Time) (float64, error)

CalculateUptimePercentFrom returns the uptime percentage since a given time

func (*Manager) Connect added in v0.8.8

func (m *Manager) Connect(nodeID ids.NodeID) error

Connect marks a validator as connected and begins counting uptime if tracking

func (*Manager) Disconnect added in v0.8.8

func (m *Manager) Disconnect(nodeID ids.NodeID) error

Disconnect marks a validator as disconnected and finalizes uptime if tracking

func (*Manager) EnsureExists added in v0.8.8

func (m *Manager) EnsureExists(nodeID ids.NodeID)

EnsureExists ensures a nodeUptime entry exists for the given node This is used to track nodes even before they connect

func (*Manager) IsConnected added in v0.8.8

func (m *Manager) IsConnected(nodeID ids.NodeID) bool

IsConnected returns whether a validator is connected

func (*Manager) SetCalculator added in v0.8.8

func (m *Manager) SetCalculator(_ ids.ID, _ uptime.Calculator) error

SetCalculator is a no-op for compatibility with uptime.Calculator interface

func (*Manager) StartTracking added in v0.8.8

func (m *Manager) StartTracking(nodeIDs []ids.NodeID) error

StartTracking starts tracking uptime for the given set of validators Any time before StartTracking is credited as "optimistic" uptime

func (*Manager) StopTracking added in v0.8.8

func (m *Manager) StopTracking(nodeIDs []ids.NodeID) error

StopTracking stops tracking uptime for the given set of validators It persists the accumulated uptime to state

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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