Documentation
¶
Overview ¶
Package quota enforces per-project quotas at admission and meters usage (§7.2).
Index ¶
- type Limits
- type Manager
- func (m *Manager) AddLogBytes(project, env string, n int)
- func (m *Manager) Admit(ctx context.Context, req workload.AdmitRequest) error
- func (m *Manager) AdmitCount(ctx context.Context, envID, what string) error
- func (m *Manager) BuildSlots(ctx context.Context, serviceID string) (projectID string, limit int)
- func (m *Manager) LimitsFor(ctx context.Context, projectID, envID string) (project, env Limits, err error)
- func (m *Manager) Run(ctx context.Context)
- func (m *Manager) UsageOf(ctx context.Context, projectID, envID string) (Usage, error)
- type Usage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limits ¶
type Limits struct {
CPU float64 `json:"cpu,omitempty"` // cores reserved by desired tasks
MemoryMiB int `json:"memoryMiB,omitempty"` // MiB reserved by desired tasks
Tasks int `json:"tasks,omitempty"` // desired tasks
Services int `json:"services,omitempty"`
Jobs int `json:"jobs,omitempty"`
Domains int `json:"domains,omitempty"` // custom domains
ConcurrentBuilds int `json:"concurrentBuilds,omitempty"`
LogsMiBPerDay int `json:"logsMiBPerDay,omitempty"` // metered and warned, not enforced
}
Limits of a project or environment. Zero means unlimited.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) AddLogBytes ¶
AddLogBytes counts ingested log volume (called by the log store).
func (*Manager) AdmitCount ¶
AdmitCount checks adding one job or domain to an environment.
func (*Manager) BuildSlots ¶
BuildSlots tells the build queue how many builds a service's project may run at once (0: no limit).
func (*Manager) LimitsFor ¶
func (m *Manager) LimitsFor(ctx context.Context, projectID, envID string) (project, env Limits, err error)
LimitsFor returns a project's limits and an environment's override.
type Usage ¶
type Usage struct {
CPU float64 `json:"cpu"`
MemoryMiB int `json:"memoryMiB"`
Tasks int `json:"tasks"`
Services int `json:"services"`
Jobs int `json:"jobs"`
Domains int `json:"domains"`
Builds int `json:"builds"` // building now
LogsMiBToday float64 `json:"logsMiBToday"`
}
Usage is what a project or environment holds now.