Expand description
Graph storage backends for AINL memory.
Defines the GraphStore trait and the SQLite implementation.
§Referential integrity (SQLite)
ainl_graph_edges uses real FOREIGN KEY (from_id) / FOREIGN KEY (to_id) references to
ainl_graph_nodes(id) with ON DELETE CASCADE. SqliteGraphStore::open and
SqliteGraphStore::from_connection run PRAGMA foreign_keys = ON on the handle.
Databases created before these constraints used a plain edges table; SqliteGraphStore::ensure_schema
runs a one-time migrate_edges_add_foreign_keys rebuild. Edge rows whose endpoints
are missing from ainl_graph_nodes cannot be kept under FK rules and are omitted from
the migrated copy.
§Above the database (still recommended)
- Eager checks:
SqliteGraphStore::write_node_with_edges,SqliteGraphStore::insert_graph_edge_checkedgive clear errors without relying on SQLite error text alone. - Repair / forensic import:
SqliteGraphStore::import_graphwithallow_dangling_edges: trueis the supported way to load snapshots that violate referential integrity: FK enforcement is disabled only for the duration of that import, then turned back on. Follow withSqliteGraphStore::validate_graphbefore resuming normal writes on the same connection. - Semantic graph checks:
SqliteGraphStore::validate_graph(agent-scoped edges, dangling diagnostics, cross-agent boundary counts, etc.) — orthogonal to FK row existence.
SQLite tables integrate with existing openfang-memory schema where applicable.
Structs§
- Sqlite
Graph Store - SQLite implementation of GraphStore
Traits§
- Graph
Store - Graph memory storage trait - swappable backends