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
//! SatoriDB: Billion-scale embedded vector database.
//!
//! Two-tier architecture: HNSW routing in RAM + parallel bucket scanning on disk.
//! Handles 1B+ vectors with 95%+ recall.
//!
//! # Quick Start
//!
//! ```no_run
//! use satoridb::SatoriDb;
//!
//! fn main() -> anyhow::Result<()> {
//! let db = SatoriDb::open("my_app")?;
//!
//! db.insert(1, vec![0.1, 0.2, 0.3])?;
//! let results = db.query(vec![0.15, 0.25, 0.35], 10)?;
//!
//! Ok(()) // auto-shutdown on drop
//! }
//! ```
//!
//! # Configuration
//!
//! ```no_run
//! use satoridb::SatoriDb;
//!
//! fn main() -> anyhow::Result<()> {
//! let db = SatoriDb::builder("my_app")
//! .workers(4)
//! .fsync_ms(100)
//! .data_dir("/custom/path")
//! .build()?;
//! # Ok(())
//! }
//! ```
//!
//! # Core Operations
//!
//! ```no_run
//! # use satoridb::SatoriDb;
//! # fn main() -> anyhow::Result<()> {
//! # let db = SatoriDb::open("my_app")?;
//! // Insert (rejects duplicates)
//! db.insert(1, vec![0.1, 0.2, 0.3])?;
//!
//! // Query nearest neighbors
//! let results = db.query(vec![0.1, 0.2, 0.3], 10)?;
//!
//! // Query with vectors returned
//! let results = db.query_with_vectors(vec![0.1, 0.2, 0.3], 10)?;
//!
//! // Fetch by ID
//! let vectors = db.get(vec![1, 2, 3])?;
//!
//! // Delete
//! db.delete(1)?;
//!
//! // Flush to disk
//! db.flush()?;
//! # Ok(())
//! # }
//! ```
//!
//! # Async API
//!
//! ```no_run
//! # use satoridb::SatoriDb;
//! async fn example() -> anyhow::Result<()> {
//! let db = SatoriDb::open("my_app")?;
//!
//! db.insert_async(1, vec![0.1, 0.2, 0.3]).await?;
//! let results = db.query_async(vec![0.1, 0.2, 0.3], 10).await?;
//! db.delete_async(1).await?;
//!
//! Ok(())
//! }
//! ```
//!
//! # Platform & Stability
//!
//! - Linux-only (requires io_uring, kernel 5.8+)
//! - Pre-1.0: expect breaking API changes
//! - Single-process embedded database
// Public library exports so integration tests and external tooling can use the same modules.
pub use ;