Crate nano_wal

Crate nano_wal 

Source
Expand description

A simple Write-Ahead Log (WAL) implementation with per-key segment sets.

This crate provides a lightweight, performant WAL implementation designed for append-only operations with automatic segment rotation and expiration.

§Features

  • Per-key segment isolation for better performance
  • Automatic segment rotation based on retention policies
  • Optional record headers for metadata storage
  • Configurable durability guarantees
  • Batch operations for improved throughput

§Examples

use nano_wal::{Wal, WalOptions};
use bytes::Bytes;
use std::time::Duration;

// Create a new WAL with custom retention
let options = WalOptions::default()
    .retention(Duration::from_secs(3600));
let mut wal = Wal::new("./my_wal", options)?;

// Append an entry
let entry_ref = wal.append_entry(
    "user_123",
    None,
    Bytes::from("event data"),
    true
)?;

// Read the entry back
let data = wal.read_entry_at(entry_ref)?;

Structs§

EntryRef
Reference to a specific entry location in the WAL.
Wal
Write-Ahead Log with per-key segment sets.
WalOptions
Configuration options for WAL behavior.

Enums§

WalError
Custom error type for WAL operations.

Type Aliases§

Result
Custom Result type for WAL operations.