#[non_exhaustive]pub enum ItzmaError {
Show 36 variants
Storage(Error),
Serde {
path: String,
source: Error,
},
InvalidNamespaceId(String),
NamespaceExists(String),
NamespaceNotFound(String),
ManifestExists(String),
Unrecoverable {
reason: String,
keys: Vec<String>,
},
InvalidSchema(&'static str),
DimensionMismatch {
expected: usize,
got: usize,
},
InvalidVector(&'static str),
UnknownAttr {
field: String,
},
AttrTypeMismatch {
field: String,
expected: &'static str,
found: &'static str,
},
InvalidAttrs(&'static str),
InvalidColumns(&'static str),
InvalidQuery(&'static str),
InvalidConfig(&'static str),
EmptyBatch,
WriteContention {
attempts: u32,
},
ManifestContention {
attempts: u32,
},
WalGap {
expected: u64,
found: u64,
},
UnsupportedFormat {
version: u32,
},
WalFormatTooNew {
found: u32,
supported: u32,
},
SegmentFormatTooNew {
found: u32,
supported: u32,
},
WalFormatTooOld {
have: u32,
need: u32,
},
SegmentFormatTooOld {
have: u32,
need: u32,
},
CorruptSegment {
path: String,
reason: String,
},
CorruptIndex {
path: String,
reason: String,
},
CorruptSparseIndex {
path: String,
reason: String,
},
CorruptAttrIndex {
path: String,
reason: String,
},
CorruptWal {
path: String,
reason: String,
},
InvalidKey(&'static str),
InvalidId(&'static str),
KeyConflict {
key: String,
},
BatchTooLarge {
bytes: u64,
max: u64,
},
ReadBudgetExceeded {
path: String,
needed: u64,
max: u64,
},
CorruptManifest(String),
}Expand description
Everything that can go wrong in itzma-core.
The enum is #[non_exhaustive], so downstream match expressions need a
wildcard arm. New variants can then be added without a breaking change.
Input is validated before any storage call, so the input-shaped variants
(InvalidNamespaceId,
InvalidSchema,
DimensionMismatch,
InvalidVector, InvalidId,
InvalidQuery, EmptyBatch)
never leave a partial write behind.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Storage(Error)
The object store failed. Passed through unchanged, and never retried
except inside the two contention loops (WriteContention and
ManifestContention).
Serde
An object was fetched but its JSON could not be decoded (or, on the write side, an entry could not be encoded).
Fields
InvalidNamespaceId(String)
The namespace id is empty, longer than 64 bytes, or contains anything
outside [a-z0-9_-]. Keeping / out of ids keeps namespaces from
nesting into each other’s prefixes.
NamespaceExists(String)
Namespace::create was called for an id whose manifest already exists.
NamespaceNotFound(String)
Namespace::open was called for an id with no manifest.
ManifestExists(String)
Namespace::recover was called for an id whose manifest exists, or that
another recovery wrote first. Nothing was changed. The namespace is
there to open.
Unrecoverable
Namespace::recover cannot rebuild the manifest from what the store
holds. Nothing was written. reason says what is missing, and keys are
the objects to put back from a replica, a versioned bucket or a backup.
Once they are back, running recover again can succeed.
Fields
InvalidSchema(&'static str)
The schema passed to Namespace::create cannot be used. Today that
means dim == 0.
DimensionMismatch
A vector’s length differs from the namespace’s dim. Raised for
documents on write and for the query vector on read.
InvalidVector(&'static str)
A vector has a NaN or infinite component, or is all zeros under the cosine metric (which has no direction to compare).
UnknownAttr
A document’s attributes, or a predicate, name a field the namespace’s attribute schema does not declare.
AttrTypeMismatch
A value or an operator does not fit the declared type of a field.
expected is what the schema or the operator needs, found what was
given.
Fields
InvalidAttrs(&'static str)
A document’s attrs are not acceptable under the namespace’s attribute
schema for a reason that is not one field’s type: not a JSON object, or
a set with too many elements.
InvalidColumns(&'static str)
A DocColumns batch is malformed: offsets that do
not start at zero, go down or overrun their buffer, a column that does
not mark every row, text that is not UTF-8, a repeated or empty column
name, or batches of one stream that do not share their columns.
InvalidQuery(&'static str)
QueryOptions that cannot be run: a shortlist
factor or a probe count of zero.
InvalidConfig(&'static str)
A process-wide setting was refused: for instance sizing the compute
pools with configure_cpu after they started,
or with zero threads.
EmptyBatch
upsert or delete was called with nothing to write.
WriteContention
A WAL append lost the put-if-absent race 32 times in a row and gave up. Retrying the whole call is safe: nothing was written.
ManifestContention
A manifest compare-and-swap lost the race 32 times in a row and gave up. Compaction’s publish step is bound by the same cap, and so is raising a segment’s generation mark before an index build writes its object; nothing was written then either.
WalGap
The WAL is not a contiguous run of sequence numbers. The write path never leaves a hole, so this means an object was deleted by hand or there is a bug.
Fields
UnsupportedFormat
An object carries a format_version this build does not understand.
WalFormatTooNew
The namespace’s manifest says its WAL may hold objects in a format newer than this build reads. Nothing was read or written. Upgrade the build, then retry. Raised for every operation on the namespace, since each one loads the manifest first.
Fields
SegmentFormatTooNew
The namespace’s manifest says its segments may be in a format newer than
this build reads. Nothing was read or written. Upgrade the build, then
retry. Raised for every operation on the namespace, like
ItzmaError::WalFormatTooNew.
Fields
WalFormatTooOld
The namespace’s WAL format is lower than the operation needs. A keyed
write needs level 3, fencing WAL objects in Namespace::gc needs level
4, and a namespace created by an older build is at 2. Nothing was
written or changed. Once every build that touches the namespace reads
the newer format, raise it with Namespace::upgrade_wal_format.
SegmentFormatTooOld
The namespace’s segment format is lower than the operation needs.
Namespace::index needs level 2, because an index is built for the
block-addressable layout, and a namespace created by an older build is
at level one. Nothing was written or changed. Once every build that
touches the namespace reads version 2, raise it with
Namespace::upgrade_segment_format.
CorruptSegment
A segment object cannot be used: it is truncated, has the wrong magic, disagrees with its own counts, has ids out of order, or is missing although the manifest lists it. Also raised when a segment’s dimension differs from the namespace schema.
CorruptIndex
An index object cannot be used: it is truncated, has the wrong magic, a
kind this build does not know, counts, offsets or a head length that
disagree with each other, values that are not finite, or a row count or
data size that differs from the segment it was built for.
A query never falls back to a flat scan over one (exact skips indexes
altogether), and index with rebuild replaces it.
Fields
CorruptSparseIndex
A sparse inverted-index object cannot be used: it is truncated, has
the wrong magic, counts or offsets that disagree with each other, or
a row count that differs from the segment it was built for. A query
never falls back to a flat scan over one, and
Namespace::index_sparse with
rebuild replaces it.
Fields
CorruptAttrIndex
An attribute index object cannot be used: it is truncated, has the
wrong magic, a field directory or an entry that is not sorted, counts
that disagree with each other, or names a row the segment does not
have. A query never falls back to scanning without it, and
Namespace::index_attrs with
rebuild replaces it.
Fields
CorruptWal
A binary WAL object (format version 2) cannot be used: it is truncated, names an unknown codec, disagrees with its own lengths or counts, holds a ZSTD frame that does not match its header, has invalid UTF-8 or JSON inside, or has trailing bytes. Also raised on the write side when a length cannot be encoded. An object without the WAL magic is refused the same way.
Fields
InvalidKey(&'static str)
An idempotency key is empty or longer than 128 bytes. Raised before anything is written.
InvalidId(&'static str)
A document id (on upsert) or a delete id is empty or longer than
document::MAX_ID_BYTES bytes.
Raised before anything is written.
KeyConflict
A WAL object already carries this idempotency key but holds a batch of a different size, so the key is being reused for a different write. Nothing was written. A key names one batch.
BatchTooLarge
A write batch is bigger than the writer limit,
MAX_BODY_BYTES. Nothing was built or
written. Split the load into several batches; each is atomic, the split
as a whole is not.
Fields
ReadBudgetExceeded
A query or a compaction run would read more than the handle’s read
budget. Nothing was written. needed is the total of the
objects the read had asked for when it hit the limit, this one
included. Compact to shorten the WAL tail, or raise the budget with
Namespace::with_read_budget.
Fields
CorruptManifest(String)
The manifest’s segment list breaks the invariant: ids that do not
parse, ranges that do not start at 1 or do not follow one another, or a
last range that does not end at wal_folded_through. Also raised when
schema.json holds a different schema from the manifest.
Trait Implementations§
Source§impl Debug for ItzmaError
impl Debug for ItzmaError
Source§impl Display for ItzmaError
impl Display for ItzmaError
Source§impl Error for ItzmaError
impl Error for ItzmaError
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()
Auto Trait Implementations§
impl !RefUnwindSafe for ItzmaError
impl !UnwindSafe for ItzmaError
impl Forget for ItzmaError
impl Freeze for ItzmaErrorwhere
&'static str: Freeze,
*const dyn Error + Sync + Send is !null: Freeze,
PhantomData<dyn Error + Sync + Send>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const () is !null: Freeze,
PhantomData<ErrorData<CustomOwner>>: Freeze,
*const dyn Any + Send is !null: Freeze,
PhantomData<dyn Any + Send>: Freeze,
NonZero<u64>: Freeze,
*const ErrorImpl is !null: Freeze,
PhantomData<ErrorImpl>: Freeze,
PhantomData<String>: Freeze,
impl Move for ItzmaError
impl Send for ItzmaError
impl Sync for ItzmaError
impl Unpin for ItzmaError
impl UnsafeUnpin for ItzmaErrorwhere
&'static str: UnsafeUnpin,
*const dyn Error + Sync + Send is !null: UnsafeUnpin,
PhantomData<dyn Error + Sync + Send>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const () is !null: UnsafeUnpin,
PhantomData<ErrorData<CustomOwner>>: UnsafeUnpin,
*const dyn Any + Send is !null: UnsafeUnpin,
PhantomData<dyn Any + Send>: UnsafeUnpin,
NonZeroU64Inner: UnsafeUnpin,
*const ErrorImpl is !null: UnsafeUnpin,
PhantomData<ErrorImpl>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
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> 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 more