Skip to main content

made_core/entities/
ceremony_command.rs

1//! [`CeremonyCommand`] — what a caller asks of a running ceremony.
2//!
3//! A command is decided, never applied: [`CeremonyInstance::decide`]
4//! turns it into the events it would produce, or refuses it, and only
5//! the events change state. One variant per mutation the aggregate
6//! accepts, each wrapping a struct that carries exactly what the
7//! corresponding mutator takes.
8//!
9//! Starting a ceremony is not here. A command is addressed to an
10//! instance that exists; opening one is a constructor,
11//! [`CeremonyInstance::decide_start`], which yields the opening event
12//! with nothing to decide against.
13//!
14//! [`CeremonyInstance::decide`]: super::CeremonyInstance::decide
15//! [`CeremonyInstance::decide_start`]: super::CeremonyInstance::decide_start
16
17use super::ceremony_commands::{
18    AcceptChildCompletion, AdoptChildSpawnPlan, ApplyExecutionReceiptResult, ApplyStepResult,
19    ApplyTransition, ApproveGuard, AssertReason, BindParticipant, CancelCeremony,
20    CloseIntervention, DeferGuard, EnforceCeremonyDeadlines, PauseCeremony, PlanCeremonyChildren,
21    RequestIntervention, RespondToIntervention, RespondToInterventionWithEvidence, ResumeCeremony,
22    StartStep,
23};
24
25/// A request to change a ceremony, in the terms the aggregate decides.
26#[derive(Debug, Clone, PartialEq, Eq)]
27pub enum CeremonyCommand {
28    BindParticipant(BindParticipant),
29    StartStep(StartStep),
30    ApplyStepResult(ApplyStepResult),
31    ApplyExecutionReceiptResult(ApplyExecutionReceiptResult),
32    ApplyTransition(ApplyTransition),
33    ApproveGuard(ApproveGuard),
34    DeferGuard(DeferGuard),
35    RequestIntervention(RequestIntervention),
36    RespondToIntervention(RespondToIntervention),
37    RespondToInterventionWithEvidence(RespondToInterventionWithEvidence),
38    AssertReason(AssertReason),
39    CloseIntervention(CloseIntervention),
40    PlanCeremonyChildren(PlanCeremonyChildren),
41    AdoptChildSpawnPlan(AdoptChildSpawnPlan),
42    AcceptChildCompletion(AcceptChildCompletion),
43    PauseCeremony(PauseCeremony),
44    ResumeCeremony(ResumeCeremony),
45    CancelCeremony(CancelCeremony),
46    EnforceCeremonyDeadlines(EnforceCeremonyDeadlines),
47}