commonware_storage/adb/
mod.rs

1//! A collection of authenticated databases (ADB).
2//!
3//! # Terminology
4//!
5//! A _key_ in an authenticated database either has a _value_ or it doesn't. Two types of
6//! _operations_ can be applied to the db to modify the state of a specific key. A key that has a
7//! value can change to one without a value through the _delete_ operation. The _update_ operation
8//! gives a key a specific value whether it previously had no value or had a different value.
9//!
10//! Keys with values are called _active_. An operation is called _active_ if (1) its key is active,
11//! (2) it is an update operation, and (3) it is the most recent operation for that key.
12
13use thiserror::Error;
14
15pub mod any;
16pub mod current;
17pub mod immutable;
18
19/// Errors that can occur when interacting with an authenticated database.
20#[derive(Error, Debug)]
21pub enum Error {
22    #[error("mmr error: {0}")]
23    Mmr(#[from] crate::mmr::Error),
24
25    #[error("metadata error: {0}")]
26    Metadata(#[from] crate::metadata::Error),
27
28    #[error("journal error: {0}")]
29    Journal(#[from] crate::journal::Error),
30
31    #[error("operation pruned: {0}")]
32    OperationPruned(u64),
33
34    /// The requested key was not found in the snapshot.
35    #[error("key not found")]
36    KeyNotFound,
37}