Documentation
¶
Overview ¶
Package pooling is the pure worker-pooling placement policy (ADR-0046): it maps a function to either a solo worker (its own process, the default) or a shared pool worker keyed by (namespace, runtime, worker-id). It is the placement counterpart to scheduler.Placement (node selection, ADR-0017) — pooling answers WHICH shared worker within a node a function joins, never which node.
The policy is pure and deterministic: no I/O, no clock, no store. The reconciler (internal/function) lists the same-key functions from the store and serializes the admitted members into the pool worker's manifest; this package only decides placement.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccessHashOf ¶ added in v0.5.0
func AccessHashOf(spec v1.FunctionSpec, owned, grants []string) string
AccessHashOf is the first 16 hex digits of the SHA-256 of spec's canonical access document: KV, Blob, Catalogs, SQL and Links sorted by alias, Secrets and Config in declared order, owned and grants sorted. nil counts as empty, so a Function with no access has one fixed hash. Pure.
Types ¶
type Assigner ¶
type Assigner interface {
// Assign places fn under key (KeyOf with fn's access). Solo when fn.Spec.Pooling.Worker == "". Otherwise members
// are ordered by name, the first `limit` are admitted (Pooled), the rest Rejected with a clear reason.
// Deterministic — a pure function of declared membership, stable under reconcile order.
Assign(fn *v1.Function, key PoolKey, sameKey []*v1.Function, limit int) (Assignment, error)
}
Assigner places a function given its key, every function declaring that key — fn included, Ready or not — and the per-pool limit. The V1 driver is the explicit worker-id policy (NewAssigner); the automatic/threshold policy is the future second driver behind this port (ADR-0046 Open questions).
func NewAssigner ¶
func NewAssigner() Assigner
NewAssigner returns the V1 explicit-worker-id pooling policy.
type Assignment ¶
Assignment is where a function lands. Pooled==false ⇒ a solo worker (Key is the zero value). Rejected==true ⇒ pooled but over the cap: hold the function NotReady with Reason.
type PoolKey ¶
type PoolKey struct {
Namespace v1.NamespaceName
Runtime string
Worker string // the owner-chosen worker id (FunctionSpec.Pooling.Worker)
// AccessHash is AccessHashOf the member's access: Functions that reach different data or hold different grants
// never share a process.
AccessHash string
}
PoolKey identifies one shared worker: functions sharing all four co-locate in one pool worker. Pooling never consults the resourceGroup for placement (ADR-0046 Decision 2) beyond the grant it carries into AccessHash — a different worker id, runtime, namespace or access is a different worker.
func KeyOf ¶
KeyOf returns the pool key a function declares given its owned data and grants (AccessHashOf), and whether it opts into pooling at all (a non-empty worker id). It is the canonical grouping used by both the policy and the reconciler so the two never disagree on what "same key" means.
func ParsePool ¶ added in v0.5.0
func ParsePool(ns v1.NamespaceName, s string) (key PoolKey, ok bool)
ParsePool parses the status.pool form back into a key of namespace ns. A worker id is a DNS-1123 label (Function.Validate), so the form has exactly three non-empty "/"-segments; ok is false otherwise.