tempest-kv 0.0.2

Key-Value storage layer for TempestDB
Documentation
use crate::{
    base::{Comparer, DefaultComparer},
    //iterator::Filter,
};

/// Bundles the pluggable strategy types for a [`Storage`] instance into a
/// single type parameter.
///
/// Every storage silo is generic over one `StorageStrategy`, which determines:
/// - How keys are split, compared, and ordered ([`Comparer`])
/// - Which key-value entries are visible to readers ([`Filter`])
///
/// Keeping these together as associated types means callsites only ever carry
/// one type parameter rather than one per strategy, and adding new strategy
/// axes in the future (e.g. a compaction policy) is a non-breaking change -
/// just a new associated type with a default.
///
/// The KV layer has no knowledge of what the strategy types encode. All
/// semantics - HLC timestamps, TTL expiry, MVCC watermarks - are owned by
/// the implementor. For plain KV usage with no engine semantics, use
/// [`DefaultStrategy`].
pub trait StorageStrategy {
    /// Determines how keys are split into prefix and suffix, and how they
    /// are ordered physically and logically. See [`Comparer`] for the full
    /// contract.
    type Comparer: Comparer;

    ///// Determines which key-value entries are visible on the read and
    ///// compaction paths. See [`Filter`] for the full contract.
    //type Filter: Filter<Self::Comparer>;
}

/// A [`StorageStrategy`] for plain key-value usage with no engine semantics.
///
/// Uses [`DefaultComparer`], which treats the entire key as the prefix with
/// no suffix, and `()` as the [`Filter`], which keeps every entry visible.
/// Compiles down to zero overhead - all strategy abstractions are eliminated
/// by the compiler.
///
/// Useful for tests and for embedders that want a simple LSM store without
/// MVCC, HLC timestamps, or any other engine-level concerns.
pub struct DefaultStrategy;

impl StorageStrategy for DefaultStrategy {
    type Comparer = DefaultComparer;
    //type Filter = ();
}