Documentation ¶
Index ¶
- Constants
- type Quantity
- type Resource
- func (r *Resource) Add(rr *Resource)
- func (r *Resource) CPU() Quantity
- func (r *Resource) Clone() *Resource
- func (r *Resource) DelResources(name string)
- func (r *Resource) IsNegative() bool
- func (r *Resource) IsZero() bool
- func (r *Resource) LessEqual(rr *Resource) bool
- func (r Resource) MarshalJSON() ([]byte, error)
- func (r *Resource) Memory() Quantity
- func (r *Resource) Multi(ratio int)
- func (r *Resource) Resource() map[string]Quantity
- func (r *Resource) ScalarResources(prefix string) map[string]Quantity
- func (r *Resource) SetResources(name string, value int64)
- func (r *Resource) Storage() Quantity
- func (r Resource) String() string
- func (r *Resource) Sub(rr *Resource)
- func (r *Resource) ToMap() map[string]interface{}
- func (r *Resource) UnmarshalJSON(value []byte) error
Constants ¶
const ( ResCPU = "cpu" ResMemory = "memory" ResStorage = "storage" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Quantity ¶
type Quantity int64
Quantity defines value type
func ParseMilliQuantity ¶
ParseMilliQuantity is used to parse user-provided values into milli int64.
func ParseQuantity ¶
ParseQuantity is used to parse user-provided values into int64.
func (Quantity) MilliString ¶
type Resource ¶
Resource is a struct that contains the information of a resource. For cpu resource, the unit of cpu value is milli
func EmptyResource ¶
func EmptyResource() *Resource
func NewResourceFromMap ¶
func (*Resource) Add ¶
Add additional resource to the base and updating the base resource Should be used by temporary computation only
func (*Resource) DelResources ¶
func (*Resource) IsNegative ¶
func (*Resource) LessEqual ¶
LessEqual returns true if this quantity is less than or equal to the other.
func (Resource) MarshalJSON ¶
func (*Resource) ScalarResources ¶ added in v0.14.4
ScalarResources return scalar resources by prefix, if prefix is empty, return all
func (*Resource) SetResources ¶
func (*Resource) Sub ¶
Sub subtract from the resource the passed in resource by updating the resource it is called on. Should be used by temporary computation only