aurora_db/lib.rs
1//! # Aurora Database
2//!
3//! Aurora is an embedded document database with tiered storage architecture.
4//! It provides document storage, querying, indexing, and search capabilities
5//! while optimizing for both performance and durability.
6//!
7//! ## Key Features
8//!
9//! * **Tiered Storage**: Hot in-memory cache + persistent cold storage
10//! * **Document Model**: Schema-flexible JSON-like document storage
11//! * **Querying**: Rich query capabilities with filtering and sorting
12//! * **Full-text Search**: Built-in search engine with relevance ranking
13//! * **Transactions**: ACID-compliant transaction support
14//!
15//! ## Quick Start
16//!
17
18//! use aurora_db::{Aurora, Value, FieldType};
19//!
20//!
21//! #[tokio::main]
22//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
23//! // Open a database
24//! let db = Aurora::open("my_app.db")?;
25//!
26//! // Create a collection
27//! db.new_collection("users", vec![
28//! ("name", FieldType::String, false),
29//! ("email", FieldType::String, true), // unique field
30//! ("age", FieldType::Int, false),
31//! ]).await?;
32//!
33//! // Insert data
34//! let user_id = db.insert_into("users", vec![
35//! ("name", Value::String("Jane Doe".to_string())),
36//! ("email", Value::String("jane@example.com".to_string())),
37//! ("age", Value::Int(28)),
38//! ]).await?;
39//!
40//! // Query data
41//! let users = db.query("users")
42//! .filter(|f| f.gt("age", 21))
43//! .collect()
44//! .await?;
45//!
46//! # Ok(())
47//! # }
48//! ```
49
50// Re-export primary types and modules
51pub use crate::db::Aurora;
52pub use crate::db::DataInfo;
53pub use crate::error::{AqlError, Result};
54pub use crate::query::{QueryBuilder, SearchBuilder};
55pub use types::{
56 AuroraConfig, ColdStoreMode, Collection, Document, DurabilityMode, FieldDefinition, FieldType,
57 Value,
58};
59
60pub use crate::parser::validator::{
61 ErrorCode, InMemorySchema, SchemaProvider, ValidationError, ValidationResult, validate_document,
62};
63
64// Re-export commonly used storage types
65pub use storage::{EvictionPolicy, HotStore};
66
67// Re-export PubSub types for convenience
68pub use pubsub::{ChangeEvent, ChangeListener, ChangeType};
69
70// Re-export Workers types for convenience
71pub use workers::{Job, JobPriority, JobStatus};
72
73// Re-export Transaction types for convenience
74pub use transaction::{TransactionBuffer, TransactionId};
75
76// Module declarations
77pub mod audit;
78pub mod client;
79pub mod computed;
80pub mod db;
81pub mod error;
82pub mod index;
83pub mod network;
84pub mod parser; // AQL parser module
85pub mod pubsub;
86pub mod query;
87pub mod reactive;
88pub mod search;
89pub mod storage;
90pub mod transaction;
91pub mod types;
92pub mod wal;
93pub mod workers;