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 ¶
func Add(a ResourceList, b ResourceList) ResourceList
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
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
Click to show internal directories.
Click to hide internal directories.