CatalogStore is the TUI's view of the daemons-and-sessions tree, backed by `WS /api/events` on the local daemon. The daemon's WS opens with a Snapshot frame, so that's bootstrap; subsequent frames are deltas. No separate REST round-trip needed. Surface: - `apply_event` — pure, used by tests directly and by the WS loop. - `snapshot()` — cheap O(d+s) read returning sorted Vec views + monotonic version for cheap render staleness checks. - `wait_for_initial_snapshot` / `changed` — render-loop wakeups. - `run_events_loop(ws_url)` — long-running task with exponential backoff (1s → 30s, ±25% jitter). Reconnect re-sends a fresh Snapshot, which reconciles state without server-side replay. 8 unit tests + 1 axum WS round-trip integration test passing.
This commit is contained in:
Vendored
Reference in New Issue
Block a user