#[non_exhaustive]pub struct CommitBundle {
pub journal_completions: Vec<JournalCompletion>,
pub events: Vec<EventBatch>,
pub interaction_finishes: Vec<InteractionFinish>,
pub interaction_invalidations: Vec<CaseInvalidation>,
pub interaction_inserts: Vec<InteractionInsert>,
pub outbox_entries: Vec<OutboxEntry>,
pub replay_record: Option<ReplayRecord>,
pub turn_phase: Option<TurnPhaseUpdate>,
}Expand description
Everything one commit writes, applied all or nothing.
Compared with PartialEq only, because the replay record it may carry
holds a sampling temperature and therefore a float.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.journal_completions: Vec<JournalCompletion>Journal outcomes to record.
events: Vec<EventBatch>Event batches to append.
interaction_finishes: Vec<InteractionFinish>Interactions to settle.
interaction_invalidations: Vec<CaseInvalidation>Cases whose revision-bound interactions are invalidated.
interaction_inserts: Vec<InteractionInsert>Interactions to insert.
outbox_entries: Vec<OutboxEntry>Outbox rows to enqueue.
replay_record: Option<ReplayRecord>Replay record to upsert.
turn_phase: Option<TurnPhaseUpdate>Turn phase to write.
Implementations§
Source§impl CommitBundle
impl CommitBundle
Sourcepub fn with_journal_completion(
self,
command_id: CommandId,
outcome: JournalOutcome,
) -> Self
pub fn with_journal_completion( self, command_id: CommandId, outcome: JournalOutcome, ) -> Self
Adds a journal completion.
Sourcepub fn with_events(self, batch: EventBatch) -> Self
pub fn with_events(self, batch: EventBatch) -> Self
Adds an event batch.
Sourcepub fn with_interaction_finish(
self,
interaction_id: InteractionId,
outcome: ResolutionOutcome,
) -> Self
pub fn with_interaction_finish( self, interaction_id: InteractionId, outcome: ResolutionOutcome, ) -> Self
Adds an interaction finish.
Sourcepub fn with_invalidation(
self,
case_key: CaseKey,
new_revision: CaseRevision,
reason: InvalidationReason,
) -> Self
pub fn with_invalidation( self, case_key: CaseKey, new_revision: CaseRevision, reason: InvalidationReason, ) -> Self
Adds a case invalidation.
Sourcepub fn with_interaction_insert(
self,
interaction: Interaction,
replace_blocking: bool,
) -> Self
pub fn with_interaction_insert( self, interaction: Interaction, replace_blocking: bool, ) -> Self
Adds an interaction insert.
Sourcepub fn with_outbox_entry(self, entry: OutboxEntry) -> Self
pub fn with_outbox_entry(self, entry: OutboxEntry) -> Self
Adds an outbox entry.
Sourcepub fn with_replay_record(self, record: ReplayRecord) -> Self
pub fn with_replay_record(self, record: ReplayRecord) -> Self
Sets the replay record.
Sourcepub fn with_turn_phase(self, turn_id: TurnId, phase: TurnPhase) -> Self
pub fn with_turn_phase(self, turn_id: TurnId, phase: TurnPhase) -> Self
Sets the turn phase update.
Sourcepub fn validate(&self, account: &AccountId) -> Result<(), StoreError>
pub fn validate(&self, account: &AccountId) -> Result<(), StoreError>
Checks the bundle before anything is written: every account-bearing item
must belong to account, and no event batch may be empty.
Implementations call this first; adopters writing their own store should too, so a foreign item is refused identically everywhere.
§Errors
Other(BUNDLE_ACCOUNT_MISMATCH)for a foreign item.Other(INVALID_RECORD)for an empty event batch.