Documentation ¶
Index ¶
- Variables
- func IsSafe(hardLimits types.ResourceList, currentUsed types.ResourceList, ...) error
- func NewResourceNotFoundError(resource types.ResourceName) error
- func NewResourceOverflowError(resource types.ResourceName, hardLimit, currentUsed, newUsed int64) error
- func PrettyPrintResourceNames(a []types.ResourceName) string
- type Errors
- type Manager
- type Quota
- type ResourceNotFound
- type ResourceOverflow
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Mgr default quota manager Mgr = NewManager() )
Functions ¶
func IsSafe ¶
func IsSafe(hardLimits types.ResourceList, currentUsed types.ResourceList, newUsed types.ResourceList, ignoreLimitation bool) error
IsSafe check new used is safe under the hard limits
func NewResourceNotFoundError ¶
func NewResourceNotFoundError(resource types.ResourceName) error
NewResourceNotFoundError ...
func NewResourceOverflowError ¶
func NewResourceOverflowError(resource types.ResourceName, hardLimit, currentUsed, newUsed int64) error
NewResourceOverflowError ...
func PrettyPrintResourceNames ¶
func PrettyPrintResourceNames(a []types.ResourceName) string
PrettyPrintResourceNames make resource names pretty
Types ¶
type Errors ¶
type Errors []error
Errors contains all happened errors
func (Errors) Error ¶
Error takes a slice of all errors that have occurred and returns it as a formatted string
type Manager ¶
type Manager interface { // Create create quota for the reference object Create(ctx context.Context, reference, referenceID string, hardLimits types.ResourceList, usages ...types.ResourceList) (int64, error) // Count returns the total count of quotas according to the query. Count(ctx context.Context, query *q.Query) (int64, error) // Delete delete quota by id Delete(ctx context.Context, id int64) error // Get returns quota by id Get(ctx context.Context, id int64) (*Quota, error) // GetByRef returns quota by reference object GetByRef(ctx context.Context, reference, referenceID string) (*Quota, error) // Update update quota Update(ctx context.Context, quota *Quota) error // List list quotas List(ctx context.Context, query *q.Query) ([]*Quota, error) }
Manager interface provide the management functions for quotas
type ResourceNotFound ¶
type ResourceNotFound struct {
Resource types.ResourceName
}
ResourceNotFound ...
func (*ResourceNotFound) Error ¶
func (e *ResourceNotFound) Error() string
type ResourceOverflow ¶
type ResourceOverflow struct { Resource types.ResourceName HardLimit int64 CurrentUsed int64 NewUsed int64 }
ResourceOverflow ...
func (*ResourceOverflow) Error ¶
func (e *ResourceOverflow) Error() string
Click to show internal directories.
Click to hide internal directories.