Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

GitHub

This documentation is part of the "Projects with Books" initiative at zenOSmosis.

The source code for this project is available on GitHub.

Glossary

Loading…

Glossary

Relevant source files

This page provides definitions for codebase-specific terms, abbreviations, and domain concepts used throughout the SIMD R Drive project. It serves as a technical reference for developers to understand the relationship between high-level concepts and their implementation in the Rust source code.

Core Concepts

TermDefinitionCode Pointer
Append-OnlyA storage model where data is only added to the end of a file. Existing data is never modified or deleted in-place.src/lib.rs13
DataStoreThe primary handle for interacting with the storage engine, providing methods for reading, writing, and management.src/storage_engine/data_store.rs:27-33
EntryHandleA zero-copy structure that provides access to a specific payload’s bytes via memory mapping.simd-r-drive-entry-handle/src/entry_handle.rs:17-25
KeyIndexerAn in-memory structure that maps 64-bit key hashes to their corresponding 48-bit file offsets.src/storage_engine/key_indexer.rs:15-20
TombstoneA marker used to indicate that a key has been logically deleted. In the core engine, this is a single NULL_BYTE.src/storage_engine.rs24
Zero-CopyA design principle where data is accessed directly from memory-mapped files without being copied into intermediate buffers.README.md:43-50

Data Structures and Implementation

Entry Layout

The storage engine uses a specific binary layout for every entry to ensure alignment and integrity. Non-tombstone entries are padded to ensure the payload starts on a PAYLOAD_ALIGNMENT boundary.

Entry Layout Diagram

graph TD
    subgraph "On-Disk Entry Structure"
        [A] -- "Pre-Pad (Alignment)" --> [B]
        [B] -- "Payload (Data)" --> [C]
        [C] -- "EntryMetadata" --> [D]
    end

    subgraph "Code Entities"
        [B] -- "Accessed via" --> [EH_SLICE]
        [C] -- "Defined by" --> [EM_STRUCT]
    end

    [EH_SLICE] -- "EntryHandle::as_slice()" --> [SRC_EH]
    [EM_STRUCT] -- "EntryMetadata struct" --> [SRC_EM]

    [SRC_EH] -- "[simd-r-drive-entry-handle/src/entry_handle.rs:151-155]()" --> [FIN]
    [SRC_EM] -- "[simd-r-drive-entry-handle/src/entry_metadata.rs:46-50]()" --> [FIN]

Sources: README.md:112-120 simd-r-drive-entry-handle/src/entry_metadata.rs:11-30 src/storage_engine/entry_iterator.rs:80-125

Key Indexing and Hashing

The system utilizes XXH3 hashing for keys and a custom indexing mechanism to locate data efficiently while maintaining a small memory footprint.

Sources: src/storage_engine/key_indexer.rs:15-30 src/storage_engine/digest.rs:1-8


Extension Concepts

The simd-r-drive-extensions crate introduces higher-level abstractions built on top of the raw DataStore.

TTL (Time-To-Live)

A mechanism to automatically expire entries after a certain duration.

Storage Options

A way to explicitly store None values, distinguishing them from keys that simply do not exist in the index (which return NotFound).

Sources: extensions/src/utils/option_serializer.rs:24-63 CHANGELOG.md:78-80


Technical Terms Reference

TermTechnical DetailSources
PAYLOAD_ALIGNMENTDefaulted to 64 bytes to ensure SIMD- and cacheline-safe zero-copy access across SSE/AVX/NEON.CHANGELOG.md:93-96
METADATA_SIZEThe fixed size of the EntryMetadata footer (20 bytes).simd-r-drive-entry-handle/src/entry_metadata.rs:13-23
EntryIteratorTraverses the file backward from tail_offset using prev_offset pointers, ensuring only the latest version of a key is returned.src/storage_engine/entry_iterator.rs:21-25
simd_copyOptimized memory copy functions using vectorized instructions (AVX2/NEON/Scalar).src/storage_engine/data_store.rs5
NULL_BYTEA single 0x00 byte used to represent a deleted entry (tombstone) in the core engine.src/storage_engine/constants.rs4
EntryStreamA wrapper around EntryHandle that implements std::io::Read, allowing zero-copy streaming of large payloads.src/lib.rs:86-88

System Data Flow

The following diagram bridges the natural language concept of “Reading a Key” to the specific code entities involved in the process within the DataStore implementation.

DataStore Read Flow

sequenceDiagram
    participant User as "User Code"
    participant DS as "DataStore::read()"
    participant KI as "KeyIndexer (RwLock)"
    participant MM as "Mmap (Arc<Mmap>)"
    participant EH as "EntryHandle"

    User->>DS: read(key)
    DS->>KI: lookup hash in index
    KI-->>DS: offset
    DS->>MM: Access memory at offset
    DS->>EH: EntryHandle::from_arc_mmap()
    EH-->>User: EntryHandle (Zero-Copy)

Sources: src/storage_engine/data_store.rs:27-33 src/storage_engine/traits.rs:1-5 src/storage_engine/entry_iterator.rs:121-125 simd-r-drive-entry-handle/src/entry_handle.rs:45-50