Skip to main content

CeremonyDefinition

Struct CeremonyDefinition 

Source
pub struct CeremonyDefinition { /* private fields */ }

Implementations§

Source§

impl CeremonyDefinition

Source

pub fn guards_are_satisfied( &self, transition: &CeremonyTransition, records: &BTreeMap<StepId, StepExecutionRecord>, context: &CeremonyContext, ) -> bool

Source

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.

Source

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.

Source

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

Source

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>

Source

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.

Source

pub fn name(&self) -> &CeremonyName

Source

pub fn version(&self) -> &CeremonyVersion

Source

pub fn description(&self) -> Option<&CeremonyDescription>

Source

pub fn inputs(&self) -> &BTreeMap<InputName, CeremonyInputDefinition>

Source

pub fn outputs(&self) -> &BTreeMap<OutputName, CeremonyOutputDefinition>

Source

pub fn states(&self) -> &BTreeMap<StateId, CeremonyState>

Source

pub fn transitions(&self) -> &[CeremonyTransition]

Source

pub fn steps(&self) -> &BTreeMap<StepId, CeremonyStep>

Source

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.

Source

pub fn guards(&self) -> &BTreeMap<GuardName, CeremonyGuard>

Source

pub fn roles(&self) -> &BTreeMap<RoleId, CeremonyRole>

Source

pub fn with_max_parallel(self, max_parallel: MaxParallel) -> Self

Source

pub fn max_parallel(&self) -> MaxParallel

Source

pub const fn max_transitions(&self) -> Option<MaxTransitions>

Source

pub const fn max_bounces(&self) -> Option<MaxBounces>

Source

pub const fn with_ceremony_timeout(self, timeout: CeremonyTimeout) -> Self

Source

pub const fn with_state_timeout(self, timeout: StateTimeout) -> Self

Source

pub const fn ceremony_timeout(&self) -> Option<CeremonyTimeout>

Source

pub const fn state_timeout(&self) -> Option<StateTimeout>

Source

pub fn initial_state_id(&self) -> &StateId

Source

pub fn state(&self, state_id: &StateId) -> Option<&CeremonyState>

Source

pub fn step(&self, step_id: &StepId) -> Option<&CeremonyStep>

Source

pub fn role(&self, role_id: &RoleId) -> Option<&CeremonyRole>

Source

pub fn steps_for_state( &self, state_id: &StateId, ) -> impl Iterator<Item = &CeremonyStep> + '_

Source

pub fn is_terminal_state(&self, state_id: &StateId) -> bool

Source

pub fn transition_for_trigger( &self, state_id: &StateId, trigger: &TransitionTrigger, ) -> Option<&CeremonyTransition>

Source

pub fn available_transitions( &self, state_id: &StateId, ) -> impl Iterator<Item = &CeremonyTransition> + '_

Source

pub fn role_allows(&self, role_id: &RoleId, action: &RoleAction) -> bool

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CeremonyDefinition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CeremonyDefinition

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for CeremonyDefinition

Source§

impl PartialEq for CeremonyDefinition

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for CeremonyDefinition

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for CeremonyDefinition

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.