Skip to main content

WritableEventStore

Trait WritableEventStore 

Source
pub trait WritableEventStore:
    Send
    + Sync
    + 'static {
    // Required method
    fn append<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        token: WriteToken,
        workflow_id: &'life1 WorkflowId,
        events: &'life2 [Event],
        expected_seq: u64,
    ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Write authority for appending workflow-history events.

append requires a WriteToken, so having an Arc<dyn EventStore> or Arc<dyn ReadableEventStore> is not sufficient to write events.

Required Methods§

Source

fn append<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, token: WriteToken, workflow_id: &'life1 WorkflowId, events: &'life2 [Event], expected_seq: u64, ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Atomically appends events to workflow_id when the stored history head equals expected_seq.

Implementations must apply every event in events or none of them. If the current stored head for workflow_id differs from expected_seq, this method must return StoreError::SequenceConflict and leave history unchanged. A first append with expected_seq == 0 creates the workflow history implicitly.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§