Skip to main content

Crate grumpydb

Crate grumpydb 

Source
Expand description

GrumpyDB — A disk-based object storage engine.

GrumpyDB stores schema-less documents (JSON-like) on disk with B+Tree indexing, page-based storage, WAL for durability, and SWMR concurrency.

§Example

use grumpydb::{Database, Value};
use uuid::Uuid;
use std::collections::BTreeMap;

let mut db = Database::open(std::path::Path::new("./my_database")).unwrap();
db.create_collection("docs").unwrap();

let key = Uuid::new_v4();
let value = Value::Object(BTreeMap::from([
    ("name".into(), Value::String("GrumpyDB".into())),
    ("version".into(), Value::Integer(1)),
]));

db.insert("docs", key, value).unwrap();

let doc = db.get("docs", &key).unwrap();
assert!(doc.is_some());
db.close().unwrap();

Re-exports§

pub use concurrency::lock_manager::SharedDb;Deprecated
pub use concurrency::shared::SharedDatabase;
pub use concurrency::shared::SharedReadTx;
pub use concurrency::shared::SharedServer;
pub use database::Database;
pub use database::ReadTx;
pub use document::value::Value;
pub use engine::CompactResult;
pub use engine::GrumpyDb;Deprecated
pub use error::GrumpyError;
pub use error::Result;
pub use index::IndexDefinition;
pub use server::GrumpyServer;
pub use server::client::Client;

Modules§

btree
Generic B+Tree index.
buffer
Buffer pool: LRU cache for pages in memory.
collection
Collection: a named unit of document storage.
concurrency
Concurrency: SWMR (Single-Writer, Multi-Reader) thread-safe access.
database
Database: manages multiple named collections with a shared WAL.
document
Document model: schema-less JSON-like values with binary codec.
engine
Storage engine: orchestrates all subsystems to provide CRUD operations.
error
index
Secondary index: maps field values to document UUIDs via a BTree<Vec<u8>>.
naming
Name validation for clients, databases, collections, and indexes.
page
Page management: constants, types, and page I/O.
server
Server: multi-tenant management of clients and databases.
wal
Write-Ahead Log for crash recovery and durability.