pub enum StoreError {
Io(Error),
Codec(String),
Backend(String),
UnsupportedSchema {
found: u32,
supported: u32,
},
Corrupt {
pool_id: Option<PoolId>,
detail: String,
},
PermissionTighten {
path: PathBuf,
source: Error,
},
AlreadyOpen {
path: PathBuf,
},
NeedsRepair {
path: PathBuf,
},
Absent {
path: PathBuf,
},
}Expand description
Failure modes shared by every PoolStateStore implementation.
Disk-backed impls map their backend errors into StoreError::Backend
(preserving the underlying message); decoding failures use
StoreError::Codec; structurally-invalid on-disk records (wrong magic,
truncated value bytes) use StoreError::Corrupt. The
StoreError::UnsupportedSchema variant is reserved for the case where an
on-disk record carries a newer schema_version than this binary understands.
Variants§
Io(Error)
I/O failure (open, read, write, fsync, rename).
Codec(String)
Encoding or decoding failed for an in-store record.
Backend(String)
Backend-specific error from the underlying KV (e.g. redb transaction error). The string captures the backend’s own description.
UnsupportedSchema
On-disk record carries a schema_version higher than supported. The
node MUST refuse to start rather than silently ignoring fields it does
not understand — see ADR 003 §Off-chain voucher state persistence.
Fields
Corrupt
Record bytes are structurally invalid — missing magic, truncated, or otherwise unparseable. Includes the affected id (when it can be recovered) and a free-form detail.
Fields
PermissionTighten
Post-create permission tightening (chmod) failed. Distinct from
StoreError::Io because the operator remediation differs: a
PermissionTighten typically means “the file mode is not 0o600 and the
OS refused to fix it” (read-only mount, missing capability, EPERM on a
foreign-owned inode) — recovery requires manual intervention on the
filesystem, not just retrying the open.
Fields
AlreadyOpen
The store’s database file is already opened (write-locked) by another
process — typically a second decdn fetch/bundle pull against the same
--data-dir. redb holds a process-exclusive lock for the lifetime of the
open Database, so the second opener fails fast rather than letting two
processes corrupt the shared voucher watermark (#942). Run one process
per data dir, give each a distinct --data-dir, or let one process
multiplex internally.
NeedsRepair
The database was not closed cleanly and needs the repair pass that only a writable open performs, so a read-only open cannot proceed. Reached by the post-mortem read of a crashed daemon’s store (#2084): the very case that read exists for is also the one that can leave the file unrepaired.
The remedy is a writable open, and which process performs it depends on who owns the file — so the caller names it, not this variant.
Absent
No database file exists at the path. Distinct from
StoreError::Backend because it is a routine state, not a fault: a
data dir whose store was deleted to force re-adoption has no file, and
the honest report is “there is no store here”, not an errno.
Only a read-only open produces this. A writable open creates the file.
Trait Implementations§
Source§impl Debug for StoreError
impl Debug for StoreError
Source§impl Display for StoreError
impl Display for StoreError
Source§impl Error for StoreError
impl Error for StoreError
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<Error> for StoreError
impl From<Error> for StoreError
Source§impl From<StoreError> for PoolError
impl From<StoreError> for PoolError
Source§fn from(source: StoreError) -> Self
fn from(source: StoreError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for StoreError
impl !UnwindSafe for StoreError
impl Freeze for StoreError
impl Send for StoreError
impl Sync for StoreError
impl Unpin for StoreError
impl UnsafeUnpin for StoreError
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> MaybeSend for Twhere
T: Send,
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.