mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 05:26:47 +00:00
06dfdc6943
Rate-limit counters, OAuth pending codes, OIDC login states and codes, the permissions cache and the WebSocket rooms were Maps on module or instance scope. That is right while TREK runs as one process, but nothing could be swapped without editing every consumer. Each now sits behind a port with an in-memory implementation that keeps the old behaviour exactly: RateLimitStore, PendingCodeStore, OidcFlowStore, PermissionsCacheStore and RoomRegistry. The owning module provides the implementation with the same lifetime the state had (process-wide for the pending codes, the permissions cache and the rooms, per instance for the rate limits and the OIDC flows), the consumers take it through their constructor, and a hand-built consumer falls back to the same in-memory store, so tests and the free-function paths (the backup restore's cache flush, the broadcasts) see what they saw before. A store shared between processes can replace a provider later without touching the services.