tempest-kv 0.0.2

Key-Value storage layer for TempestDB
Documentation
use bytes::Bytes;
use tempest_io::Io;

use crate::{
    StorageError,
    base::{Comparer, InternalKey},
};

//pub(crate) mod filter;
//pub(crate) mod merging;
pub(crate) mod logical_dedup;
pub(crate) mod snapshot;

//pub(crate) use filter::*;
//pub(crate) use merging::*;
pub(crate) use logical_dedup::*;
pub(crate) use snapshot::*;

#[cfg(test)]
pub(crate) mod mock;

/// An async forward iterator over key-value entries in storage.
///
/// Entries are yielded in [`InternalKey`] order. Seeking backwards is a no-op.
/// Call [`close`] when done to release any held resources (e.g. file descriptors).
///
/// [`close`]: StorageIterator::close
pub(crate) trait StorageIterator<I: Io, C: Comparer> {
    /// Advance to and return the next entry, or `None` if exhausted.
    async fn next(&mut self) -> Result<Option<(InternalKey<C, Bytes>, Bytes)>, StorageError>;

    /// Advance the cursor to the first entry with a logical key >= `key`.
    /// If the cursor is already at or past `key`, this is a no-op.
    async fn seek(&mut self, key: InternalKey<C, Bytes>) -> Result<(), StorageError>;
}