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 durable_io;
19mod error;
20mod explain;
21mod io;
22mod live_store;
23mod named;
24mod plan_cache;
25mod snapshot;
26mod stream;
27mod transaction;
28mod wal;
29
30pub use database::{Database, GraphDirection, QueryRunner};
31pub use error::{LoraError, LoraErrorCategory, LoraErrorCode};
32pub use io::{ExportStats, ImportStats, DEFAULT_IMPORT_BATCH_SIZE};
33
34// Re-export the row-IO surface so transports and bindings only need
35// `lora-database` for the common case.
36pub use explain::{OperatorMetrics, PlanShape, ProfileMetrics, QueryPlan, QueryProfile};
37pub use lora_compiler::{PlanTree, PlanTreeNode};
38pub use lora_io::{
39    parameterized_create_for_node, parameterized_create_for_relationship, ColumnSpec, CsvDecoder,
40    CsvEncoder, Format, JsonArrayDecoder, JsonArrayEncoder, JsonlDecoder, JsonlEncoder, RowDecoder,
41    RowEncoder, RowMapping, RowParseError, StreamingCsvDecoder, StreamingJsonArrayDecoder,
42    StreamingJsonlDecoder, StreamingRowDecoder,
43};
44pub use named::{
45    resolve_database_path, DatabaseName, DatabaseNameError, DatabaseOpenOptions,
46    DEFAULT_DATABASE_MAX_BYTES,
47};
48pub use snapshot::{
49    snapshot_credentials_from_json, snapshot_options_from_json, SnapshotAdmin, SnapshotByteFormat,
50    SnapshotConfig,
51};
52pub use stream::QueryStream;
53pub use transaction::{Transaction, TransactionError, TransactionMode};
54pub use wal::{WalAdmin, WalStatus};
55
56// Re-export the WAL configuration types so transports / operators can
57// build a `Database::open_with_wal` argument without taking a direct
58// `lora-wal` dependency.
59pub use lora_wal::{SyncMode, WalConfig};
60
61// Re-export the core execution types so callers don't need a direct
62// dependency on `lora-executor`.
63pub use lora_executor::{ExecuteOptions, LoraValue, QueryResult, ResultFormat, Row};
64
65// Re-export the default in-memory backing store so callers only need to
66// depend on `lora-database` for the happy path.
67pub use lora_store::InMemoryGraph;
68
69// Snapshot surface — re-exported so bindings/servers don't need a direct
70// `lora-store` dependency just to name the meta / error types.
71pub use lora_snapshot::{
72    snapshot_info, Compression, EncryptionKey, PasswordKdfParams, SnapshotCredentials,
73    SnapshotEncryption, SnapshotInfo, SnapshotOptions, SnapshotPassword, DATABASE_SNAPSHOT_MAGIC,
74};
75pub use lora_store::{
76    GraphStats, MemoryReport, NodeId, NodeRecord, RelationshipId, RelationshipRecord,
77    SnapshotError, SnapshotMeta,
78};
79
80// Standalone parsing entry point (does not require building a `Database`).
81pub use lora_parser::parse_query;