admission

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package admission evaluates deterministic pre-scheduling requirements.

Index

Constants

View Source
const EvaluatorVersion = "builtin/v1"

Variables

This section is empty.

Functions

func WithNamespaceEnforcer

func WithNamespaceEnforcer(enforcer *namespace.Enforcer) func(*Controller)

WithNamespaceEnforcer installs the namespace and per-namespace resource quota gate.

func WithParallelism

func WithParallelism(workers int) func(*Controller)

WithParallelism bounds concurrent per-task processing within one reconcile batch (default 4; 1 = serial).

func WithShard

func WithShard(index, count int) func(*Controller)

WithShard confines this instance to one tenant-consistent claim shard (ADR-016): it claims only tasks whose tenant maps to index of count. Count 0 disables sharding. Every controller instance must share the same count.

func WithTenantQuotas

func WithTenantQuotas(quotaStore store.TenantQuotaStore) func(*Controller)

WithTenantQuotas installs the tenant aggregate consumption quota gate (v0.6): a task is admitted only while the tenant's current window usage plus the task's own budget ceiling stays within every configured limit. The store re-checks the same gate atomically at commit time, so concurrent settlements cannot slip past the read-only check here.

Types

type Controller

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

func NewController

func NewController(repository store.ControlStore, engine *Engine, policyEngine *policy.Engine, ownerID string, batch int, claimTTL time.Duration) *Controller

func (*Controller) Reconcile

func (c *Controller) Reconcile(ctx context.Context) (int, error)

Reconcile claims and admits queued tasks. Transient transaction conflicts are retried with bounded backoff (ADR-002); the claim TTL covers permanent failures.

type Decision

type Decision struct {
	Admit      bool
	ReasonCode string
	Reasons    []store.AdmissionReason
}

type Engine

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

func New

func New(limits Limits) *Engine

func (*Engine) Evaluate

func (e *Engine) Evaluate(task store.Task) Decision

type Limits

type Limits struct {
	RuntimeClasses    []string
	MaxTokens         int64
	MaxCostMicroUSD   money.MicroUSD
	MaxToolCalls      int64
	MaxWallSeconds    int64
	MaxCPU            int64
	MaxMemory         int64
	MaxLLMConcurrency int
	// ContainerClasses are runtime classes that execute untrusted workloads
	// in a sandboxed container (oci, microvm). Admission requires every
	// task on these classes to declare explicit CPU, memory and workspace
	// limits — zero values are never allowed (hardening checklist §4.1).
	ContainerClasses []string
}

Jump to

Keyboard shortcuts

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