Skip to main content

DeterministicConflictStore

Struct DeterministicConflictStore 

Source
pub struct DeterministicConflictStore<S> { /* private fields */ }
Expand description

A wrapper around an event store that injects a deterministic number of version conflicts before delegating to the inner store.

This is useful for testing retry logic where you need predictable conflict behavior rather than the probabilistic chaos testing approach.

§Examples

use eventcore_testing::deterministic::DeterministicConflictStore;
use eventcore_memory::InMemoryEventStore;

// Create a store that will fail with VersionConflict twice before succeeding
let inner = InMemoryEventStore::new();
let store = DeterministicConflictStore::new(inner, 2);

// First two append_events calls will return VersionConflict
// Third call will delegate to inner store

Implementations§

Source§

impl<S> DeterministicConflictStore<S>

Source

pub fn new(store: S, conflict_count: u32) -> Self

Creates a new DeterministicConflictStore that will inject conflict_count version conflicts before delegating to the inner store.

§Arguments
  • store - The inner event store to delegate to after conflicts are exhausted
  • conflict_count - Number of conflicts to inject before delegation

Trait Implementations§

Source§

impl<S> EventStore for DeterministicConflictStore<S>
where S: EventStore + Sync,

Source§

async fn read_stream<E: Event>( &self, stream_id: StreamId, ) -> Result<EventStreamReader<E>, EventStoreError>

Read all events from a stream. Read more
Source§

async fn append_events( &self, writes: StreamWrites, ) -> Result<EventStreamSlice, EventStoreError>

Atomically append events to multiple streams with optimistic concurrency control. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<S> ChaosEventStoreExt for S
where S: EventStore + Sync,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V