resource

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: BSD-3-Clause Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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(diskPath string, frequency, cpuHalflife, diskHalflife time.Duration) Manager

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

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

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