resource

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: BSD-3-Clause Imports: 7 Imported by: 0

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