Skip to main content

Module state

Module state 

Source
Expand description

Shared application state for the HTTP control plane.

AppState is Clone-able (all inner handles are Arc/optional) and is threaded through axum handlers via with_state. The in-memory registry is a projection cache over JetStream — it is intentionally not the source of truth (CHATROOM.md Session 16). On startup a future version will replay cellos.events.> to rebuild this map; for now it is populated by writes from POST /v1/formations.

Structs§

AppState
CellRecord
Projected view of an execution cell. Fields are kept minimal — the authoritative cell state is in JetStream; this is just a cache for GET /v1/cells list latency.
FormationRecord
Projected view of a formation. The full submitted document is retained so GET /v1/formations/{id} can echo the original spec — clients build their own state machines from this plus the WebSocket event stream.

Enums§

ApplyOutcome
Whether apply_event_payload changed the projection. Distinguishing the two lets the replay path log meaningful “applied vs skipped” counts and lets tests assert that unknown events are tolerated.
FormationStatus
Lifecycle status of a formation. Mirrors the projector’s state machine (CHATROOM Session 16 §state-machine-table). Only PENDING is emitted directly on POST; all other transitions are driven by CloudEvents observed on JetStream.

Type Aliases§

ApiToken
Required bearer token, validated against Authorization: Bearer <token>. When None the server refuses to start (see main.rs).