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