Crate Structure¶
Grafeo is organized into five crates with clear responsibilities.
Dependency Graph¶
graph BT
COMMON[grafeo-common]
CORE[grafeo-core]
ADAPTERS[grafeo-adapters]
ENGINE[grafeo-engine]
PYTHON[grafeo-python]
CORE --> COMMON
ADAPTERS --> COMMON
ADAPTERS --> CORE
ENGINE --> COMMON
ENGINE --> CORE
ENGINE --> ADAPTERS
PYTHON --> ENGINE grafeo-common¶
Foundation types and utilities.
| Module | Purpose |
|---|---|
types/ | NodeId, EdgeId, Value, LogicalType |
memory/ | Arena allocator, memory pools |
utils/ | Hashing, error types |
grafeo-core¶
Core data structures and execution engine.
| Module | Purpose |
|---|---|
graph/lpg/ | LPG storage (nodes, edges, properties) |
index/ | Hash, B-tree, adjacency indexes |
execution/ | DataChunk, operators, pipelines |
use grafeo_core::graph::LpgStore;
use grafeo_core::index::BTreeIndex;
use grafeo_core::execution::DataChunk;
grafeo-adapters¶
External interfaces and adapters.
| Module | Purpose |
|---|---|
query/gql/ | GQL parser (lexer, parser, AST) |
query/cypher/ | Cypher compatibility layer |
storage/ | Storage backends (memory, WAL) |
plugins/ | Plugin system |
grafeo-engine¶
Database facade and coordination.
| Module | Purpose |
|---|---|
database.rs | Database struct, lifecycle |
session.rs | Session management |
query/ | Query processor, planner, optimizer |
transaction/ | Transaction manager, MVCC |
grafeo-python¶
Python bindings via PyO3.
| Module | Purpose |
|---|---|
database.rs | PyGrafeoDB class |
query.rs | Query execution |
types.rs | Type conversions |
Crate Guidelines¶
- No cyclic dependencies - Strict layering
- Public API minimization - Only expose what's needed
- Feature flags - Optional functionality gated by features
- Documentation - All public items documented