Raw Block (Rust)#
A built-in L2 adapter that stores KV objects in fixed-size slots on a raw block device or pre-sized file using the Rust raw-device I/O bindings. It reuses the existing raw-block metadata checkpoint model and writes directly into the caller-provided load buffers during prefetch.
Required fields:
device_path: Raw device path or pre-sized file path.slot_bytes: Fixed slot size in bytes. Must be aligned toblock_align.
Optional fields:
capacity_bytes: Optional cap on the usable device bytes. Default0means use the full device/file size.use_odirect:trueorfalse(defaulttrue).block_align: Device alignment in bytes (default4096).header_bytes: Per-slot header reservation (default4096).meta_total_bytes: Reserved metadata checkpoint region (default256MiB).meta_magic/meta_version: Metadata checkpoint identity/version knobs.meta_checkpoint_interval_sec/meta_idle_quiet_ms/meta_enable_periodic/meta_verify_on_load: Checkpoint and recovery controls carried over from the legacy raw-block backend.load_checkpoint_on_init: Load an existing on-device metadata checkpoint during startup (defaulttrue). Set tofalseto start with an empty in-memory index instead.enable_zero_copy: Try aligned direct-buffer I/O when possible.io_engine: Rust raw-block I/O engine. Valid values are"posix"(default synchronouspread/pwritepath),"io_uring"(direct Rust io_uring syscall path).use_uring_cmd: Enable NVMe passthrough via io_uring command interface for direct device access. Requiresio_engine="io_uring"and NVMe character device node (e.g.,/dev/ng0n1).iouring_queue_depth: Queue depth forio_engine="io_uring".max_data_transfer_size: Maximum data transfer size foruse_uring_cmd=true. Large transfers are split into smaller chunks that fit within device limits.num_store_workers/num_lookup_workers/num_load_workers: Worker-thread counts for each operation type.
Notes:
raw_blockis a server-owned MP adapter. It does not support per-TP device-path mappings in MP mode.raw_blockremains"type": "raw_block"for all supported engines.raw_blockowns on-device slot allocation, checkpointing, and recovery throughRawBlockCore. Slot reclamation is driven by the shared/global L2 eviction controller or explicitdelete()calls.If
use_odirectis enabled, the server’s--l1-align-bytesshould be at leastblock_align.persist_enabledmust remaintruefor this adapter.For
use_uring_cmd=true,device_pathmust use the NVMe character device node (e.g.,/dev/ng0n1) instead of the block device node (/dev/nvme0n1). The character device provides direct NVMe command passthrough.use_uring_cmdrequiresio_engine="io_uring"to be set.When
use_uring_cmd=true,use_odirectis ignored for NVMe namespace character devices.
Configuration examples:
# Basic raw_block with posix I/O
--l2-adapter '{"type": "raw_block", "device_path": "/dev/nvme0n1", "slot_bytes": 1048576, "block_align": 4096, "header_bytes": 4096, "meta_total_bytes": 268435456, "use_odirect": true, "num_store_workers": 2, "num_lookup_workers": 1, "num_load_workers": 4}'
# With io_uring
--l2-adapter '{"type": "raw_block", "device_path": "/dev/nvme0n1", "slot_bytes": 1048576, "io_engine": "io_uring", "iouring_queue_depth": 256, "use_odirect": true}'
# With io_uring_cmd (NVMe passthrough)
--l2-adapter '{"type": "raw_block", "device_path": "/dev/ng0n1", "slot_bytes": 1048576, "io_engine": "io_uring", "use_uring_cmd": true, "iouring_queue_depth": 256, "max_data_transfer_size": 131072, "use_odirect": false}'
# With eviction
--l2-adapter '{"type": "raw_block", "device_path": "/dev/nvme0n1", "slot_bytes": 1048576, "load_checkpoint_on_init": false, "eviction": {"eviction_policy": "LRU", "trigger_watermark": 0.9, "eviction_ratio": 0.1}}'