Skip to main content

CeremonyEventStorePort

Trait CeremonyEventStorePort 

Source
pub trait CeremonyEventStorePort: Send + Sync {
    // Required methods
    fn append<'life0, 'life1, 'async_trait>(
        &'life0 self,
        stream: &'life1 CeremonyId,
        expected: StreamVersion,
        facts: Vec<AuditFact>,
    ) -> Pin<Box<dyn Future<Output = Result<AppendOutcome, DomainError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn read<'life0, 'life1, 'async_trait>(
        &'life0 self,
        stream: &'life1 CeremonyId,
        after: StreamVersion,
        limit: CeremonyEventPageLimit,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<AuditRecord>, DomainError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn read_all<'life0, 'async_trait>(
        &'life0 self,
        from: GlobalPosition,
        limit: CeremonyEventPageLimit,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<PositionedRecord>, DomainError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn head<'life0, 'life1, 'async_trait>(
        &'life0 self,
        stream: &'life1 CeremonyId,
    ) -> Pin<Box<dyn Future<Output = Result<StreamVersion, DomainError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn streams<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<CeremonyId>, DomainError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn append_authorized<'life0, 'life1, 'async_trait>(
        &'life0 self,
        stream: &'life1 CeremonyId,
        expected: StreamVersion,
        facts: Vec<AuditFact>,
        authorization: AuthorizationEvidence,
    ) -> Pin<Box<dyn Future<Output = Result<AppendOutcome, DomainError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}

Required Methods§

Source

fn append<'life0, 'life1, 'async_trait>( &'life0 self, stream: &'life1 CeremonyId, expected: StreamVersion, facts: Vec<AuditFact>, ) -> Pin<Box<dyn Future<Output = Result<AppendOutcome, DomainError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Seal facts as the records that continue stream and land them together, or land nothing.

expected is the version the facts were decided against and is checked inside the same transaction that writes: a stale expectation is an AppendOutcome::Conflict, not an error. An empty batch, a fact from another ceremony, or an event id the stream already holds — or that the batch holds twice — is a DomainError, and nothing of the batch lands either way.

Source

fn read<'life0, 'life1, 'async_trait>( &'life0 self, stream: &'life1 CeremonyId, after: StreamVersion, limit: CeremonyEventPageLimit, ) -> Pin<Box<dyn Future<Output = Result<Vec<AuditRecord>, DomainError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The records of stream with a sequence above after, in order. StreamVersion::EMPTY reads the whole stream.

Source

fn read_all<'life0, 'async_trait>( &'life0 self, from: GlobalPosition, limit: CeremonyEventPageLimit, ) -> Pin<Box<dyn Future<Output = Result<Vec<PositionedRecord>, DomainError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

At most limit records of every stream, in global order, starting at from inclusive.

Source

fn head<'life0, 'life1, 'async_trait>( &'life0 self, stream: &'life1 CeremonyId, ) -> Pin<Box<dyn Future<Output = Result<StreamVersion, DomainError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The version of stream: StreamVersion::EMPTY when nothing was ever appended to it.

Source

fn streams<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<CeremonyId>, DomainError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Every stream the store holds, each once, sorted by id.

Provided Methods§

Source

fn append_authorized<'life0, 'life1, 'async_trait>( &'life0 self, stream: &'life1 CeremonyId, expected: StreamVersion, facts: Vec<AuditFact>, authorization: AuthorizationEvidence, ) -> Pin<Box<dyn Future<Output = Result<AppendOutcome, DomainError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Seal an admitted operation’s facts with its authorization evidence.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§