pub enum MnemoError {
Show 18 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,
},
FormatTooOld {
version: u16,
},
EmbedderMismatch {
stored: EmbedderIdentity,
given: EmbedderIdentity,
},
}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.
On a file older than v9 (which no build opens read-write since the
v8 sunset) the reason itself says to run mnemo compact, which
completes the work and converts the file, and the generic advice is
left off.
FormatTooOld
The v8 sunset (v0.13): the file’s format is older than v9, so it
can’t be opened read-write. A v8 file still opens read-only
(crate::Mnemo::open_read_only); mnemo compact (or
crate::Mnemo::compact_file) converts any v4–v8 file to v9 and
keeps every live memory.
EmbedderMismatch
EMBED-ID-1: the embedder passed to crate::Mnemo::set_embedder
isn’t the one this file’s vectors came from. The file records the
identity of the first embedder attached to it; a different name,
width or normalize flag is refused, because mixing two models’
vectors in one file silently breaks recall. Use the original
embedder, or create a new store for the new model.
Fields
stored: EmbedderIdentityThe identity the file records.
given: EmbedderIdentityThe identity of the embedder that was passed.
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()