Skip to main content

Module state_store

Module state_store 

Source
Expand description

Project-controller SQLite state store.

This module owns every rusqlite::Connection interaction for the project controller’s durable actor/lease/dispatch/diagnostic/layout state, plus the storage and status types those queries read and write. It deliberately depends only on rusqlite, serde_json, and std so that agent-doc-orchestration can call into it without pulling the bundled SQLite C build into its own compile graph.

Orchestration glue (ops-log, sessions.json/session-actors.json projection, read_bootstrap, drift verification) stays in agent-doc-orchestration; this module exposes the SQL primitives those callers stitch together.

Structs§

ActorLastTransition
ActorRecord
ActorTransitionStatus
AdminOperationStatus
Connection
A connection to a SQLite database.
ControlPlaneStoreCounts
DispatchAttemptInsert
DispatchAttemptStatus
ProjectionDiagnosticInsert
ProjectionDiagnosticStatus
QueueBackpressureInsert
QueueBackpressureStatus
QueueControlInsert
QueueControlStatus
QueueHeadStatus
SessionActorCloseoutCommit
SessionActorCloseoutMutation
SessionOperatorStatus
StateEventInsert
StateEventStatus
SupervisorLeaseStatus

Enums§

ActorState

Functions§

actor_documents_empty
True when the documents table holds no rows yet.
actor_record_from_row
commit_session_actor_closeout_in_db
delete_actor_document_tx
#actorprune: hard-delete a dead actor record and its history/lease rows.
has_any_open_in_flight_dispatch
#ctlrecycle: is ANY dispatch in flight across every document/generation? The controller’s idle self-recycle (R1) uses this as its idle proof — it must never exit while a turn is mid-dispatch for any session it coordinates. Same open-set definition as has_open_in_flight_dispatch without the document/generation filter.
has_open_in_flight_dispatch
#qflood: is a dispatch already in flight (accepted, not yet consumed) for this document at generation? Mirrors the open-dispatch shape the restart reconciler keys on. An open dispatch means the current turn already has work queued/running, so an auto re-fire would only pile a redundant trigger into the busy pane.
initialize_state_db
insert_actor_transition
insert_admin_operation_in_db
insert_crash_recovery_marker_in_db
insert_dispatch_attempt_in_db
insert_projection_diagnostic
insert_projection_diagnostic_with_metadata
insert_queue_backpressure_in_db
insert_state_event_in_db
layout_scope_exists
load_actor_record_from_db
load_actor_store_from_db
load_actor_transitions_from_db
load_admin_operations_from_db
load_control_plane_store_counts
load_dispatch_attempts_from_db
load_effective_queue_control_from_db
load_layout_state_from_db
load_projection_diagnostics_from_db
load_queue_backpressure_from_db
load_queue_control_from_db
load_queue_head_from_db
load_session_operator_status_from_db
load_state_events_from_db
load_supervisor_lease_from_db
mark_open_dispatches_consumed
#qflood: mark every open in-flight dispatch for this document consumed. Called when the actor transitions to Ready (the turn finished → its dispatch is done), keeping the open-dispatch set accurate for the next busy episode’s coalescing and for restart recovery. Returns the number of receipts released.
migrate_actor_store_tx
Migrate a legacy session-actors.json store into the empty sqlite state.
open_state_db
sqlite_i64
sqlite_u64
state_db_path
store_actor_record_tx
Run the compare-and-swap actor write transaction.
store_layout_state_in_db
timestamp_secs
upsert_actor_document
Upsert the authoritative documents row for an actor.
upsert_document_cycle_state_in_db
upsert_queue_control_in_db
upsert_queue_head_in_db
upsert_supervisor_lease_in_db