pub struct CeremonyDefinition { /* private fields */ }Implementations§
Source§impl CeremonyDefinition
impl CeremonyDefinition
pub fn guards_are_satisfied( &self, transition: &CeremonyTransition, records: &BTreeMap<StepId, StepExecutionRecord>, context: &CeremonyContext, ) -> bool
Sourcepub fn guard_is_satisfied_for_transition(
&self,
guard: &CeremonyGuard,
transition: &CeremonyTransition,
records: &BTreeMap<StepId, StepExecutionRecord>,
context: &CeremonyContext,
) -> bool
pub fn guard_is_satisfied_for_transition( &self, guard: &CeremonyGuard, transition: &CeremonyTransition, records: &BTreeMap<StepId, StepExecutionRecord>, context: &CeremonyContext, ) -> bool
Evaluate one guard with definition-owned step repetition semantics.
A raw COMPLETED record is not enough for a repeating step: its
structured stop condition must also hold. Keeping that rule here makes
transition selection, instance projections and aggregate enforcement
agree on what completion means.
Sourcepub fn repeat_requirements_are_satisfied(
&self,
state_id: &StateId,
records: &BTreeMap<StepId, StepExecutionRecord>,
) -> bool
pub fn repeat_requirements_are_satisfied( &self, state_id: &StateId, records: &BTreeMap<StepId, StepExecutionRecord>, ) -> bool
Whether every repeating step in state_id has reached its declared
structured stop condition.
Sourcepub fn repeat_requirements_are_satisfied_for_transition(
&self,
transition: &CeremonyTransition,
records: &BTreeMap<StepId, StepExecutionRecord>,
) -> bool
pub fn repeat_requirements_are_satisfied_for_transition( &self, transition: &CeremonyTransition, records: &BTreeMap<StepId, StepExecutionRecord>, ) -> bool
Whether source-state repeats either reached their stop condition or have an exact exhaustion guard on this transition.
Source§impl CeremonyDefinition
impl CeremonyDefinition
pub fn new( name: CeremonyName, version: CeremonyVersion, description: Option<CeremonyDescription>, inputs: impl IntoIterator<Item = CeremonyInputDefinition>, outputs: impl IntoIterator<Item = CeremonyOutputDefinition>, states: impl IntoIterator<Item = CeremonyState>, transitions: impl IntoIterator<Item = CeremonyTransition>, steps: impl IntoIterator<Item = CeremonyStep>, guards: impl IntoIterator<Item = CeremonyGuard>, roles: impl IntoIterator<Item = CeremonyRole>, ) -> Result<Self, DomainError>
Sourcepub fn new_with_transition_budgets(
name: CeremonyName,
version: CeremonyVersion,
description: Option<CeremonyDescription>,
inputs: impl IntoIterator<Item = CeremonyInputDefinition>,
outputs: impl IntoIterator<Item = CeremonyOutputDefinition>,
states: impl IntoIterator<Item = CeremonyState>,
transitions: impl IntoIterator<Item = CeremonyTransition>,
steps: impl IntoIterator<Item = CeremonyStep>,
guards: impl IntoIterator<Item = CeremonyGuard>,
roles: impl IntoIterator<Item = CeremonyRole>,
max_transitions: Option<MaxTransitions>,
max_bounces: Option<MaxBounces>,
) -> Result<Self, DomainError>
pub fn new_with_transition_budgets( name: CeremonyName, version: CeremonyVersion, description: Option<CeremonyDescription>, inputs: impl IntoIterator<Item = CeremonyInputDefinition>, outputs: impl IntoIterator<Item = CeremonyOutputDefinition>, states: impl IntoIterator<Item = CeremonyState>, transitions: impl IntoIterator<Item = CeremonyTransition>, steps: impl IntoIterator<Item = CeremonyStep>, guards: impl IntoIterator<Item = CeremonyGuard>, roles: impl IntoIterator<Item = CeremonyRole>, max_transitions: Option<MaxTransitions>, max_bounces: Option<MaxBounces>, ) -> Result<Self, DomainError>
Construct with transition budgets installed before structural validation.
A cyclic graph cannot be constructed uncapped and repaired afterward: the missing bound is itself a blocking definition defect.
pub fn name(&self) -> &CeremonyName
pub fn version(&self) -> &CeremonyVersion
pub fn description(&self) -> Option<&CeremonyDescription>
pub fn inputs(&self) -> &BTreeMap<InputName, CeremonyInputDefinition>
pub fn outputs(&self) -> &BTreeMap<OutputName, CeremonyOutputDefinition>
pub fn states(&self) -> &BTreeMap<StateId, CeremonyState>
pub fn transitions(&self) -> &[CeremonyTransition]
pub fn steps(&self) -> &BTreeMap<StepId, CeremonyStep>
Sourcepub fn steps_in_declaration_order(
&self,
) -> impl Iterator<Item = &CeremonyStep> + '_
pub fn steps_in_declaration_order( &self, ) -> impl Iterator<Item = &CeremonyStep> + '_
Iterate over every step in its declaration order.
Step identifiers remain indexed separately for efficient lookup; execution order is an explicit part of the ceremony definition.
pub fn guards(&self) -> &BTreeMap<GuardName, CeremonyGuard>
pub fn roles(&self) -> &BTreeMap<RoleId, CeremonyRole>
pub fn with_max_parallel(self, max_parallel: MaxParallel) -> Self
pub fn max_parallel(&self) -> MaxParallel
pub const fn max_transitions(&self) -> Option<MaxTransitions>
pub const fn max_bounces(&self) -> Option<MaxBounces>
pub const fn with_ceremony_timeout(self, timeout: CeremonyTimeout) -> Self
pub const fn with_state_timeout(self, timeout: StateTimeout) -> Self
pub const fn ceremony_timeout(&self) -> Option<CeremonyTimeout>
pub const fn state_timeout(&self) -> Option<StateTimeout>
pub fn initial_state_id(&self) -> &StateId
pub fn state(&self, state_id: &StateId) -> Option<&CeremonyState>
pub fn step(&self, step_id: &StepId) -> Option<&CeremonyStep>
pub fn role(&self, role_id: &RoleId) -> Option<&CeremonyRole>
pub fn steps_for_state( &self, state_id: &StateId, ) -> impl Iterator<Item = &CeremonyStep> + '_
pub fn is_terminal_state(&self, state_id: &StateId) -> bool
pub fn transition_for_trigger( &self, state_id: &StateId, trigger: &TransitionTrigger, ) -> Option<&CeremonyTransition>
pub fn available_transitions( &self, state_id: &StateId, ) -> impl Iterator<Item = &CeremonyTransition> + '_
pub fn role_allows(&self, role_id: &RoleId, action: &RoleAction) -> bool
Sourcepub fn role_for_action(&self, action: &RoleAction) -> Option<&CeremonyRole>
pub fn role_for_action(&self, action: &RoleAction) -> Option<&CeremonyRole>
Find the role authorised to perform action, if any.
Roles are scanned in id order and the first whose action set
permits action is returned. Yields None when no declared role
is allowed to perform it.
Sourcepub fn role_id_for_step(&self, step_id: &StepId) -> Result<RoleId, DomainError>
pub fn role_id_for_step(&self, step_id: &StepId) -> Result<RoleId, DomainError>
Resolve the role authorised to execute step_id.
Fails fast with DomainError::InvariantViolated when no role is
allowed to run the step — a ceremony cannot execute a step nobody
owns.
Sourcepub fn role_id_for_transition(
&self,
trigger: &TransitionTrigger,
) -> Result<RoleId, DomainError>
pub fn role_id_for_transition( &self, trigger: &TransitionTrigger, ) -> Result<RoleId, DomainError>
Resolve the role authorised to apply the transition fired by
trigger.
Fails fast with DomainError::InvariantViolated when no role is
allowed to apply it — a ceremony cannot advance through a
transition nobody owns.
Sourcepub fn next_satisfied_transition(
&self,
state_id: &StateId,
records: &BTreeMap<StepId, StepExecutionRecord>,
context: &CeremonyContext,
) -> Option<&CeremonyTransition>
pub fn next_satisfied_transition( &self, state_id: &StateId, records: &BTreeMap<StepId, StepExecutionRecord>, context: &CeremonyContext, ) -> Option<&CeremonyTransition>
Select the next transition out of state_id whose guards are all
currently satisfied by records and context.
Outgoing transitions are evaluated in declaration order and the
first one that is fully enabled is returned. Yields None when
the state has no outgoing transition whose guards hold — either
because the state is terminal or because the ceremony is not yet
ready to advance.
Sourcepub fn digest(&self) -> Result<CeremonyDefinitionDigest, DomainError>
pub fn digest(&self) -> Result<CeremonyDefinitionDigest, DomainError>
The identity of this definition’s content.
Computed over canonical JSON of the whole aggregate rather than over the document it arrived in: two YAML files differing in whitespace, key order or comments describe the same working session and must agree, while any material difference must not.
Encoding the aggregate through serde rather than by hand is
deliberate. A hand-written encoder that forgets a field produces
two materially different definitions with one digest, and
nothing would report it; here a field cannot be left out, and a
field added later changes the digest, which is correct because
it is material.
Canonical because serde_json maps are ordered — see
serde_json_emits_sorted_keys for the guard that keeps that
assumption from being silently withdrawn.
Sourcepub fn analyze(&self) -> CeremonyValidationReport
pub fn analyze(&self) -> CeremonyValidationReport
Collect every defect in the definition instead of stopping at the first one.
A single error is enough to reject a definition but not enough to correct one. An author — human or agent — needs the full set to fix a draft in one pass.
Findings are emitted in check order, so the first blocking one
is exactly the error Self::new raises.
Trait Implementations§
Source§impl Clone for CeremonyDefinition
impl Clone for CeremonyDefinition
Source§fn clone(&self) -> CeremonyDefinition
fn clone(&self) -> CeremonyDefinition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more