Crates.io | epoch-db |
lib.rs | epoch-db |
version | 0.2.9 |
created_at | 2025-07-16 13:23:06.070834+00 |
updated_at | 2025-08-20 15:05:39.898306+00 |
description | An intelligent, persistent, and concurrent key-value store for Rust, designed to manage data with a lifecycle through frequency tracking and TTL. |
homepage | https://github.com/FabioCanavarro/TransientDB |
repository | https://github.com/FabioCanavarro/TransientDB |
max_upload_size | |
id | 1755495 |
size | 139,470 |
An intelligent, persistent, and concurrent key-value store for Rust, designed to manage data with a lifecycle.
EpochDB is not just another key-value store. It's an opinionated database engine built on the robust foundation of sled
, designed specifically for workloads where the relevance of data changes over time.
It provides a high-level, ergonomic API to solve common problems like caching, session management, and real-time analytics by treating data's access frequency and age as first-class citizens.
Many applications need to handle data that isn't meant to live forever. Think of user sessions, cached API responses, or event streams. Managing this "transient" data can be complex. You need to worry about:
EpochDB
solves these problems out-of-the-box with a clean, simple API.
sled
's page cache efficiency.compare-and-swap
loops.sled
's Write-Ahead Log.Get started with EpochDB
by adding it to your Cargo.toml
:
[dependencies]
epoch-db = "0.2.9"
use epoch_db::DB;
use std::path::Path;
use std::time::Duration;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// 1. Open the database. It will be created if it doesn't exist.
let db = DB::new(Path::new("./my_database"))?;
// 2. Set a value with a 60-second Time-To-Live (TTL).
// Metadata (frequency, created_at) is handled automatically.
db.set("user:1", "Alice", Some(Duration::from_secs(60)))?;
// 3. Get the value back.
if let Some(value) = db.get("user:1")? {
println!("Found value: {}", value); // "Found value: Alice"
}
// 4. Increment the frequency counter safely across multiple threads.
db.increment_frequency("user:1")?;
// 5. Remove data atomically from all trees.
db.remove("user:1")?;
Ok(())
}
EpochDB
is actively being developed. Our goal is to create the best tool for managing ephemeral and usage-tracked data in the Rust ecosystem.
V1 (The Core Engine)
data_tree
, metadata_tree
).set
, get
, remove
, increment_frequency
).V2 (Production Readiness)
db.backup_to(...)
).V3 (The Ecosystem)
Contributions are welcome and greatly appreciated! This project is a fantastic opportunity to dive into systems programming, database internals, and high-performance Rust.
If you're interested in helping, please:
[Help Wanted]
or good first issue
are great places to start.We are building a welcoming and collaborative community. Let's build something great together!
This project is licensed under the MIT license