Pierre
10/09/2025, 5:56 PMcriccomini
10/09/2025, 5:57 PMcriccomini
10/09/2025, 5:57 PM/// Represents the kind of public errors that can be returned to the user.
///
/// These are less specific and more prescriptive. Application developers or operators must
/// decide how to proceed. Adding new [ErrorKind]s requires an RFC, and should happen very
/// infrequently.
#[non_exhaustive]
#[derive(Debug, Clone, Copy)]
pub enum ErrorKind {
/// A transaction conflict occurred. The transaction must be retried or dropped.
Transaction,
/// The database has been shutdown. The instance is no longer usable. The user must
/// create a new instance to continue using the database.
Closed(CloseKind),
/// A storage or network service is unavailable. The user must retry or drop the
/// operation.
Unavailable,
/// User attempted an invalid request. This might be:
///
/// - An invalid configuration on initialization
/// - An invalid argument to a method
/// - An invalid method call
/// - A user-supplied plugin such as the compaction schedule supplier or logical clock
/// failed.
///
/// The user must correct the code, configuration, or argument and retry the operation.
Invalid,
/// Persisted data is in an unexpected state. This could be caused by:
///
/// - Temporary or permanent machine or object storage corruption
/// - Incompatible file format versions between clients
/// - An eventual consistency issue in object storage
///
/// The user must fix the data, use a compatible client version, retry the operation,
/// or drop the operation.
Data,
/// An unexpected internal error occurred. Users should not expect to see this error.
/// Please [open a Github issue](https://github.com/slatedb/slatedb/issues/new?template=bug_report.md&title=Internal+error+returned)
/// if you receive this error.
Internal,
}criccomini
10/09/2025, 5:59 PM#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum CloseKind {
/// The database has been shutdown cleanly.
Clean,
/// The current instance has been fenced and is no longer usable.
Fenced,
/// One or more background tasks panicked.
Panic,
}criccomini
10/09/2025, 6:03 PMdb is closed three ways:
1. A user calls db.close() (this is a CloseKind::Clean)
2. The DB detects a fence (this is CloseKind::Fenced, could be from BG task or a user operation the detects it)
3. A background task panics (this is CloseKind::Panic)
When CloseKind::Panic is set, the user may retrieve any panics (multiple bg tasks can panic) using db.poll_panic(). This will returna Box<dyn Any + Send. This could be a SlateDB Error or any other payload. In practice, it will not be a SlateDB error, though. Users may downcast it to various types to see what it is and act accordingly.criccomini
10/09/2025, 6:05 PMcriccomini
10/09/2025, 6:06 PMcriccomini
10/09/2025, 6:07 PMcriccomini
10/09/2025, 6:09 PMPierre
10/09/2025, 6:15 PMPierre
10/09/2025, 6:15 PMcriccomini
10/09/2025, 6:17 PMcriccomini
10/09/2025, 6:20 PMcriccomini
10/09/2025, 6:20 PMcriccomini
10/09/2025, 6:20 PMcriccomini
10/09/2025, 6:20 PMcriccomini
10/09/2025, 6:22 PMcriccomini
10/09/2025, 6:22 PMcriccomini
10/09/2025, 6:23 PMraftario
10/09/2025, 7:06 PMPierre
10/09/2025, 7:29 PMPierre
10/09/2025, 7:29 PMPierre
10/09/2025, 7:30 PMPierre
10/09/2025, 7:31 PMcriccomini
10/09/2025, 7:52 PMcriccomini
10/09/2025, 7:52 PMPierre
10/09/2025, 8:27 PMPierre
10/09/2025, 8:27 PM