use snafu::Snafu;
#[derive(Debug, Snafu)]
#[non_exhaustive]
#[snafu(visibility(pub(crate)))]
pub enum BackendError {
BadHMAC,
Argon2Failure {
source: argon2::Error,
},
KeyDeserialization,
ItemSerialization,
ItemDeserialization,
Compression {
source: std::io::Error,
},
Decompression {
source: std::io::Error,
},
SegmentIO {
source: std::io::Error,
},
SegmentLength,
NoData,
NoDataIO {
source: std::io::Error,
},
InvalidCompression,
EntryIO {
source: std::io::Error,
},
InvalidLsmState,
}
#[derive(Debug, Snafu)]
#[non_exhaustive]
#[snafu(visibility(pub(crate)))]
pub enum CryptoBoxError {
#[snafu(display("Directory already exists: {}", directory))]
DirectoryAlreadyExists {
directory: String,
},
FailedCreatingDirectory {
directory: String,
source: std::io::Error,
},
RootKeyEncryption {
source: BackendError,
},
RootKeyDecryption {
source: BackendError,
},
#[snafu(display("Failed to write to path: {}", path))]
RootKeyIO {
path: String,
source: std::io::Error,
},
RootKeySerial {
source: serde_cbor::Error,
},
#[snafu(display("Failed to initialize root namespace: {}", path))]
RootNamespaceInit {
path: String,
source: BackendError,
},
#[snafu(display("Failed to open root namespace: {}", path))]
RootNamespaceOpen {
path: String,
source: BackendError,
},
#[snafu(display("Path does not exist or is not a directory: {}", path))]
DirectoryDoesNotExist {
path: String,
},
MissingNamespaceDirectory,
MissingConfiguration,
#[snafu(display("Failed to open a namespace {}", name))]
NamespaceOpen {
name: String,
source: BackendError,
},
#[snafu(display("No such namespace: {}", name))]
NoSuchNamespace {
name: String,
},
Fetch {
source: BackendError,
},
Store {
source: BackendError,
},
#[snafu(display("One or more errors occurred flushing: {:?}", sources))]
Flush {
sources: Vec<(Option<String>, BackendError)>,
},
#[cfg(feature = "experimental-async")]
AsyncError,
}