Documentation ¶
Index ¶
- type Calculator
- type LockedCalculator
- type Manager
- type State
- type TestState
- func (s *TestState) AddNode(nodeID ids.NodeID, subnetID ids.ID, startTime time.Time)
- func (s *TestState) GetStartTime(nodeID ids.NodeID, subnetID ids.ID) (time.Time, error)
- func (s *TestState) GetUptime(nodeID ids.NodeID, subnetID ids.ID) (time.Duration, time.Time, error)
- func (s *TestState) SetUptime(nodeID ids.NodeID, subnetID ids.ID, upDuration time.Duration, ...) error
- type Tracker
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 }
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) }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package uptimemock is a generated GoMock package.
|
Package uptimemock is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.