1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Crate error types: one enum, variants per failure domain.
/// Errors returned by moraine operations.
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
/// Another writer committed a conflicting change; the transaction can be
/// retried against the new state.
#[error("commit conflict: {0}")]
CommitConflict(String),
/// A commit spent its whole internal retry budget on benign races
/// without settling; the caller must re-drive the work itself, usually
/// as smaller commits.
///
/// The text carries none of the four substrings DuckLake's commit loop
/// keys its retry decision on (`conflict`, `concurrent`, `unique`,
/// `primary key`), so an exhausted budget surfaces at once instead of
/// being re-run against a premise that already failed to settle ten
/// times. That wording is part of the wire contract, not incidental
/// diagnostics.
#[error("retry budget exhausted: {0}")]
RetryBudgetExhausted(String),
/// Stored bytes failed to decode: corrupt, truncated, wrong-kind, or
/// written by a newer encoding than this binary understands.
#[error("corruption: {0}")]
Corruption(String),
/// An operation referenced an entity that does not exist (or is not
/// live in the transaction's view).
#[error("not found: {0}")]
NotFound(String),
/// An operation would violate name uniqueness.
#[error("already exists: {0}")]
AlreadyExists(String),
/// An operation would violate a structural constraint (e.g. dropping
/// a schema that still contains tables).
#[error("constraint violation: {0}")]
Constraint(String),
/// A lookup targeted an index whose staged backfill has not completed;
/// it serves no reads until it flips ready.
#[error("index building: {0}")]
IndexBuilding(String),
/// An environment or option value could not be parsed or is out of
/// range.
#[error("configuration: {0}")]
Configuration(String),
/// The underlying store failed (SlateDB / object-store I/O).
#[error("store error")]
Store(#[source] Box<slatedb::Error>),
}
impl From<slatedb::Error> for Error {
fn from(err: slatedb::Error) -> Self {
Self::Store(Box::new(err))
}
}
/// Crate-wide result alias.
pub type Result<T> = std::result::Result<T, Error>;