Skip to main content

Module workload_kind

Module workload_kind 

Source
Expand description

Workload-kind registry (cog-boundary audit M3; ADR-099 section 2).

A workload kind owns the pieces of the placement path that depend on what is being placed: manifest body validation, how a verified package becomes a WorkloadSpec, and which adapter routes can run it. The rest of the path (signature checks, seeding, gating, scoring, dispatch) is kind-agnostic and looks the kind up here instead of assuming cog.

Registration is explicit: KindRegistry::builtin builds a registry holding the in-tree kinds (cog), and callers add more with KindRegistry::register. There is no global mutable state.

Structs§

CogKind
Native, container and Seed-hosted cog packages.
DuplicateKind
A kind id was registered twice.
HealthSample
One poll of an instance.
HealthSpec
How a kind’s instances are polled.
KindRegistry
Kinds by id.
ProjectFacts
Everything prepare_project checks a project against.
ProjectKind
Per-project kernels.
UnknownKind
No kind is registered under this id (the id is truncated to MAX_KIND_LEN characters).

Enums§

Health
A kind’s verdict on one poll.
ProjectPrepareError
Why a project could not be turned into a workload.
SampleState
The adapter state a poll saw.

Constants§

KIND_PROJECT
Manifest kind string.
MAX_KIND_LEN
Longest kind id accepted from a manifest (and the most unauthenticated kind text ever echoed into an error or chain event).

Traits§

WorkloadKind
What a workload kind contributes to validation and placement.

Functions§

judge_process
The default judgment (a process-backed workload): running is healthy, a degraded or unexpectedly exited process is not, an unknown instance is a miss, and a clean one-shot exit is finished.
load_cog_shaped
Verify and load a package whose verified body is cog-shaped, refusing it unless the verified envelope’s kind is expected (closes the window between peeking the kind and verifying the package).
peek_kind_in
peek_manifest_kind over manifest bytes the caller already read, so one read serves the peek and the verification that follows.
peek_manifest_kind
The kind a package directory’s manifest declares, if the manifest is a bounded regular file that parses far enough to say and the kind is a valid token of at most MAX_KIND_LEN characters. None leaves the failure to package verification, which reports it precisely. The result is unauthenticated: it only selects which registered kind verifies the package, and that kind re-checks the verified envelope.
prepare_project
Verify the certificate chain and the manifest binding, then build the workload the logical adapter runs. Refuses a revoked or replaced key, a certificate for another project and a missing root.
project_healthy
Health of a running project kernel: its handshake must name the expected project, and not every shared service may be down.
validate_envelope
Validate an envelope through the registry: the kind must be registered and its body must pass that kind’s validation.