resource

package
v1.10.19-bloom-reset-fix Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: BSD-3-Clause Imports: 13 Imported by: 13

Documentation

Overview

Package resource is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUUser

type CPUUser interface {
	// CPUUsage returns the number of CPU cores of usage this user has attributed
	// to it.
	//
	// For example, if this user is reporting a process's CPU utilization and
	// that process is currently using 150% CPU (i.e. one and a half cores of
	// compute) then the return value will be 1.5.
	CPUUsage() float64
}

type DiskUser

type DiskUser interface {
	// DiskUsage returns the number of bytes per second read from/written to
	// disk recently.
	DiskUsage() (read float64, write float64)

	// returns number of bytes available in the db volume
	AvailableDiskBytes() uint64
}

type Manager

type Manager interface {
	User
	ProcessTracker

	// Shutdown allocated resources and stop tracking all processes.
	Shutdown()
}

func NewManager

func NewManager(
	log logging.Logger,
	diskPath string,
	frequency,
	cpuHalflife,
	diskHalflife time.Duration,
	metricsRegisterer prometheus.Registerer,
) (Manager, error)

type MockUser

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

MockUser is a mock of User interface.

func NewMockUser

func NewMockUser(ctrl *gomock.Controller) *MockUser

NewMockUser creates a new mock instance.

func (*MockUser) AvailableDiskBytes added in v1.7.12

func (m *MockUser) AvailableDiskBytes() uint64

AvailableDiskBytes mocks base method.

func (*MockUser) CPUUsage

func (m *MockUser) CPUUsage() float64

CPUUsage mocks base method.

func (*MockUser) DiskUsage

func (m *MockUser) DiskUsage() (float64, float64)

DiskUsage mocks base method.

func (*MockUser) EXPECT

func (m *MockUser) EXPECT() *MockUserMockRecorder

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

type MockUserMockRecorder

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

MockUserMockRecorder is the mock recorder for MockUser.

func (*MockUserMockRecorder) AvailableDiskBytes added in v1.7.12

func (mr *MockUserMockRecorder) AvailableDiskBytes() *gomock.Call

AvailableDiskBytes indicates an expected call of AvailableDiskBytes.

func (*MockUserMockRecorder) CPUUsage

func (mr *MockUserMockRecorder) CPUUsage() *gomock.Call

CPUUsage indicates an expected call of CPUUsage.

func (*MockUserMockRecorder) DiskUsage

func (mr *MockUserMockRecorder) DiskUsage() *gomock.Call

DiskUsage indicates an expected call of DiskUsage.

type ProcessTracker

type ProcessTracker interface {
	// TrackProcess adds [pid] to the list of processes that this tracker is
	// currently managing. Duplicate requests are dropped.
	TrackProcess(pid int)

	// UntrackProcess removes [pid] from the list of processes that this tracker
	// is currently managing. Untracking a currently untracked [pid] is a noop.
	UntrackProcess(pid int)
}

type User

type User interface {
	CPUUser
	DiskUser
}
var NoUsage User = noUsage{}

NoUsage implements Usage() by always returning 0.

Jump to

Keyboard shortcuts

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