types

package
v0.0.0-...-d01dfd4 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 4 Imported by: 15

Documentation

Index

Constants

View Source
const (
	// UNLIMITED unlimited resource value
	UNLIMITED = -1

	// MaxLimitedValue the max capacity of limited storage, in Bytes
	// 1125899906842624 Bytes = 1024 TB
	MaxLimitedValue = uint64(1125899906842624)

	// ResourceStorage storage size, in bytes
	ResourceStorage ResourceName = "storage"
)

Variables

This section is empty.

Functions

func Equals

func Equals(a ResourceList, b ResourceList) bool

Equals returns true if the two lists are equivalent

func IsValidResource

func IsValidResource(resource ResourceName) bool

IsValidResource returns true when resource was supported

Types

type ResourceList

type ResourceList map[ResourceName]int64

ResourceList is a set of (resource name, value) pairs.

func Add

Add returns the result of a + b for each named resource

func NewResourceList

func NewResourceList(s string) (ResourceList, error)

NewResourceList returns resource list from string

func Subtract

func Subtract(a ResourceList, b ResourceList) ResourceList

Subtract returns the result of a - b for each named resource

func Zero

func Zero(a ResourceList) ResourceList

Zero returns the result of a - a for each named resource

func (ResourceList) String

func (resources ResourceList) String() string

func (ResourceList) Validate

func (resources ResourceList) Validate(_ strfmt.Registry) error

Validate validates this resource list

type ResourceName

type ResourceName string

ResourceName is the name identifying various resources in a ResourceList.

func IsNegative

func IsNegative(a ResourceList) []ResourceName

IsNegative returns the set of resource names that have a negative value.

func (ResourceName) FormatValue

func (resource ResourceName) FormatValue(value int64) string

FormatValue returns string for the resource value

Jump to

Keyboard shortcuts

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