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
183
184
185
186
187
188
189
190
191
192
193
194
195
//! `ManifoldDB` - A Multi-Paradigm Embedded Database
//!
//! ManifoldDB is an embedded database that unifies graph, vector, and relational
//! data operations in a single system.
//!
//! # Features
//!
//! - **Graph Database**: Store and traverse nodes and relationships
//! - **Vector Database**: Store embeddings and perform similarity search
//! - **SQL Support**: Query using familiar SQL syntax with extensions
//! - **ACID Transactions**: Full transactional support across all operations
//!
//! # Quick Start
//!
//! ## Opening a Database
//!
//! ```ignore
//! use manifoldb::Database;
//!
//! // Open or create a database file
//! let db = Database::open("mydb.manifold")?;
//!
//! // Or create an in-memory database for testing
//! let db = Database::in_memory()?;
//! ```
//!
//! ## Using Transactions
//!
//! ManifoldDB provides ACID transactions for all operations:
//!
//! ```ignore
//! use manifoldb::Database;
//!
//! let db = Database::in_memory()?;
//!
//! // Write transaction
//! let mut tx = db.begin()?;
//! let entity = tx.create_entity()?.with_label("Person").with_property("name", "Alice");
//! tx.put_entity(&entity)?;
//! tx.commit()?;
//!
//! // Read transaction
//! let tx = db.begin_read()?;
//! if let Some(entity) = tx.get_entity(entity_id)? {
//! println!("Found: {:?}", entity);
//! }
//! ```
//!
//! ## Executing SQL Queries
//!
//! ```ignore
//! use manifoldb::Database;
//!
//! let db = Database::open("mydb.manifold")?;
//!
//! // Execute statements
//! db.execute("INSERT INTO users (name, age) VALUES ('Alice', 30)")?;
//!
//! // Query data
//! let results = db.query("SELECT * FROM users WHERE age > 25")?;
//! for row in results {
//! println!("{:?}", row);
//! }
//! ```
//!
//! ## Graph Operations
//!
//! ```ignore
//! use manifoldb::Database;
//!
//! let db = Database::in_memory()?;
//! let mut tx = db.begin()?;
//!
//! // Create nodes
//! let alice = tx.create_entity()?.with_label("Person").with_property("name", "Alice");
//! let bob = tx.create_entity()?.with_label("Person").with_property("name", "Bob");
//! tx.put_entity(&alice)?;
//! tx.put_entity(&bob)?;
//!
//! // Create edges
//! let follows = tx.create_edge(alice.id, bob.id, "FOLLOWS")?;
//! tx.put_edge(&follows)?;
//!
//! tx.commit()?;
//!
//! // Query with graph patterns
//! let friends = db.query("
//! SELECT * FROM users
//! MATCH (u)-[:FOLLOWS]->(f)
//! WHERE u.name = 'Alice'
//! ")?;
//! ```
//!
//! ## Vector Search
//!
//! ```ignore
//! use manifoldb::{Database, Value};
//!
//! let db = Database::open("mydb.manifold")?;
//!
//! // Store vectors as entity properties
//! let mut tx = db.begin()?;
//! let doc = tx.create_entity()?
//! .with_label("Document")
//! .with_property("embedding", vec![0.1f32, 0.2, 0.3]);
//! tx.put_entity(&doc)?;
//! tx.commit()?;
//!
//! // Vector similarity search
//! let query_vector = vec![0.1f32, 0.2, 0.3];
//! let similar = db.query_with_params("
//! SELECT * FROM documents
//! ORDER BY embedding <-> $1
//! LIMIT 10
//! ", &[Value::Vector(query_vector)])?;
//! ```
//!
//! # Configuration
//!
//! Use [`DatabaseBuilder`] for advanced configuration:
//!
//! ```ignore
//! use manifoldb::{DatabaseBuilder, VectorSyncStrategy};
//!
//! let db = DatabaseBuilder::new()
//! .path("mydb.manifold")
//! .cache_size(128 * 1024 * 1024) // 128MB cache
//! .vector_sync_strategy(VectorSyncStrategy::Async)
//! .open()?;
//! ```
//!
//! # Modules
//!
//! - [`config`] - Database configuration and builder
//! - [`database`] - Main database interface
//! - [`error`] - Error types
//! - [`transaction`] - Transaction management
// Deny unwrap in library code to ensure proper error handling
// Re-export core types
pub use ;
// Re-export storage types
pub use ;
// Modules
// Collection module - internal implementation details
// Note: This is being deprecated in favor of the unified Entity API.
// Users should use Entity.with_vector() and db.search() instead.
// Public API re-exports
pub use ;
pub use ;
pub use ;
pub use Filter;
pub use ;
pub use ;
pub use ;
pub use ;
// Re-export distance metrics for collection configuration
pub use SparseDistanceMetric;
pub use DistanceMetric;
// Re-export index types
pub use ;