netabase_store 0.0.8

A type-safe, multi-backend key-value storage library for Rust with support for native (Sled, Redb) and WASM (IndexedDB) environments.
Documentation
#[derive(Debug, thiserror::Error)]
pub enum NetabaseError {
    #[error("There was a conversion Error")]
    Conversion(#[from] EncodingDecodingError),
    #[error("I/O error: {0}")]
    Io(#[from] std::io::Error),
    #[cfg(feature = "sled")]
    #[error("There was an error with the Sled database")]
    SledDatabaseError(#[from] sled::Error),
    #[cfg(feature = "redb")]
    #[error("There was an error with the Redb database")]
    RedbDatabaseError(#[from] redb::DatabaseError),
    #[cfg(feature = "redb")]
    #[error("There was an error with the Redb database")]
    RedbCompactionError(#[from] redb::CompactionError),
    #[cfg(feature = "redb")]
    #[error("There was an error with the Redb database")]
    RedbCommitError(#[from] redb::CommitError),
    #[cfg(feature = "redb")]
    #[error("There was an error with the Redb transaction")]
    RedbTransactionError(#[from] redb::TransactionError),
    #[cfg(feature = "redb")]
    #[error("There was an error with the Redb table")]
    RedbTableError(#[from] redb::TableError),
    #[cfg(feature = "redb")]
    #[error("There was an error with the Redb storage")]
    RedbStorageError(#[from] redb::StorageError),
    #[error("Storage error: {0}")]
    Storage(String),
    #[error("Transaction error: {0}")]
    Transaction(String),
}

#[derive(Debug, thiserror::Error)]
pub enum EncodingDecodingError {
    #[error("There was an error encoding type")]
    Encoding(#[from] bincode::error::EncodeError),
    #[error("There was an error decoding type")]
    Decoding(#[from] bincode::error::DecodeError),
}

#[derive(Debug, thiserror::Error)]
pub enum StoreError {
    #[error("There was an error opening the store tree")]
    OpenTreeError,
    #[error("There was an error opening the store DB")]
    OpenDBError,
}