Expand description
SparrowDB — top-level public API.
§Transaction model (Phase 5 — SWMR)
-
Single Writer: at most one
WriteTxmay be active at a time.GraphDb::begin_writereturnsError::WriterBusyif a writer is already open. -
Multiple Readers: any number of
ReadTxhandles may coexist with an active writer. Each reader pins the committedtxn_idat open time and sees only data committed at or before that snapshot.
§Snapshot isolation for set_node_col
Property updates (set_node_col) are recorded in an in-memory version
chain keyed by (NodeId, col_id). Each entry is a (txn_id, Value)
pair. When a ReadTx reads a property it first consults the version chain
and returns the most-recent value with txn_id <= snapshot_txn_id, falling
back to the on-disk value written by create_node if no such entry exists.
§Quick start
use sparrowdb::GraphDb;
let db = GraphDb::open(std::path::Path::new("/tmp/my.sparrow")).unwrap();
db.checkpoint().unwrap();
db.optimize().unwrap();Re-exports§
Modules§
- export
- Graph export / import tooling for cross-version migration (SPA-XXX).
Structs§
- DbStats
- Storage-size snapshot returned by
GraphDb::stats(SPA-171). - EdgeId
- Opaque 64-bit edge identifier. Edge identifier: monotonic u64 sourced from the active metapage.
- GraphDb
- The top-level SparrowDB handle.
- NodeId
- Opaque 64-bit node identifier. Node identifier: upper 16 bits = label_id, lower 48 bits = slot_id.
- Query
Result - Query result returned by
GraphDb::executeand [GraphDb::execute_write]. Contains column names and rows of scalarValuecells. Final materialized query result. - ReadTx
- A read-only snapshot transaction.
- WriteTx
- A write transaction.
Enums§
- Error
- Error type returned by all SparrowDB operations. All errors that SparrowDB can return.
- Value
- Scalar value type used in query results and node property reads/writes. A typed property value.
Functions§
- cypher_
escape_ string - Escape a Rust
&strso it can be safely interpolated inside a single-quoted Cypher string literal. - fnv1a_
col_ id - Derive a stable
u32column ID from a property key name. - migrate_
wal - Migrate WAL segments from legacy v21 (CRC32 IEEE) to v2 (CRC32C Castagnoli).
- open
- Convenience wrapper — equivalent to
GraphDb::open.