uptime

package
v1.7.10-rc.5 Latest Latest
Warning

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

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

Documentation

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.ShortID) (time.Duration, time.Time, error)
	CalculateUptimePercent(nodeID ids.ShortID) (float64, error)
	CalculateUptimePercentFrom(nodeID ids.ShortID, startTime time.Time) (float64, error)
}

type LockedCalculator

type LockedCalculator interface {
	Calculator

	SetCalculator(isBootstrapped *utils.AtomicBool, lock sync.Locker, newC Calculator)
}

func NewLockedCalculator

func NewLockedCalculator() LockedCalculator

type Manager

type Manager interface {
	Tracker
	Calculator
}

func NewManager

func NewManager(state State) Manager

type State

type State interface {
	GetUptime(nodeID ids.ShortID) (upDuration time.Duration, lastUpdated time.Time, err error)
	SetUptime(nodeID ids.ShortID, upDuration time.Duration, lastUpdated time.Time) error
	GetStartTime(nodeID ids.ShortID) (startTime time.Time, err error)
}

type TestManager

type TestManager interface {
	Manager
	SetTime(time.Time)
}

type TestState

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

func NewTestState

func NewTestState() *TestState

func (*TestState) AddNode

func (s *TestState) AddNode(nodeID ids.ShortID, startTime time.Time)

func (*TestState) GetStartTime

func (s *TestState) GetStartTime(nodeID ids.ShortID) (time.Time, error)

func (*TestState) GetUptime

func (s *TestState) GetUptime(nodeID ids.ShortID) (time.Duration, time.Time, error)

func (*TestState) SetUptime

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

type Tracker

type Tracker interface {
	// Should only be called once
	StartTracking(nodeIDs []ids.ShortID) error

	// Should only be called once
	Shutdown(nodeIDs []ids.ShortID) error

	Connect(nodeID ids.ShortID) error
	IsConnected(nodeID ids.ShortID) bool
	Disconnect(nodeID ids.ShortID) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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