Skip to main content

lora_database/
lib.rs

1//! In-memory Lora database — the database-facing orchestration layer.
2//!
3//! `lora-database` owns the parse → analyze → compile → execute pipeline
4//! and exposes a single [`Database`] entry point that transports (HTTP,
5//! benches, examples, embedded callers) can drive without knowing about the
6//! underlying crates.
7//!
8//! # Quick start
9//!
10//! ```no_run
11//! use lora_database::Database;
12//!
13//! let db = Database::in_memory();
14//! db.execute("CREATE (:User {name: 'alice'})", None).unwrap();
15//! ```
16
17mod database;
18mod error;
19mod explain;
20mod live_store;
21mod named;
22mod plan_cache;
23mod snapshot;
24mod stream;
25mod transaction;
26mod wal;
27
28pub use database::{Database, GraphDirection, QueryRunner};
29pub use error::{LoraError, LoraErrorCategory, LoraErrorCode};
30pub use explain::{OperatorMetrics, PlanShape, ProfileMetrics, QueryPlan, QueryProfile};
31pub use lora_compiler::{PlanTree, PlanTreeNode};
32pub use named::{
33    resolve_database_path, DatabaseName, DatabaseNameError, DatabaseOpenOptions,
34    DEFAULT_DATABASE_MAX_BYTES,
35};
36pub use snapshot::{
37    snapshot_credentials_from_json, snapshot_options_from_json, SnapshotAdmin, SnapshotByteFormat,
38    SnapshotConfig,
39};
40pub use stream::QueryStream;
41pub use transaction::{Transaction, TransactionError, TransactionMode};
42pub use wal::{WalAdmin, WalStatus};
43
44// Re-export the WAL configuration types so transports / operators can
45// build a `Database::open_with_wal` argument without taking a direct
46// `lora-wal` dependency.
47pub use lora_wal::{SyncMode, WalConfig};
48
49// Re-export the core execution types so callers don't need a direct
50// dependency on `lora-executor`.
51pub use lora_executor::{ExecuteOptions, LoraValue, QueryResult, ResultFormat, Row};
52
53// Re-export the default in-memory backing store so callers only need to
54// depend on `lora-database` for the happy path.
55pub use lora_store::InMemoryGraph;
56
57// Snapshot surface — re-exported so bindings/servers don't need a direct
58// `lora-store` dependency just to name the meta / error types.
59pub use lora_snapshot::{
60    Compression, EncryptionKey, PasswordKdfParams, SnapshotCredentials, SnapshotEncryption,
61    SnapshotInfo, SnapshotOptions, SnapshotPassword, DATABASE_SNAPSHOT_MAGIC,
62};
63pub use lora_store::{
64    NodeId, NodeRecord, RelationshipId, RelationshipRecord, SnapshotError, SnapshotMeta,
65};
66
67// Standalone parsing entry point (does not require building a `Database`).
68pub use lora_parser::parse_query;