tracker

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: BSD-3-Clause Imports: 13 Imported by: 1

Documentation

Overview

Package tracker is a generated GoMock package.

Package tracker is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiskTracker

type DiskTracker interface {
	Tracker
	AvailableDiskBytes() uint64
}

type MockTargeter

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

MockTargeter is a mock of Targeter interface.

func NewMockTargeter

func NewMockTargeter(ctrl *gomock.Controller) *MockTargeter

NewMockTargeter creates a new mock instance.

func (*MockTargeter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockTargeter) TargetUsage

func (m *MockTargeter) TargetUsage(arg0 ids.NodeID) float64

TargetUsage mocks base method.

type MockTargeterMockRecorder

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

MockTargeterMockRecorder is the mock recorder for MockTargeter.

func (*MockTargeterMockRecorder) TargetUsage

func (mr *MockTargeterMockRecorder) TargetUsage(arg0 interface{}) *gomock.Call

TargetUsage indicates an expected call of TargetUsage.

type MockTracker

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

MockTracker is a mock of Tracker interface.

func NewMockTracker

func NewMockTracker(ctrl *gomock.Controller) *MockTracker

NewMockTracker creates a new mock instance.

func (*MockTracker) EXPECT

func (m *MockTracker) EXPECT() *MockTrackerMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockTracker) TimeUntilUsage

func (m *MockTracker) TimeUntilUsage(arg0 ids.NodeID, arg1 time.Time, arg2 float64) time.Duration

TimeUntilUsage mocks base method.

func (*MockTracker) TotalUsage

func (m *MockTracker) TotalUsage() float64

TotalUsage mocks base method.

func (*MockTracker) Usage

func (m *MockTracker) Usage(arg0 ids.NodeID, arg1 time.Time) float64

Usage mocks base method.

type MockTrackerMockRecorder

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

MockTrackerMockRecorder is the mock recorder for MockTracker.

func (*MockTrackerMockRecorder) TimeUntilUsage

func (mr *MockTrackerMockRecorder) TimeUntilUsage(arg0, arg1, arg2 interface{}) *gomock.Call

TimeUntilUsage indicates an expected call of TimeUntilUsage.

func (*MockTrackerMockRecorder) TotalUsage

func (mr *MockTrackerMockRecorder) TotalUsage() *gomock.Call

TotalUsage indicates an expected call of TotalUsage.

func (*MockTrackerMockRecorder) Usage

func (mr *MockTrackerMockRecorder) Usage(arg0, arg1 interface{}) *gomock.Call

Usage indicates an expected call of Usage.

type ResourceTracker

type ResourceTracker interface {
	CPUTracker() Tracker
	DiskTracker() DiskTracker
	// Registers that the given node started processing at the given time.
	StartProcessing(ids.NodeID, time.Time)
	// Registers that the given node stopped processing at the given time.
	StopProcessing(ids.NodeID, time.Time)
}

ResourceTracker is an interface for tracking peers' usage of resources

func NewResourceTracker

func NewResourceTracker(
	reg prometheus.Registerer,
	resources resource.User,
	factory meter.Factory,
	halflife time.Duration,
) (ResourceTracker, error)

type Targeter

type Targeter interface {
	// Returns the target usage of the given node.
	TargetUsage(nodeID ids.NodeID) float64
}

func NewTargeter

func NewTargeter(
	config *TargeterConfig,
	vdrs validators.Set,
	tracker Tracker,
) Targeter

type TargeterConfig

type TargeterConfig struct {
	// VdrAlloc is the amount of the resource to split over validators, weighted
	// by stake.
	VdrAlloc float64 `json:"vdrAlloc"`

	// MaxNonVdrUsage is the amount of the resource which, if utilized, will
	// result in allocations being based only on the stake weighted allocation.
	MaxNonVdrUsage float64 `json:"maxNonVdrUsage"`

	// MaxNonVdrNodeUsage is the amount of the resource to allocate to a node
	// before adding the stake weighted allocation.
	MaxNonVdrNodeUsage float64 `json:"maxNonVdrNodeUsage"`
}

type Tracker

type Tracker interface {
	// Returns the current usage for the given node.
	Usage(nodeID ids.NodeID, now time.Time) float64
	// Returns the current usage by all nodes.
	TotalUsage() float64
	// Returns the duration between [now] and when the usage of [nodeID] reaches
	// [value], assuming that the node uses no more resources.
	// If the node's usage isn't known, or is already <= [value], returns the
	// zero duration.
	TimeUntilUsage(nodeID ids.NodeID, now time.Time, value float64) time.Duration
}

Jump to

Keyboard shortcuts

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