armdb 0.1.12

sharded bitcask key-value storage optimized for NVMe
Documentation
use crate::entry::EntryHeader;
use crate::error::DbResult;

/// Trait for trees that can receive replicated entries.
pub trait ReplicationTarget: Send + Sync {
    /// Apply entry with known key/value split (streaming mode, O(1) routing).
    fn apply_entry(
        &self,
        shard_id: u8,
        file_id: u32,
        entry_offset: u64,
        header: &EntryHeader,
        key: &[u8],
        value: &[u8],
    ) -> DbResult<()>;

    /// Try to apply entry with CRC matching (catch-up mode).
    /// Returns true if CRC matched and entry was applied.
    fn try_apply_entry(
        &self,
        shard_id: u8,
        file_id: u32,
        entry_offset: u64,
        header: &EntryHeader,
        raw_after_header: &[u8],
    ) -> DbResult<bool>;

    /// The key length (K) for this tree type.
    fn key_len(&self) -> usize;
}