Skip to main content

Crate lora_database

Crate lora_database 

Source
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§

CancellableDeadline
A deadline that can also be cancelled before it expires.
ChangeBatch
Every change one committed write made, in the order it first touched each entity.
ChangeFeed
Ordered stream of committed ChangeBatches from one database.
ChangeFeedCloser
Cloneable handle that closes a ChangeFeed from another thread.
ChangeFeedOptions
Options for Database::changes.
ColumnSpec
One file column → one target property. source is the column name as it appears in the file (after schema-marker canonicalisation, e.g. _id for :ID); property is 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.
DatabaseName
Validated logical database name/path.
DatabaseOpenOptions
Options for opening a named filesystem-backed database.
EncryptionKey
ExecuteOptions
ExportStats
Rows-shipped accounting from an export run.
GraphStats
Snapshot of graph cardinality. Populated by the storage backend (see [super::InMemoryGraph::stats]).
ImportStats
Rows-shipped accounting from an import run.
InMemoryGraph
JsonArrayDecoder
Decoder that parses the entire array up-front, then yields one element per next_row call. Not streaming — use super::JsonlDecoder for that.
JsonArrayEncoder
JsonlDecoder
JsonlEncoder
LoraError
Public error type at the lora-database boundary.
MemoryReport
Aggregated retained-heap breakdown of an [InMemoryGraph].
NodeRecord
OperatorMetrics
Per-operator metrics. Reserved for a future phase; today no operator populates this.
PasswordKdfParams
PlanTree
Top-level plan tree.
PlanTreeNode
One node in the rendered plan tree.
ProfileMetrics
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.
QueryPlan
Result of Database::explain.
QueryProfile
Result of Database::profile.
QueryStream
Owning row stream returned by crate::Database::stream and transaction streaming methods.
RelationshipRecord
Row
Row layout: a positional vector indexed by VarId.0. Two reasons this beats the previous BTreeMap<VarId, RowEntry>:
RowParseError
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::Error via row_parse_io_error so it travels through the standard feed / finish return type; recoverable via downcast_row_parse_error.
SnapshotConfig
SnapshotInfo
SnapshotMeta
Metadata reported by snapshot encode / decode entry points. Kept small and stable so callers can log / diff it without reflecting on the payload.
SnapshotOptions
SnapshotPassword
StreamingCsvDecoder
Push-based CSV decoder. Layers a streaming feed loop on top of the same process_buf byte-level state machine used by the pull-based CsvDecoder. The cell/record state lives on the struct so it persists across feed calls — partial records stay parked until enough bytes arrive to complete them.
StreamingJsonArrayDecoder
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.
StreamingJsonlDecoder
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 for Self::drain.
Transaction
Explicit transaction over the in-memory graph.
WalStatus
Snapshot of WAL state returned by WalAdmin::wal_status.

Enums§

Change
Net effect of one committed transaction on one entity.
ChangePoll
Result of polling a ChangeFeed.
Compression
DatabaseNameError
Format
Wire format for row-level import/export.
GraphDirection
LoraErrorCategory
Whether a LoraErrorCode represents a caller-visible mistake or an engine-side failure. Used by the HTTP transport to choose between 4xx and 5xx status codes.
LoraErrorCode
Stable error-code catalog. The wire string returned by Self::as_str is 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.
LoraValue
PlanShape
Whether a compiled plan is read-only or potentially mutates the graph. Mirrors lora_executor::StreamShape but stays a stable public surface for bindings that don’t pull in the executor crate.
QueryResult
ResultFormat
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.
SnapshotByteFormat
Magic-byte sniff for snapshot bytes. The legacy in-store LORASNAP codec was removed in favour of the columnar lora-snapshot format, so this collapses to a single recognized variant; kept as a typed detect for forward compatibility if a future format is introduced.
SnapshotEncryption
SnapshotError
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.
SyncMode
Durability mode for committed transactions.
TransactionError
Transaction-lifecycle invariant violations.
TransactionMode
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_FEED_BUFFER
Default per-feed queue capacity, in batches.
DEFAULT_IMPORT_BATCH_SIZE
Default batch size for Database::import_rows / Database::import_with_template when none is supplied. Sized to keep $rows parameter payloads roughly bounded for typical row widths.
DEFAULT_RETENTION
Batches kept in memory for same-process resume.

Traits§

QueryRunner
Minimal abstraction any transport can depend on to run Lora queries.
RowDecoder
Pull-based row decoder. Reads from a std::io::BufRead and 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.
SnapshotAdmin
Storage-agnostic admin surface for HTTP / binding callers that want to drive snapshot operations without naming the backend type parameter.
StreamingRowDecoder
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 via Self::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§

deadline_reached
True once deadline has passed or its query was cancelled.
parameterized_create_for_node
Build the Cypher template for a node mapping. The result expects a $rows parameter 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 / encryption so 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.

Type Aliases§

NodeId
RelationshipId
SnapshotCredentials