resources

package
v0.0.0-...-f706b47 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resources

type Resources struct {
	Cpu     int64 // In millicores
	Memory  int64 // In megabytes
	Storage int64 // Store is included here for logging purposes, but not intended to be scaled (yet)
}

Resources combines Cpu and Memory into a single container

func (*Resources) Add

func (res *Resources) Add(new *Resources) *Resources

Add adds the new resources to the existing resources. Result is updated and also returned.

func (*Resources) DiffersFrom

func (res *Resources) DiffersFrom(quota *v1.ResourceQuota) bool

func (*Resources) ForceNoScaleDownWhenScaleUp

func (res *Resources) ForceNoScaleDownWhenScaleUp(quota *v1.ResourceQuota)

func (*Resources) IsEmpty

func (res *Resources) IsEmpty() bool

IsEmpty returns true when Cpu and Memory are both zero.

func (*Resources) IsScaleDown

func (res *Resources) IsScaleDown(quota *v1.ResourceQuota) bool

func (*Resources) Limit

func (res *Resources) Limit(limit *Resources) *Resources

Limit limits the resources with a maximum of the specified limit. Result is updated and also returned.

func (*Resources) Max

func (res *Resources) Max(new *Resources) *Resources

Max updates res with the maximum values of res and new. Result is updated and also returned.

func (*Resources) Replace

func (res *Resources) Replace(new *Resources) *Resources

Replace replaces fields in `res` if they are non-default in `new`. Result is updated and also returned.

Jump to

Keyboard shortcuts

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