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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
//! Trine KV is an embedded LSM MVCC key-value database.
//!
//! Use Trine KV when an application needs a local key/value store with
//! persistent storage, atomic batches, snapshots, range scans, prefix scans,
//! and optimistic transactions. The primary API is async-first; synchronous
//! callers use the explicit `*_sync` adapters.
//!
//! # Quick start
//!
//! `Db::open` and `Db::open_sync` are path-first. Passing a path opens a
//! persistent database. Use `DbOptions::memory()` when the database should live
//! only in memory.
//!
//! ```rust
//! use trine_kv::Db;
//!
//! # fn main() -> trine_kv::Result<()> {
//! let db = Db::open_sync("target/doc-example-basic")?;
//! db.put_sync(b"user:1", b"Ada")?;
//!
//! let value = db.get_sync(b"user:1")?;
//! assert_eq!(value, Some(b"Ada".to_vec()));
//! # Ok(())
//! # }
//! ```
//!
//! # Core concepts
//!
//! - [`Db`] is the database handle. Direct `Db` read and write methods operate
//! on the built-in default bucket.
//! - [`Bucket`] is a handle for an optional named bucket with its own options,
//! memtables, tables, filters, and compaction state.
//! - [`WriteBatch`] groups puts, point deletes, and range deletes into one
//! atomic commit.
//! - [`ReadVersion`] is the application-facing cursor for a committed database
//! state. [`Snapshot`] pins one so repeated reads see a stable view while
//! newer writes continue.
//! - [`Transaction`] records reads and stages writes, then rejects commit if a
//! later committed write conflicts with the read set.
//!
//! # Durability
//!
//! Persistent databases default to safety-first durability for confirmed
//! writes. Lower durability modes such as [`DurabilityMode::Buffered`] are
//! available through [`WriteOptions`] for data that can tolerate losing recent
//! confirmed writes after a crash.
//!
//! # Platform I/O features
//!
//! The async API works without feature flags. Enable `platform-io` when
//! native-file storage should complete through Trine's portable platform I/O
//! boundary, backed by a bounded Trine-owned thread pool. Enable
//! `platform-io-native` when Trine should prefer audited native async backends
//! and use the same thread-pool backend for unsupported operation rows.
//!
//! After enabling either feature, select the platform I/O runtime for a
//! database:
//!
//! ```rust
//! use trine_kv::{Db, DbOptions, RuntimeOptions};
//!
//! # async fn example() -> trine_kv::Result<()> {
//! let mut options = DbOptions::new("target/doc-example-platform-io");
//! options.runtime = RuntimeOptions::platform_io();
//!
//! let db = Db::open(options).await?;
//! db.put(b"k", b"v").await?;
//! db.flush().await?;
//! # Ok(())
//! # }
//! ```
//!
//! Use [`DbStats::storage_platform_io_operations`] to inspect whether each
//! Trine operation completed as true native async, partial native async,
//! thread-pool managed async, fallback, or unsupported work.
/// Browser storage-manager helpers for OPFS-backed persistent databases.
/// Bucket handles and bucket-bound readers.
/// Database open, read, write, scan, and maintenance APIs.
/// Error and result types returned by Trine KV.
/// Forward and reverse iterators over committed rows.
/// Provider-agnostic object-store client ("bring your own object store"): the
/// `ObjectClient` trait, its `ETag`/conditional-write types, and an in-memory
/// fake. Implement it for S3 (or use the `s3` feature) and open with
/// [`Db::open_object_store`].
/// Database, bucket, write, storage, runtime, and durability options.
/// Prefix extraction policies used by prefix filters.
/// Startup recovery helpers and recovery reports.
/// Runtime selection, capabilities, and cancellation support.
/// Real object-storage `ObjectClient` (S3 and compatible) via the `object_store`
/// crate. Enabled by the `s3` feature.
/// Search policy helpers for table indexes.
/// Snapshot handles for repeatable reads.
/// Live database statistics exposed to callers.
/// Optimistic transaction API.
/// Core key, value, range, read-version, and commit types.
/// Atomic write batch types.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use PointValue;
pub use PrefixExtractor;
pub use RecoveryReport;
pub use ;
pub use Snapshot;
pub use ;
pub use ;
pub use ;
pub use is_wal_object_key;
pub use WriteBatch;