Skip to content

Persistent Cortex storage with Sled backend and Ineru snapshots#60

Merged
ApiliumDevTeam merged 2 commits intomainfrom
feat/persistent-cortex-storage
Mar 9, 2026
Merged

Persistent Cortex storage with Sled backend and Ineru snapshots#60
ApiliumDevTeam merged 2 commits intomainfrom
feat/persistent-cortex-storage

Conversation

@ApiliumDevTeam
Copy link
Contributor

Summary

  • Default GraphDB backend changed from in-memory to Sled (~/.aingle/cortex/graph.sled), with --memory flag for volatile mode
  • Added --db <PATH> CLI flag to customize storage location
  • Added /api/flush endpoint and automatic flush on SIGTERM/SIGINT
  • IneruMemory snapshot persistence (save/load on startup/shutdown)
  • Graceful shutdown handler for both SIGTERM and SIGINT via tokio::select!

Test plan

  • cargo build --workspace && cargo test --workspace
  • Start cortex, add triples, stop, restart → triples persist
  • aingle-cortex --memory → volatile mode, data lost on restart
  • curl -X POST localhost:2520/api/flush → 200 OK
  • Send SIGTERM → verify flush logs before exit

Switch Cortex from volatile in-memory GraphDB to Sled-backed persistent
storage by default (~/.aingle/cortex/graph.sled). Add --db and --memory
CLI flags, /api/v1/flush endpoint, Ineru memory snapshot export/import,
and graceful shutdown with automatic data flush.

- Add db_path to CortexConfig with :memory: escape hatch
- Add AppState::with_db_path() for Sled or memory initialization
- Add AppState::flush() for graph + Ineru snapshot persistence
- Add GraphDB::flush() and GraphStore::flush() delegating to backend
- Add IneruMemory export/import/save/load snapshot methods
- Add POST /api/v1/flush REST endpoint
- Enable sled-backend feature in aingle_cortex by default
- Graceful shutdown flushes graph + saves Ineru snapshot on SIGINT
- Bump all crate versions 0.4.0 → 0.4.1
Use tokio::select! to listen for both SIGINT (ctrl_c) and SIGTERM,
ensuring Cortex flushes graph data and saves Ineru snapshots when
the sidecar manager sends SIGTERM during binary updates.
@ApiliumDevTeam ApiliumDevTeam merged commit edeefcd into main Mar 9, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant