38 lines
2.2 KiB
Markdown
Raw Normal View History

2026-05-21 16:16:14 +02:00
## Crates
2026-06-05 11:31:18 +02:00
Each subdirectory is a Cargo package with its own `Cargo.toml`.
Layout:
2026-05-21 16:16:14 +02:00
```text
crates/
app-name/
Cargo.toml
src/
main.rs
```
2026-06-05 11:31:18 +02:00
### Responsibilities and Dependencies
| Crate | Kind | Responsibility | Depends On |
|------------------|-----------------|-------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|
| `storage` | library | Backend-agnostic `Storage` and `Transaction` traits, plus adapters: `MemoryStorage`, `LmdbStorage`, `RedbStorage`, `FjallStorage`, `SqliteStorage`, `GeomergeStorage` (feature-gated). Owns `Value`, `Table`, `RowId`, `StorageError`, `CodecError`. | external `geomerge` (only with the `geomerge` feature) |
| `query-ops` | library | Snapshot query operators: `scan_atom`, `semijoin`, `natural_join`. Owns `Relation`, `AtomPattern`, `Term`. | `storage` |
| `plan-runner` | library + `plan-run` CLI | Executes JSON plan IR against a chosen `Storage` backend via `--backend {memory \| memory-storage \| lmdb \| redb \| fjall \| sqlite \| geomerge}`. Walks the DAG using `query-ops` operators and verifies against `expected_bindings`. | `query-ops`, `storage` (all adapter features) |
| `geomerge-demo` | binary | End-to-end example exercising `GeomergeStorage`: theory loading, transactional inserts, scan, persistence round trip, law validation. | `storage` (with `geomerge`), external `geomerge` |
The dependency edges form a strict DAG:
```text
storage ◄── query-ops ◄── plan-runner
▲ │
└── geomerge-demo │
(also depends on │
external geomerge) │
(all storage features on)
```
No cycles, no upward dependencies.
`query-ops` and `plan-runner` are layered above `storage`;
`geomerge-demo` sits beside them as a runnable example.