quotas

package
v2.2.17+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2018 License: Apache-2.0 Imports: 14 Imported by: 17

Documentation

Index

Constants

View Source
const (
	METADATA_KEY = "quota"
)

Variables

This section is empty.

Functions

func AddQuotaHandler

func AddQuotaHandler(manager *SQuotaManager, prefix string, app *appsrv.Application)

Types

type IQuota

type IQuota interface {
	FetchSystemQuota()
	FetchUsage(projectId string) error
	Update(quota IQuota)
	Add(quota IQuota)
	Sub(quota IQuota)
	Exceed(request IQuota, quota IQuota) error
	IsEmpty() bool
	ToJSON(prefix string) jsonutils.JSONObject
}

type IQuotaStore

type IQuotaStore interface {
	GetQuota(ctx context.Context, tenantId string, quota IQuota) error
	SetQuota(ctx context.Context, userCred mcclient.TokenCredential, tenantId string, quota IQuota) error
}

type SDBQuotaStore

type SDBQuotaStore struct {
}

func NewDBQuotaStore

func NewDBQuotaStore() *SDBQuotaStore

func (*SDBQuotaStore) GetQuota

func (store *SDBQuotaStore) GetQuota(ctx context.Context, tenantId string, quota IQuota) error

func (*SDBQuotaStore) SetQuota

func (store *SDBQuotaStore) SetQuota(ctx context.Context, userCred mcclient.TokenCredential, tenantId string, quota IQuota) error

type SMemoryQuotaStore

type SMemoryQuotaStore struct {
	// contains filtered or unexported fields
}

func NewMemoryQuotaStore

func NewMemoryQuotaStore() *SMemoryQuotaStore

func (*SMemoryQuotaStore) GetQuota

func (self *SMemoryQuotaStore) GetQuota(ctx context.Context, tenantId string, quota IQuota) error

func (*SMemoryQuotaStore) SetQuota

func (self *SMemoryQuotaStore) SetQuota(ctx context.Context, userCred mcclient.TokenCredential, tenantId string, quota IQuota) error

type SQuotaManager

type SQuotaManager struct {
	// contains filtered or unexported fields
}

func NewQuotaManager

func NewQuotaManager(keyword string, quotaData interface{}, persist IQuotaStore, pending IQuotaStore) *SQuotaManager

func (*SQuotaManager) CancelPendingUsage

func (manager *SQuotaManager) CancelPendingUsage(ctx context.Context, userCred mcclient.TokenCredential, projectId string, localUsage IQuota, cancelUsage IQuota) error

func (*SQuotaManager) CheckQuota

func (manager *SQuotaManager) CheckQuota(ctx context.Context, userCred mcclient.TokenCredential, projectId string, request IQuota) (IQuota, error)

func (*SQuotaManager) CheckSetPendingQuota

func (manager *SQuotaManager) CheckSetPendingQuota(ctx context.Context, userCred mcclient.TokenCredential, projectId string, quota IQuota) error

func (*SQuotaManager) GetPendingUsage

func (manager *SQuotaManager) GetPendingUsage(ctx context.Context, projectId string, quota IQuota) error

func (*SQuotaManager) GetQuota

func (manager *SQuotaManager) GetQuota(ctx context.Context, projectId string, quota IQuota) error

func (*SQuotaManager) Keyword

func (manager *SQuotaManager) Keyword() string

func (*SQuotaManager) SetQuota

func (manager *SQuotaManager) SetQuota(ctx context.Context, userCred mcclient.TokenCredential, projectId string, quota IQuota) error

Jump to

Keyboard shortcuts

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