Skip to main content

StoreError

Enum StoreError 

Source
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

§found: u32

Version number read from disk.

§supported: u32

Highest version this binary understands.

§

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

§pool_id: Option<PoolId>

Id of the corrupt record, or None if the corruption is at the table / file level and no key could be recovered.

§detail: String

Human-readable detail for the operator log.

§

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

§path: PathBuf

Filesystem path of the affected file.

§source: Error

Underlying I/O error returned by the chmod syscall.

§

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.

Fields

§path: PathBuf

Filesystem path of the locked database file.

§

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.

Fields

§path: PathBuf

Filesystem path of the unrepaired database file.

§

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.

Fields

§path: PathBuf

Filesystem path that holds no database.

Trait Implementations§

Source§

impl Debug for StoreError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for StoreError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for StoreError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for StoreError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<StoreError> for PoolError

Source§

fn from(source: StoreError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more