Skip to main content

Module graph

Module graph 

Source
Expand description

In-memory entity graph with indexed querying, change tracking, and thread-safe access.

The graph module provides a high-performance entity store optimized for the Haystack read/write/subscribe pattern:

  • EntityGraph — The core graph store with entities, indexes, and query engine. Supports bitmap tag indexes, B-tree value indexes, bidirectional ref adjacency, and optional CSR representation for cache-friendly traversal.
  • SharedGraph — Thread-safe wrapper (Arc<RwLock<EntityGraph>>) for concurrent access from server handlers, WebSocket watches, and federation sync.
  • GraphDiff / DiffOp — Change tracking entries (add/update/remove) stored in a bounded changelog for incremental sync and watch notification.

§Submodules

ModuleDescription
entity_graphCore EntityGraph with CRUD, filter queries, namespace-aware evaluation
sharedSharedGraph — concurrent read/write access with parking_lot::RwLock
bitmapTagBitmapIndex — bitset-per-tag for O(popcount) Has/Missing filters
value_indexValueIndex — B-tree indexes for range queries (temp > 72)
adjacencyRefAdjacency — bidirectional HashMap<SmallVec> for ref edges
csrCSRAdjacency — Compressed Sparse Row format for read-heavy traversal
columnarColumnarStore — struct-of-arrays entity storage for scan-heavy workloads
changelogGraphDiff / DiffOp — bounded change log with version tracking
query_plannerTwo-phase query: bitmap acceleration → AST evaluation on candidates

Re-exports§

pub use changelog::ChangelogGap;
pub use changelog::DEFAULT_CHANGELOG_CAPACITY;
pub use changelog::DiffOp;
pub use changelog::GraphDiff;
pub use entity_graph::EntityGraph;
pub use entity_graph::GraphError;
pub use entity_graph::HierarchyNode;
pub use shared::SharedGraph;
pub use snapshot::SnapshotError;
pub use snapshot::SnapshotMeta;
pub use snapshot::SnapshotReader;
pub use snapshot::SnapshotWriter;
pub use subscriber::GraphSubscriber;

Modules§

adjacency
bitmap
changelog
columnar
csr
entity_graph
query_planner
shared
snapshot
HLSS v1 binary snapshot format — write/read EntityGraph state to disk.
subscriber
value_index