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§
- Compaction
Config - Compaction configuration
- Compaction
Stats - Statistics for compaction
- Compaction
Worker - Compaction worker
- Database
- The main database handle.
- Manifest
- Manifest manager - tracks database state
- Memtable
- Memtable - an in-memory sorted write buffer
- Recovery
Manager - Manages WAL recovery after crash or restart
- Recovery
Stats - Statistics about the WAL state
- SSTable
Entry - A single entry in an SSTable
- SSTable
Meta - SSTable metadata (in-memory representation)
- SSTable
Reader - SSTable reader - reads from existing SSTable files
- SSTable
Writer - SSTable writer - creates new SSTable files
- Snapshot
Config - Snapshot configuration
- Snapshot
File - File included in a snapshot
- Snapshot
Manager - Snapshot manager
- Snapshot
Meta - Snapshot metadata
- Storage
Config - Storage engine configuration
- Storage
Engine - Storage engine manager
- Storage
Stats - 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.
- Memtable
Entry - Entry value in the memtable - can be a value or a tombstone (deletion marker)
- Snapshot
Type - Type of snapshot
- Sync
Mode - Sync mode for WAL writes
Constants§
Type Aliases§
- Result
- A specialized
Resulttype for RustLite operations.