#[non_exhaustive]pub enum CommitError<E> {
ForeignBatch,
CheckpointRegression {
current: SequencePosition,
attempted: SequencePosition,
},
Store(E),
}Expand description
Why a commit failed.
Generic over the adapter’s own error rather than carrying a String, for the
same reason AppendError is: a caller must be able to
tell a port-level outcome from an adapter failure without pattern-matching on
text. #[non_exhaustive], so a match needs a wildcard arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ForeignBatch
The batch was begun on a different store instance.
Rejected at run time rather than at compile time, and deliberately.
Tying the batch to the receiver’s lifetime was compiled and refuted: a
lifetime names a region, not an instance, so two &Store references
unify to a common region and b.commit(a.begin(), …) still type-checks.
The only type-level fix is a generative brand, which forbids the batch
escaping the closure that begins it — defeating the caller the hazard is
about. So an adapter stamps an identity minted per store instance at
begin and compares it here; with an owned
batch the stamp is a field and the check is an integer comparison.
CheckpointRegression
position is below the checkpoint already recorded.
Both values are carried so a caller can log the gap rather than re-derive it with a second round trip.
Fields
current: SequencePositionThe checkpoint the store already holds.
attempted: SequencePositionThe position the caller tried to move it to.
Store(E)
The adapter failed for its own reasons.
Trait Implementations§
Source§impl<E: Clone> Clone for CommitError<E>
impl<E: Clone> Clone for CommitError<E>
Source§impl<E: Debug> Debug for CommitError<E>
impl<E: Debug> Debug for CommitError<E>
Source§impl<E> Display for CommitError<E>where
E: Display,
impl<E> Display for CommitError<E>where
E: Display,
impl<E: Eq> Eq for CommitError<E>
Source§impl<E> Error for CommitError<E>
impl<E> Error for CommitError<E>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()