pub struct Engine { /* private fields */ }Expand description
The kernel engine. Cheap to clone (the store and lock map are Arcs; clones
share the same per-session locks).
Implementations§
Source§impl Engine
impl Engine
Sourcepub fn new(store: Arc<dyn StateStore>) -> Self
pub fn new(store: Arc<dyn StateStore>) -> Self
Build an engine over the given store.
Sourcepub fn open_session(
&self,
session_id: &str,
coverage_schema: Option<CoverageSchema>,
) -> Result<InterviewState>
pub fn open_session( &self, session_id: &str, coverage_schema: Option<CoverageSchema>, ) -> Result<InterviewState>
session.open (spec §5): start or resume a session. If new, write the
SessionOpened event with the supplied (or default) coverage schema. If
it already exists, the schema arg is ignored (the original governs) and
the current state is returned.
Sourcepub fn state(&self, session_id: &str) -> Result<InterviewState>
pub fn state(&self, session_id: &str) -> Result<InterviewState>
state.get (spec §5): read-only projection of the session.
Sourcepub fn add_claim(
&self,
session_id: &str,
claim: Claim,
requirement: Option<RequirementMeta>,
) -> Result<InterviewState>
pub fn add_claim( &self, session_id: &str, claim: Claim, requirement: Option<RequirementMeta>, ) -> Result<InterviewState>
append variant add_claim (spec §5). Validates the claim, rejects
duplicate ids, appends, and returns the recomputed state.
Sourcepub fn add_evidence(
&self,
session_id: &str,
evidence: EvidenceEvent,
) -> Result<InterviewState>
pub fn add_evidence( &self, session_id: &str, evidence: EvidenceEvent, ) -> Result<InterviewState>
append variant add_evidence (spec §5).
Sourcepub fn remediate(
&self,
session_id: &str,
remediation: RemediationEvent,
) -> Result<InterviewState>
pub fn remediate( &self, session_id: &str, remediation: RemediationEvent, ) -> Result<InterviewState>
append variant remediate{...} (spec §5). Validates that every target
referenced by the move exists, then appends.
Sourcepub fn next_question(&self, session_id: &str) -> Result<Option<Signal>>
pub fn next_question(&self, session_id: &str) -> Result<Option<Signal>>
question.next (spec §5): the highest-leverage next question, or None.
Sourcepub fn readiness(&self, session_id: &str) -> Result<ReadinessReport>
pub fn readiness(&self, session_id: &str) -> Result<ReadinessReport>
readiness.assess (spec §5 / §6): the readiness report.
Sourcepub fn export(&self, session_id: &str) -> Result<SpecDocument>
pub fn export(&self, session_id: &str) -> Result<SpecDocument>
spec.export (spec §6): the aligned, plan-ready spec document.