pub enum JournalError {
CasConflict(String),
Integrity(String),
Io {
message: String,
source: Error,
},
}Expand description
Why a journal operation failed, split into the three classes a caller must treat differently.
| variant | journal state | response |
|---|---|---|
JournalError::CasConflict | known: someone else won | retryable — abort(token) → re-read head → rebuild → replay the input (spec §8.3) |
JournalError::Integrity | known: contradictory | never retryable — retrying replays the same contradiction |
JournalError::Io | unknown | neither; the append may or may not have landed |
No variant permits publishing kernel effects (§9.1, “journal failure 不发布 kernel effects”).
Variants§
CasConflict(String)
The CAS precondition did not hold: the journal head (or checkpoint pointer) moved.
Integrity(String)
The journal contents contradict themselves or the caller’s claim: a broken digest chain, a
step_seq that does not follow its predecessor, a checkpoint whose covered_head does not
match the record at its through_step_seq.
Io
The storage layer failed (disk full, permission denied, hard links unsupported). Distinct from both of the above: the journal state is unknown, not known-conflicting and not known-corrupt.
Implementations§
Source§impl JournalError
impl JournalError
pub fn conflict(message: impl Into<String>) -> Self
pub fn integrity(message: impl Into<String>) -> Self
pub fn io(message: impl Into<String>, source: Error) -> Self
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
A CAS conflict is the only class the durable-step protocol may retry. Integrity is a
permanent contradiction; Io leaves the journal in an unknown state, so a retry could
double-append rather than resolve anything — the caller must re-read the head first.
Trait Implementations§
Source§impl Debug for JournalError
impl Debug for JournalError
Source§impl Display for JournalError
impl Display for JournalError
Source§impl Error for JournalError
impl Error for JournalError
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()
Source§impl From<JournalError> for HostTransitionError
impl From<JournalError> for HostTransitionError
Source§fn from(source: JournalError) -> Self
fn from(source: JournalError) -> Self
Source§impl From<JournalError> for Error
impl From<JournalError> for Error
Source§fn from(err: JournalError) -> Self
fn from(err: JournalError) -> Self
Io keeps its ErrorKind (so callers that already match on crate::Error::Io keep
working); the two journal-semantic classes become crate::Error::Other carrying their
full message — the SDK-level error has no variant that could preserve the distinction, and
silently mapping a CAS conflict onto Io would tell a caller to retry storage instead of
rebuilding.
Auto Trait Implementations§
impl !RefUnwindSafe for JournalError
impl !UnwindSafe for JournalError
impl Freeze for JournalError
impl Send for JournalError
impl Sync for JournalError
impl Unpin for JournalError
impl UnsafeUnpin for JournalError
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more