quota

package
v0.0.0-...-d3da680 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package quota manages run and tryjobs quotas per user

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager manages the quota accounts for CV users.

func NewManager

func NewManager(gf gerrit.Factory) *Manager

NewManager creates a new quota manager.

func (*Manager) CreditRunQuota

func (qm *Manager) CreditRunQuota(ctx context.Context, r *run.Run) (*quotapb.OpResult, *cfgpb.UserLimit, error)

CreditRunQuota credits the run quota into a given user's account.

func (*Manager) CreditTryjobQuota

func (qm *Manager) CreditTryjobQuota(ctx context.Context) (*quotapb.OpResult, error)

CreditTryjobQuota credits the tryjob quota into a given user's account.

func (*Manager) DebitRunQuota

func (qm *Manager) DebitRunQuota(ctx context.Context, r *run.Run) (*quotapb.OpResult, *cfgpb.UserLimit, error)

DebitRunQuota debits the run quota from a given user's account.

func (*Manager) DebitTryjobQuota

func (qm *Manager) DebitTryjobQuota(ctx context.Context) (*quotapb.OpResult, error)

DebitTryjobQuota debits the tryjob quota from a given user's account.

func (*Manager) RunQuotaAccountID

func (qm *Manager) RunQuotaAccountID(r *run.Run) *quotapb.AccountID

RunQuotaAccountID returns the account id of the run quota for the given run.

func (*Manager) WritePolicy

func (qm *Manager) WritePolicy(ctx context.Context, project string) (*quotapb.PolicyConfigID, error)

WritePolicy writes lucicfg updates to the srvquota policies.

type SrvQuota

type SrvQuota interface {
	LoadPoliciesManual(ctx context.Context, realm string, version string, cfg *quotapb.PolicyConfig) (*quotapb.PolicyConfigID, error)
	AccountID(realm, namespace, name, resourceType string) *quotapb.AccountID
}

SrvQuota manages quota

Jump to

Keyboard shortcuts

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