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
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
type Targeter ¶
type Targeter interface {
// AdjustTargets adjusts target allocations based on current usage
AdjustTargets()
}
Targeter calculates target resource allocation
func NewTargeter ¶
func NewTargeter(
log interface{},
config *TargeterConfig,
validators interface{},
tracker ResourceTracker,
) Targeter
NewTargeter creates a new targeter
type TargeterConfig ¶
type TargeterConfig struct {
// VdrAlloc is the number of nanoseconds of CPU time to allocate for use by validators
VdrAlloc int64 `json:"vdrAlloc"`
// MaxNonVdrUsage is the max percentage of CPU usage for non-validators
MaxNonVdrUsage float64 `json:"maxNonVdrUsage"`
// MaxNonVdrNodeUsage is the max percentage of CPU usage per non-validator node
MaxNonVdrNodeUsage float64 `json:"maxNonVdrNodeUsage"`
// Minimum proportion of validators that must be connected
MinimumConnectedValidatorProportion float64 `json:"minimumConnectedValidatorProportion"`
// TargetUsage is the target resource usage
TargetUsage float64 `json:"targetUsage"`
// TargetUtilization is the target utilization
TargetUtilization float64 `json:"targetUtilization"`
// DecreaseRatio is the decrease ratio when above target
DecreaseRatio float64 `json:"decreaseRatio"`
// IncreaseRatio is the increase ratio when below target
IncreaseRatio float64 `json:"increaseRatio"`
}
TargeterConfig contains configuration for resource targeters
Directories
¶
| Path | Synopsis |
|---|---|
|
Package trackermock is a generated GoMock package.
|
Package trackermock is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.