Skip to main content

Crate marsdb_query

Crate marsdb_query 

Source

Modules§

temporal
Calendar math and ISO-8601 text conversion for PropertyValue::Date/ PropertyValue::Duration – kept out of marsdb-graph deliberately (that crate stores the value, it doesn’t know Cypher’s construction/ formatting rules – see PropertyValue’s own doc comment) and out of executor.rs (which owns dispatching to these, not the arithmetic itself, matching the split apply_arith/compare already have from e.g. the planner).

Structs§

CancellationToken
Cooperative cancellation handle for a running query. Clone it before execution and call cancel from another thread.
ExecutionEvent
ExecutionObserver
Dependency-free callback adapter for sending execution events to an application’s logger, metrics collector, or tracing system.
ExecutionOptions
Per-statement safety limits and optional telemetry. Limit fields default to None, preserving unlimited behavior for trusted embedded callers.
Executor
ProcedureSignature
A procedure’s declared shape – everything Executor needs to validate a CALL at the point it’s about to run (arity, coarse argument-type compatibility, output column names for YIELD), before ever asking ProcedureProvider::call to actually produce rows.
Procedures
Arc<dyn ProcedureProvider> wrapper – same “manual Debug, derived Clone” shape executor::ExecutionObserver already uses for its own Arc<dyn Fn(..)>, so ExecutionOptions (which embeds this) can keep deriving both.
QueryResult

Enums§

ExecutionOutcome
Coarse, stable outcome category for telemetry. Error messages and query text are deliberately excluded to avoid leaking user data through an observer by default.
Literal
PathElem
One element of a Value::Path — a path is node, edge, node, edge, ..., node, alternating, as a single Vec, not two parallel node/edge vecs (which would create an unenforced nodes.len() == edges.len() + 1 invariant across every place a path gets built or read).
QueryError
Typed error taxonomy, in three tiers that reflect when the problem was knowable:
Statement
Value

Traits§

ProcedureProvider
Implemented by whatever embeds MarsDB to make CALL resolve to real behavior. Executor calls signature once per CALL (for compile- time-shaped validation) and call once per input row (standalone: once total, since there’s no input row to iterate).

Functions§

is_read_only
A statement never mutates anything iff it’s a MATCH ... RETURN with no DELETE/DETACH DELETE/SET tail and no MERGE clause anywhere in it (MERGE (n) RETURN n has a Tail::Return, but still writes whenever it has to create — checking tail alone here would be a real bug, not just an incomplete check: it would send a MERGE-that-creates through a ReadTransaction, which has no .insert). Statement::Create and every other Tail variant always write. Confirmed by tracing every function reachable from pattern/WHERE/WITH evaluation: none of them ever call a table-mutating *_in_txn method for a Tail::Return statement with no MERGE clause (a label-filtered scan looks up an existing label id, it never allocates one — allocation only happens in create_node_in_txn/create_edge_in_txn). Executor::execute uses this to decide whether to open a ReadTransaction (no contention with concurrent readers or a concurrent writer) or a WriteTransaction. Returns whether executing stmt can mutate the graph. Public so callers which execute generated or otherwise untrusted Cypher can enforce a read-only policy using the same classification as the executor.
parse
The real implementation behind lib.rs’s public parse – the pest-based parser.rs/cypher.pest this replaced are gone (see grammar/README.md).
parse_many
The real implementation behind lib.rs’s public parse_many (Phase 3 cutover) – parses a ;-separated batch of one or more statements ("CREATE (a); CREATE (b); MATCH (n) RETURN n"). queries : query (SEMI query)* EOF is a mars-specific grammar extension (see grammar/README.md), including stripping a single genuinely-trailing ; in Rust before parsing – the grammar rule itself has no trailing SEMI?, to avoid a queries/script prefix ambiguity.
substitute_params
Resolves every $name placeholder in stmt to a concrete Literal using params, in place. Called before execution so the executor never sees Literal::Param — see the unreachable! in executor::literal_to_value.
validate_statement