1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! 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
//!
//! ```no_run
//! 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();
//! ```
// Forbid panics in production engine code. Doc-comment examples and `#[cfg(test)]`
// modules are exempt; new code should propagate errors via `Result<T, GrumpyError>`.
// Concurrency primitives. `SharedDb` is the SWMR wrapper for the deprecated
// `GrumpyDb`; prefer `SharedDatabase` (multi-collection) for new code.
pub use SharedDb;
pub use ;
pub use ;
pub use Value;
pub use CompactResult;
// `GrumpyDb` is deprecated in v5 and removed in v6 — kept here for the
// deprecation cycle. New code should use `Database`.
pub use GrumpyDb;
pub use ;
pub use IndexDefinition;
pub use GrumpyServer;
pub use Client;