pub enum ExpectedVersion {
NoStream,
Exact(u64),
Any,
}Expand description
Optimistic concurrency control contract for EventStore::append.
The caller declares which sequence number they expect the stream to be at. The store atomically checks this before writing; a mismatch means a concurrent writer modified the stream and the caller must reload and retry.
Variants§
NoStream
The stream must not exist yet (sequence number 0).
Exact(u64)
The stream must be at exactly this sequence number.
Any
Skip the concurrency check entirely.
Do not use in production workflow append paths. Any silently
accepts any write regardless of concurrent modifications, which can
produce duplicate or interleaved events in a stream.
Legitimate uses: MigrationRunner (bulk admin rewrites),
snapshot-accelerated store internals, and test scaffolding where the
caller owns all write access by construction.
For normal workflow event appends always use ExpectedVersion::NoStream
(first event) or ExpectedVersion::Exact (subsequent events).
Trait Implementations§
Source§impl Clone for ExpectedVersion
impl Clone for ExpectedVersion
Source§fn clone(&self) -> ExpectedVersion
fn clone(&self) -> ExpectedVersion
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ExpectedVersion
Source§impl Debug for ExpectedVersion
impl Debug for ExpectedVersion
impl Eq for ExpectedVersion
Source§impl PartialEq for ExpectedVersion
impl PartialEq for ExpectedVersion
Source§fn eq(&self, other: &ExpectedVersion) -> bool
fn eq(&self, other: &ExpectedVersion) -> bool
self and other values to be equal, and is used by ==.