pub struct CeremonyDefinition { /* private fields */ }Implementations§
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>
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 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
pub fn guards_are_satisfied( &self, transition: &CeremonyTransition, records: &BTreeMap<StepId, StepExecutionRecord>, context: &CeremonyContext, ) -> 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 choreographer_v1_digest_migration(
&self,
) -> Result<CeremonyDefinitionDigestMigration, DomainError>
pub fn choreographer_v1_digest_migration( &self, ) -> Result<CeremonyDefinitionDigestMigration, DomainError>
The verified identity transition used by the pre-rename state importer. Both identities are derived from this exact aggregate.
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