Expand description
In-memory Lora database — the database-facing orchestration layer.
lora-database owns the parse → analyze → compile → execute pipeline
and exposes a single Database entry point that transports (HTTP,
benches, examples, embedded callers) can drive without knowing about the
underlying crates.
§Quick start
use lora_database::Database;
let db = Database::in_memory();
db.execute("CREATE (:User {name: 'alice'})", None).unwrap();Structs§
- Column
Spec - One file column → one target property.
sourceis the column name as it appears in the file (after schema-marker canonicalisation, e.g._idfor:ID);propertyis the target node/relationship property name. When equal, the mapping is the identity — useful default for the auto-mapping path. - CsvDecoder
- CsvEncoder
- Database
- Owns the graph store and orchestrates parse → analyze → compile → execute.
- Database
Name - Validated logical database name/path.
- Database
Open Options - Options for opening a named filesystem-backed database.
- Encryption
Key - Execute
Options - Export
Stats - Rows-shipped accounting from an export run.
- Graph
Stats - Snapshot of graph cardinality. Populated by the storage backend
(see [
super::InMemoryGraph::stats]). - Import
Stats - Rows-shipped accounting from an import run.
- InMemory
Graph - Json
Array Decoder - Decoder that parses the entire array up-front, then yields one
element per
next_rowcall. Not streaming — usesuper::JsonlDecoderfor that. - Json
Array Encoder - Jsonl
Decoder - Jsonl
Encoder - Lora
Error - Public error type at the
lora-databaseboundary. - Memory
Report - Aggregated retained-heap breakdown of an [
InMemoryGraph]. - Node
Record - Operator
Metrics - Per-operator metrics. Reserved for a future phase; today no operator populates this.
- Password
KdfParams - Plan
Tree - Top-level plan tree.
- Plan
Tree Node - One node in the rendered plan tree.
- Profile
Metrics - Coarse-grained per-query runtime metrics. v1 reports totals, not per-operator timings; per-operator instrumentation is reserved for a future phase that will not change the public surface.
- Query
Plan - Result of
Database::explain. - Query
Profile - Result of
Database::profile. - Query
Stream - Owning row stream returned by
crate::Database::streamand transaction streaming methods. - Relationship
Record - Row
- Row layout: a positional vector indexed by
VarId.0. Two reasons this beats the previousBTreeMap<VarId, RowEntry>: - RowParse
Error - Structured per-record parse failure. Carries the user-visible row
number, an optional column attribution (CSV cell parses), a
truncated sample of the raw bytes that failed, and the underlying
message. Boxed into
std::io::Errorviarow_parse_io_errorso it travels through the standardfeed/finishreturn type; recoverable viadowncast_row_parse_error. - Snapshot
Config - Snapshot
Info - Snapshot
Meta - Metadata reported by snapshot encode / decode entry points. Kept small and stable so callers can log / diff it without reflecting on the payload.
- Snapshot
Options - Snapshot
Password - Streaming
CsvDecoder - Push-based CSV decoder. Layers a streaming feed loop on top of
the same
process_bufbyte-level state machine used by the pull-basedCsvDecoder. The cell/record state lives on the struct so it persists acrossfeedcalls — partial records stay parked until enough bytes arrive to complete them. - Streaming
Json Array Decoder - Push-based JSON-array decoder. Tracks brace/bracket depth and
JSON string state byte-by-byte so the input can be fed in
arbitrarily sized chunks. Memory bound: at most one in-progress
record (between its opening
{and matching}) plus a single chunk of incoming bytes. - Streaming
Jsonl Decoder - Push-based JSONL decoder. Accumulates bytes between calls to
Self::feed, splits on\n, parses each completed line as a JSON object, and queues the resulting record forSelf::drain. - Transaction
- Explicit transaction over the in-memory graph.
- WalStatus
- Snapshot of WAL state returned by
WalAdmin::wal_status.
Enums§
- Compression
- Database
Name Error - Format
- Wire format for row-level import/export.
- Graph
Direction - Lora
Error Category - Whether a
LoraErrorCoderepresents a caller-visible mistake or an engine-side failure. Used by the HTTP transport to choose between 4xx and 5xx status codes. - Lora
Error Code - Stable error-code catalog. The wire string returned by
Self::as_stris part of LoraDB’s public API. Consumers — bindings, the HTTP layer, integration tests — should match on this rather than on the message text, which is allowed to change between releases. - Lora
Value - Plan
Shape - Whether a compiled plan is read-only or potentially mutates the
graph. Mirrors
lora_executor::StreamShapebut stays a stable public surface for bindings that don’t pull in the executor crate. - Query
Result - Result
Format - RowMapping
- Top-level mapping: how to turn a stream of decoded rows into Cypher inserts. Carries enough information for the playground’s auto-detect / preview path; users can edit this in the import dialog before running.
- Snapshot
Byte Format - Magic-byte sniff for snapshot bytes. The legacy in-store
LORASNAPcodec was removed in favour of the columnarlora-snapshotformat, so this collapses to a single recognized variant; kept as a typed detect for forward compatibility if a future format is introduced. - Snapshot
Encryption - Snapshot
Error - Errors a backend may surface while building or restoring a snapshot
payload. Codec-level errors live in [
lora-snapshot]; these are the store-side payload-shaped failures. - Sync
Mode - Durability mode for committed transactions.
- Transaction
Error - Transaction-lifecycle invariant violations.
- Transaction
Mode - Transaction execution mode.
- WalConfig
- Configuration for opening a
Wal.
Constants§
- DATABASE_
SNAPSHOT_ MAGIC - DEFAULT_
DATABASE_ MAX_ BYTES - Hard ceiling for one portable database container/root.
- DEFAULT_
IMPORT_ BATCH_ SIZE - Default batch size for
Database::import_rows/Database::import_with_templatewhen none is supplied. Sized to keep$rowsparameter payloads roughly bounded for typical row widths.
Traits§
- Query
Runner - Minimal abstraction any transport can depend on to run Lora queries.
- RowDecoder
- Pull-based row decoder. Reads from a
std::io::BufReadand yields completed rows one at a time. Used by native Rust callers that already have the input as a stream-like reader. - RowEncoder
- Streaming row encoder. Implementors own the underlying writer and may flush at chunk boundaries.
- Snapshot
Admin - Storage-agnostic admin surface for HTTP / binding callers that want to drive snapshot operations without naming the backend type parameter.
- Streaming
RowDecoder - Push-based streaming row decoder. The caller feeds bytes one
chunk at a time (e.g. from
File.stream().getReader()in the browser); the decoder accumulates partial records internally and emits completed rows viaSelf::drain. Designed for the WASM streaming-import path where the engine and the source live on different sides of the worker boundary. - WalAdmin
- Storage-agnostic admin surface for the WAL.
Functions§
- parameterized_
create_ for_ node - Build the Cypher template for a node mapping. The result expects
a
$rowsparameter containing an array of objects whose keys match the source column names referenced by the mapping. - parameterized_
create_ for_ relationship - Build the Cypher template for a relationship mapping.
- parse_
query - resolve_
database_ path - snapshot_
credentials_ from_ json - Build snapshot load credentials from the JSON shape used by the language
bindings. The credential object may be supplied directly, or under
credentials/encryptionso the same options object can be reused for save and load. - snapshot_
info - snapshot_
options_ from_ json - Build snapshot save options from the JSON shape used by the language bindings.