Documentation ¶
Index ¶
- Variables
- type MockQuotaService
- func (m *MockQuotaService) Get(ctx context.Context, item QuotaItem) (*Quota, error)
- func (m *MockQuotaService) Inc(ctx context.Context, item QuotaItem, delta int) error
- func (m *MockQuotaService) Set(ctx context.Context, item QuotaItem, quantity int) error
- func (m *MockQuotaService) SetLimit(ctx context.Context, item QuotaItem, limit int) error
- type MockQuotaStorage
- type Quota
- type QuotaExceededError
- type QuotaItem
- type QuotaItemInUse
- type QuotaService
- type QuotaStorage
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotEnoughReserved = errors.New("Not enough reserved items") ErrLimitLowerThanAllocated = errors.New("New limit is less than the current allocated value") ErrLessThanZero = errors.New("Invalid value, cannot be less than 0") ErrQuotaNotFound = errors.New("quota not found") )
View Source
var UnlimitedQuota = Quota{Limit: -1, InUse: 0}
UnlimitedQuota is the struct which any new unlimited quota copies from.
Functions ¶
This section is empty.
Types ¶
type MockQuotaService ¶
type MockQuotaService struct { OnInc func(QuotaItem, int) error OnSet func(QuotaItem, int) error OnSetLimit func(QuotaItem, int) error OnGet func(QuotaItem) (*Quota, error) }
type MockQuotaStorage ¶
type MockQuotaStorage struct { OnSet func(string, int) error OnSetLimit func(string, int) error OnGet func(string) (*Quota, error) }
type Quota ¶
func (*Quota) IsUnlimited ¶
type QuotaExceededError ¶
func (*QuotaExceededError) Error ¶
func (err *QuotaExceededError) Error() string
type QuotaItemInUse ¶
type QuotaService ¶
Click to show internal directories.
Click to hide internal directories.