Skip to content

A simple Key value store built using SkipLists, De-LSM architecture; embeddable and grpc enabled.

License

Notifications You must be signed in to change notification settings

Hrefto/shorterdb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ShorterDB

A lightweight embedded key-value store for Rust.

Crates.io Documentation License

Overview

ShorterDB is an embedded key-value database designed for simplicity and ease of use. It's built for learning, experimentation, and lightweight applications that need persistent storage without the overhead of a full database server.

Quick Start

use shorterdb::ShorterDB;
use std::path::Path;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut db = ShorterDB::new(Path::new("./my_db"))?;

    db.set(b"user:1", b"alice")?;
    db.set(b"user:2", b"bob")?;

    if let Some(value) = db.get(b"user:1")? {
        println!("Found: {}", String::from_utf8_lossy(&value));
    }

    db.delete(b"user:1")?;

    Ok(())
}

Features

  • Zero configuration — Just create a database and start using it
  • Embedded — No separate server process, runs in your application
  • Persistent — Data is durably stored with Write-Ahead Logging
  • Fast reads — In-memory caching with automatic background flushing
  • Simple API — Only get, set, and delete operations
  • gRPC support — Optional remote access via shorterdb-grpc crate

Installation

Add this to your Cargo.toml:

[dependencies]
shorterDB = "0.2.0"

Workspace Structure

This project is organized as a Cargo workspace:

shorterdb/
├── crates/
│   ├── shorterdb/          # Core database engine (minimal dependencies)
│   └── shorterdb-grpc/     # gRPC server (optional networking)
└── examples/               # Usage examples

Building

# Build just the core engine (fast, minimal deps)
cargo build -p shorterdb

# Build the gRPC server
cargo build -p shorterdb-grpc

# Build everything
cargo build --workspace

# Run tests
cargo test --workspace

Running the gRPC Server

# Using cargo
cargo run -p shorterdb-grpc

# Using Docker
docker build -t shorterdb-grpc .
docker run -p 50051:50051 shorterdb-grpc

Examples

Check out the examples/ directory:

  • embedded — Basic embedded database usage
  • repl — Interactive REPL for testing

Run an example:

cargo run -p shorterdb --example embedded
cargo run -p shorterdb --example repl

Documentation

View the full API documentation on docs.rs

Contributions are welcome! Please feel free to submit a Pull Request.

About

A simple Key value store built using SkipLists, De-LSM architecture; embeddable and grpc enabled.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •