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 named;
20mod plan_cache;
21mod snapshot;
22mod stream;
23mod transaction;
24mod wal;
25
26pub use database::{Database, GraphDirection, QueryRunner};
27pub use error::{LoraError, LoraErrorCategory, LoraErrorCode};
28pub use named::{
29    resolve_database_path, DatabaseName, DatabaseNameError, DatabaseOpenOptions,
30    DEFAULT_DATABASE_MAX_BYTES,
31};
32pub use snapshot::{
33    snapshot_credentials_from_json, snapshot_options_from_json, SnapshotAdmin, SnapshotByteFormat,
34    SnapshotConfig,
35};
36pub use stream::QueryStream;
37pub use transaction::{Transaction, TransactionError, TransactionMode};
38pub use wal::{WalAdmin, WalStatus};
39
40// Re-export the WAL configuration types so transports / operators can
41// build a `Database::open_with_wal` argument without taking a direct
42// `lora-wal` dependency.
43pub use lora_wal::{SyncMode, WalConfig};
44
45// Re-export the core execution types so callers don't need a direct
46// dependency on `lora-executor`.
47pub use lora_executor::{ExecuteOptions, LoraValue, QueryResult, ResultFormat, Row};
48
49// Re-export the default in-memory backing store so callers only need to
50// depend on `lora-database` for the happy path.
51pub use lora_store::InMemoryGraph;
52
53// Snapshot surface — re-exported so bindings/servers don't need a direct
54// `lora-store` dependency just to name the meta / error types.
55pub use lora_snapshot::{
56    Compression, EncryptionKey, PasswordKdfParams, SnapshotCredentials, SnapshotEncryption,
57    SnapshotInfo, SnapshotOptions, SnapshotPassword, DATABASE_SNAPSHOT_MAGIC,
58};
59pub use lora_store::{
60    NodeId, NodeRecord, RelationshipId, RelationshipRecord, SnapshotError, SnapshotMeta,
61};
62
63// Standalone parsing entry point (does not require building a `Database`).
64pub use lora_parser::parse_query;