armdb 0.12.0

sharded bitcask key-value storage optimized for NVMe
Documentation
//! Held-shard mutation seam used by [`crate::upsert::upsert_via_held`].
//!
//! Lives outside `access` so core collections (`Const*` / `Zero*` / …) can
//! expose `upsert` without the `armour` feature.

use crate::error::DbResult;

/// What a decide-and-write body needs under an already-held shard lock.
pub(crate) trait HeldOps {
    type Key;
    type Val;
    /// Existence check that does **not** decode the value — an
    /// undecodable-but-present row still answers `true`. The RPC conditional
    /// write relies on this; `upsert` does not.
    // Live in the default build through the `Access::Shard` bound, but unused
    // when the RPC adapter is off — that is the only consumer.
    #[cfg_attr(not(feature = "rpc"), allow(dead_code))]
    fn try_contains(&mut self, key: &Self::Key) -> DbResult<bool>;
    /// Call `f` with the current value and return `Some(f(..))`, or `None` when
    /// the key is absent.
    ///
    /// Contract, relied on by [`upsert_via_held`](crate::upsert::upsert_via_held):
    /// on `Ok(None)` the closure must **not** have been called, and on `Ok(Some)`
    /// it must have been called exactly once.
    fn with_value<R>(
        &mut self,
        key: &Self::Key,
        f: impl FnOnce(&Self::Val) -> R,
    ) -> DbResult<Option<R>>;
    fn put(&mut self, key: &Self::Key, value: Self::Val) -> DbResult<()>;
    fn delete(&mut self, key: &Self::Key) -> DbResult<()>;
}

mod const_family;

#[cfg(feature = "var-collections")]
mod var;

#[cfg(feature = "typed-tree")]
mod zero;

#[cfg(feature = "typed-tree")]
mod typed;

// `VarTyped*` needs both gates: `var-collections` alone does not imply
// `typed-tree` (see the `lib.rs` re-exports), and the shard types live behind
// the pair.
#[cfg(all(feature = "typed-tree", feature = "var-collections"))]
mod var_typed;

#[cfg(feature = "fjall")]
mod lsm;