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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//! # CrepeDB
//!
//! A versioned and forkable embedded database library.
//!
//! CrepeDB provides a multi-version concurrency control (MVCC) database with snapshot isolation.
//! It supports forking database snapshots and maintains version history efficiently.
//!
//! ## Features
//!
//! - **Versioned Storage**: Track changes across multiple versions
//! - **Snapshot Isolation**: Create and read from consistent snapshots
//! - **Fork Support**: Create new branches from any snapshot
//! - **Backend Abstraction**: Use different storage backends (e.g., redb, rocksdb, mdbx)
//!
//! ## Example
//!
//! ```ignore
//! use crepedb::{CrepeDB, SnapshotId};
//! use crepedb::backend::RedbDatabase;
//!
//! // Create a database with a backend
//! let backend = RedbDatabase::memory()?;
//! let db = CrepeDB::new(backend);
//!
//! // Create root snapshot
//! let wtxn = db.write(None)?;
//! wtxn.create_versioned_table("my_table")?;
//! let root = wtxn.commit()?;
//!
//! // Write data
//! let wtxn = db.write(Some(root))?;
//! let mut table = wtxn.open_table("my_table")?;
//! table.set(b"key".to_vec(), b"value".to_vec())?;
//! let snapshot1 = wtxn.commit()?;
//!
//! // Read data
//! let rtxn = db.read(Some(snapshot1))?;
//! let table = rtxn.open_table("my_table")?;
//! let value = table.get(b"key".to_vec())?;
//! ```
// Re-export all core types and modules
pub use *;
/// Core types used throughout CrepeDB.
///
/// This module re-exports essential types from the core library, including:
/// - [`SnapshotId`](crate::types::SnapshotId): Unique identifier for database snapshots
/// - [`Bytes`](crate::types::Bytes): Byte array type used for keys and values
/// - [`Version`](crate::types::Version): Version number type for tracking changes
/// Storage backend implementations.
///
/// This module provides access to different storage backend implementations
/// that can be used with CrepeDB. Each backend implements the [`Backend`](crepedb_core::backend::Backend) trait
/// and provides its own database type.
///
/// ## Available Backends
///
/// - **RedbDatabase**: A simple, portable, high-performance embedded key-value database
/// - **RocksdbDatabase**: A high-performance embedded database based on RocksDB
/// - **MdbxDatabase**: A fast, compact, powerful embedded transactional key-value database
///
/// ## Example
///
/// ```ignore
/// use crepedb::backend::RedbDatabase;
/// use crepedb::CrepeDB;
///
/// // Create a backend
/// let backend = RedbDatabase::memory()?;
/// let db = CrepeDB::new(backend);
/// ```