Crate rustlite

Crate rustlite 

Source
Expand description

§RustLite

A lightweight, high-performance embedded database written in Rust with ACID guarantees.

§Quick Start

use rustlite::Database;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create a persistent database (data survives restarts)
    let db = Database::open("./my_database")?;

    // Insert data
    db.put(b"user:1:name", b"Alice")?;
    db.put(b"user:1:email", b"alice@example.com")?;

    // Retrieve data
    if let Some(name) = db.get(b"user:1:name")? {
        println!("Name: {}", String::from_utf8_lossy(&name));
    }

    // Delete data
    db.delete(b"user:1:email")?;

    // Data is automatically persisted to disk
    Ok(())
}

§Database Modes

use rustlite::Database;

// Persistent database (recommended for production)
let persistent_db = Database::open("./data")?;

// In-memory database (fast, but data lost on exit)
let memory_db = Database::in_memory()?;

§Features

  • v0.1.0: In-memory key-value store with thread-safe concurrent access
  • v0.2.0: Persistent storage with WAL, SSTable, and crash recovery
  • v0.3.0 (planned): Indexing and performance optimizations
  • v0.4.0 (planned): SQL-like query engine
  • v1.0.0 (planned): Production-ready with full ACID guarantees

See ROADMAP.md for details.

Structs§

CompactionConfig
Compaction configuration
CompactionStats
Statistics for compaction
CompactionWorker
Compaction worker
Database
The main database handle.
Manifest
Manifest manager - tracks database state
Memtable
Memtable - an in-memory sorted write buffer
RecoveryManager
Manages WAL recovery after crash or restart
RecoveryStats
Statistics about the WAL state
SSTableEntry
A single entry in an SSTable
SSTableMeta
SSTable metadata (in-memory representation)
SSTableReader
SSTable reader - reads from existing SSTable files
SSTableWriter
SSTable writer - creates new SSTable files
SnapshotConfig
Snapshot configuration
SnapshotFile
File included in a snapshot
SnapshotManager
Snapshot manager
SnapshotMeta
Snapshot metadata
StorageConfig
Storage engine configuration
StorageEngine
Storage engine manager
StorageStats
Storage statistics
WalConfig
WAL configuration options
WalManager
WAL manager coordinates log writing and recovery
WalReader
WAL reader for reading records from log segments
WalRecord
A WAL record

Enums§

Error
The main error type for RustLite operations.
MemtableEntry
Entry value in the memtable - can be a value or a tombstone (deletion marker)
SnapshotType
Type of snapshot
SyncMode
Sync mode for WAL writes

Constants§

VERSION

Type Aliases§

Result
A specialized Result type for RustLite operations.