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 storeImplementations§
Source§impl<S> DeterministicConflictStore<S>
impl<S> DeterministicConflictStore<S>
Sourcepub fn new(store: S, conflict_count: u32) -> Self
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 exhaustedconflict_count- Number of conflicts to inject before delegation
Trait Implementations§
Source§impl<S> EventStore for DeterministicConflictStore<S>where
S: EventStore + Sync,
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>
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>
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§
impl<S> !Freeze for DeterministicConflictStore<S>
impl<S> RefUnwindSafe for DeterministicConflictStore<S>where
S: RefUnwindSafe,
impl<S> Send for DeterministicConflictStore<S>where
S: Send,
impl<S> Sync for DeterministicConflictStore<S>where
S: Sync,
impl<S> Unpin for DeterministicConflictStore<S>where
S: Unpin,
impl<S> UnsafeUnpin for DeterministicConflictStore<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for DeterministicConflictStore<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more