pub enum MnemoError {
Show 16 variants
Io(Error),
BadMagic,
UnsupportedVersion(u16),
HeaderChecksum,
WrongPassphrase,
PageAuthFailed(u64),
HeaderTampered,
Crypto(String),
Kdf(String),
Serialize(String),
NotFound(String),
DimensionMismatch {
expected: usize,
got: usize,
},
Invalid(String),
Locked {
path: PathBuf,
},
ReadOnly,
NeedsWriteOpen {
reason: &'static str,
},
}Expand description
All errors the Mnemo engine can produce.
Variants§
Io(Error)
An underlying I/O failure.
BadMagic
The file does not begin with the Mnemo magic bytes.
UnsupportedVersion(u16)
The on-disk format version is newer than this build understands.
HeaderChecksum
The header page failed its CRC check — a torn page-0 write or
corruption. crate::Mnemo::open tries to repair this from the WAL.
WrongPassphrase
Returned when the supplied passphrase fails to unwrap the data key. The failure is an authenticated-decryption failure, so it is indistinguishable from a tampered key blob — both are rejected cleanly.
PageAuthFailed(u64)
AEAD authentication failed for a page: corruption or tampering.
HeaderTampered
The v7 header seal failed authentication — at least one mutable header field has been rewritten without the DEK. Open refuses to proceed so a silent rollback or pointer-rewrite attack can’t surface stale data.
Crypto(String)
A low-level cryptographic operation failed.
Kdf(String)
Argon2id key derivation failed.
Serialize(String)
A record failed to (de)serialize.
NotFound(String)
No memory exists with the requested ID.
DimensionMismatch
A vector did not match the database’s configured dimensionality.
Fields
Invalid(String)
A caller-supplied argument was invalid.
Locked
Another process (or another handle in this process) already holds a
conflicting OS file lock on the target .mnemo file. Write handles
take an exclusive lock; read-only handles take a shared lock. Two
writers or a writer + reader will collide.
ReadOnly
A mutation was attempted on a handle opened via
crate::Mnemo::open_read_only. Reopen read-write to mutate.
NeedsWriteOpen
A read-only open was requested but the file has pending on-disk work
that requires a write handle to complete — a committed-but-unchecked
WAL transaction, or a format-version migration older than the current
VERSION. Open read-write once, close cleanly, then reopen read-only.
Trait Implementations§
Source§impl Debug for MnemoError
impl Debug for MnemoError
Source§impl Display for MnemoError
impl Display for MnemoError
Source§impl Error for MnemoError
impl Error for MnemoError
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()