Help us shape the future of Go! Take the 2026 Go Developer Survey

tracker

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUTracker

type CPUTracker interface {
	// UtilizeTime marks that we were utilizing CPU for the given time
	UtilizeTime(time.Time, time.Time)

	// Utilization returns the current CPU utilization
	Utilization(time.Time, time.Duration) float64

	// Len returns the number of tracked intervals
	Len() int

	// TimeUntilUsage returns the time until a target utilization is reached
	TimeUntilUsage(time.Time, time.Duration, float64) time.Duration
}

CPUTracker tracks CPU usage

type Peers

type Peers interface {
	// Connected adds a connected peer
	Connected(nodeID ids.NodeID, nodeVersion *version.Application)

	// Disconnected removes a disconnected peer
	Disconnected(nodeID ids.NodeID)

	// Peers returns the set of connected peers
	Peers() set.Set[ids.NodeID]

	// ConnectedSubnets returns the subnets that connected peers are tracking
	ConnectedSubnets() set.Set[ids.ID]
}

Peers tracks peers

func NewPeers

func NewPeers() Peers

NewPeers returns a new Peers

type ResourceTracker

type ResourceTracker interface {
	// StartProcessing marks that a node has started processing
	StartProcessing(nodeID ids.NodeID, time time.Time)

	// StopProcessing marks that a node has stopped processing
	StopProcessing(nodeID ids.NodeID, time time.Time)

	// CPUTracker returns the CPU tracker for a node
	CPUTracker(ids.NodeID) CPUTracker

	// DiskTracker returns the disk tracker for a node
	DiskTracker(ids.NodeID) CPUTracker
}

ResourceTracker tracks resource usage

func NewResourceTracker

func NewResourceTracker(registry interface{}, usage interface{}, factory interface{}, interval time.Duration) (ResourceTracker, error)

NewResourceTracker creates a new resource tracker

type StartupTracker

type StartupTracker interface {
	// ShouldStart returns true if startup should begin
	ShouldStart() bool

	// StartingTime returns when startup began
	StartingTime() (time.Time, bool)

	// Started marks startup as started
	Started() bool

	// OnBootstrapStarted marks bootstrap as started
	OnBootstrapStarted()

	// OnBootstrapFinished marks bootstrap as finished
	OnBootstrapFinished()
}

StartupTracker tracks startup progress

Directories

Path Synopsis
Package trackermock is a generated GoMock package.
Package trackermock is a generated GoMock package.

Jump to

Keyboard shortcuts

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