quota

package
v0.0.85-test Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: AGPL-3.0 Imports: 6 Imported by: 322

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidQuotaTarget = errors.New("invalid quota target")

Functions

This section is empty.

Types

type QuotaService

type QuotaService struct {
	AuthTokenService models.UserTokenService
	Cfg              *setting.Cfg
	SQLStore         sqlstore.Store
	Logger           log.Logger
}

func ProvideService

func ProvideService(cfg *setting.Cfg, tokenService models.UserTokenService, sqlStore *sqlstore.SQLStore) *QuotaService

func (*QuotaService) CheckQuotaReached

func (qs *QuotaService) CheckQuotaReached(ctx context.Context, target string, scopeParams *ScopeParameters) (bool, error)

CheckQuotaReached check that quota is reached for a target. If ScopeParameters are not defined, only global scope is checked

func (*QuotaService) QuotaReached

func (qs *QuotaService) QuotaReached(c *models.ReqContext, target string) (bool, error)

QuotaReached checks that quota is reached for a target. Runs CheckQuotaReached and take context and scope parameters from the request context

type ScopeParameters

type ScopeParameters struct {
	OrgId  int64
	UserId int64
}

type Service

type Service interface {
	QuotaReached(c *models.ReqContext, target string) (bool, error)
	CheckQuotaReached(ctx context.Context, target string, scopeParams *ScopeParameters) (bool, error)
}

Jump to

Keyboard shortcuts

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