Skip to main content

Crate rocksgraph

Crate rocksgraph 

Source
Expand description

RocksGraph — a Gremlin-inspired property graph database engine backed by RocksDB.

§Quick start

use rocksgraph::{Graph, TraversalBuilder, Value};


// Read-write transaction
let mut tx = graph.begin();
tx.g().addV("person").property("id", 1).property("name", "alice").next().unwrap();
tx.g().addV("person").property("id", 2).property("name", "bob").next().unwrap();
tx.g().addE("knows").from(1).to(2).property("weight", 0.9f64).next().unwrap();
tx.commit().unwrap();

// Read-only snapshot query
let mut snap = graph.read();
let count = snap.g().V([1]).out(["knows"]).count().next().unwrap().unwrap();
assert_eq!(count, Value::Int64(1));
let names = snap.g().V([1]).out(["knows"]).values(["name"]).to_list().unwrap();
assert_eq!(names, vec![Value::String("bob".into())]);
for v in snap.g().V([]).out(["knows"]).iter().unwrap() { println!("{:?}", v.unwrap()); }

§Architecture

Graph::open / graph.read() / graph.begin()          ← api (pub)
  │  session.g() → ReadTraversal / WriteTraversal
  │               step methods: self → Self (move semantics)
  │               terminals: .next()? / .to_list()? / .iter()?
  ▼
gremlin::traversal   fluent builder → LogicalPlan AST
  ▼
planner              AST → LogicalPlan IR + optimizer
  ▼
engine::volcano      pull-based Volcano iterator pipeline
  ▼
graph                query-scoped overlay (OCC dirty tracking)
  ▼
store / RocksDB      OptimisticTransactionDB

All modules below api are pub(crate) — users only interact through Graph, ReadSession, TxSession, and the traversal types re-exported at the crate root.

Re-exports§

pub use api::Graph;
pub use api::ReadSession;
pub use api::TxSession;

Modules§

api
High-level user-facing API.
schema

Structs§

BuiltTraversal
The result of building a traversal — a pull-based lazy iterator over results.
BulkEdge
BulkLoadStats
BulkSchema
BulkVertex
Edge
A fully materialized directed edge with all its properties.
EdgeListSource
Reads a SNAP-format edge list (one src dst pair per line, comment lines start with #).
Map
An ordered key-value map (output of valueMap(), elementMap(), etc.).
Path
A sequence of traversal positions, each tagged with zero or more step labels.
Property
A property element flowing through the pipeline (output of .properties("name")).
ReadTraversal
A read-only traversal bound to a ReadSession context.
RocksOptions
Storage-tuning options for the RocksDB backend.
SstBulkLoader
Loads a graph dataset into RocksDB at disk-write speed via SST ingestion.
Vertex
A fully materialized vertex with all its properties.
WriteTraversal
A read-write traversal bound to a TxSession context.

Enums§

Predicate
A filter predicate for .has() and .is() steps.
Primitive
A scalar value that can appear as a property value or standalone scalar.
StoreError
Value
The single user-facing value type for all traversal inputs and outputs.

Traits§

TraversalBuilder
Shared read pipeline steps for both ReadTraversal and WriteTraversal.

Functions§

__
Entry point for anonymous sub-traversals (mirrors Gremlin’s __).
between
Filter: lo ≤ value < hi.
eq
Filter: equal to v.
gt
Filter: greater than v.
gte
Filter: greater than or equal to v.
lt
Filter: less than v.
lte
Filter: less than or equal to v.
ne
Filter: not equal to v.
within
Filter: value is one of vs.
without
Filter: value is none of vs.