pub struct ParticipantConversation { /* private fields */ }Expand description
Event-sourced participant conversation.
This aggregate is intentionally not Clone: at most one owner may prepare
the next event ordinal. Its lifecycle state remains private and has no raw
into_parts escape hatch.
use liminal_protocol::lifecycle::ParticipantConversation;
fn require_clone<T: Clone>() {}
require_clone::<ParticipantConversation>();Implementations§
Source§impl ParticipantConversation
impl ParticipantConversation
Sourcepub const fn from_genesis(genesis: ConversationGenesis) -> Self
pub const fn from_genesis(genesis: ConversationGenesis) -> Self
Starts an empty aggregate from immutable genesis configuration.
Sourcepub const fn conversation_id(&self) -> ConversationId
pub const fn conversation_id(&self) -> ConversationId
Returns this aggregate’s stable conversation identifier.
Sourcepub const fn next_event_ordinal(&self) -> u64
pub const fn next_event_ordinal(&self) -> u64
Returns the exact ordinal required of the next durable event.
Sourcepub const fn genesis_validated(&self) -> bool
pub const fn genesis_validated(&self) -> bool
Reports whether the one-shot genesis-validation event has committed.
Sourcepub const fn decide_genesis_validation(self) -> ConversationDecision
pub const fn decide_genesis_validation(self) -> ConversationDecision
Consumes the aggregate into a durability decision for genesis validation.
A successful decision owns the pre-state inside ConversationCommit,
preventing another event from being prepared at the same ordinal while
durable append is pending.
Sourcepub const fn decide_operation(
self,
operation: ConversationOperation,
) -> ConversationDecision
pub const fn decide_operation( self, operation: ConversationOperation, ) -> ConversationDecision
Consumes the aggregate into a durability decision for one lifecycle operation.
Every operation payload’s public producer consumes one of the crate’s
own sealed commit values (each payload type documents its exact sealed
input), so the shell records only operations that actually committed;
validated cold restore is the one raw promotion path into those
inputs. Every arm carries the
conversation named by its producing commit, and a mismatch against
this shell’s conversation is refused before any event is selected. A
successful decision owns the pre-state inside ConversationCommit
exactly as genesis validation does: no state advances until the
durable append is confirmed by consuming
ConversationCommit::commit.
Sourcepub fn replay(
self,
event: ConversationEvent,
) -> Result<Self, ConversationReplayFailure>
pub fn replay( self, event: ConversationEvent, ) -> Result<Self, ConversationReplayFailure>
Consumes one decoded durable event into the next replay state.
§Errors
Returns ConversationReplayFailure retaining the unchanged pre-state
unless conversation identifier, ordinal, body precondition, and the
resulting ordinal all validate before mutation.