Skip to main content

Module live

Module live 

Source
Expand description

Wake-only long-poll plumbing for GET /client/v3/sync, plus the per-caller token bucket for POST /client/v3/keys/claim.

/sync is pull, not push. A client polls with since, the server blocks up to timeout, and on wake it rebuilds the response from the database. The registry carries no payloads. A burst of writes against one key coalesces into one rebuilt response.

Register, then read the database, then wait. LiveRegistry::register snapshots the generation before the read, so a wake that lands during the read is still observed by Registration::wait. Wake keys are user:{user_id}. Call LiveRegistry::wake_many only after the connection mutex is released.

Notify::notify_waiters has no memory. Registration::wait enables its Notified future and then re-checks the generation, so a wake that fired before wait is not lost.

Structs§

ClaimRateLimiter
Per-caller token bucket for POST /client/v3/keys/claim. One token per requested device. A batch that would exceed the cap is refused whole.
LiveRegistry
Registry of wake-only long-poll keys.
Registration

Enums§

WaitOutcome