Skip to main content

Module registry

Module registry 

Source
Expand description

In-memory SyncRegistry keyed by user_id.

The registry is the optimistic layer of the “one running sync per user” rule (the authoritative layer is the DB query). Insertion is atomic — two threads racing through try_register will see exactly one win.

Structs§

AlreadyRunning
Returned by SyncRegistry::try_register when the user already has a running sync. Carries a snapshot of the existing run so the caller can build the 409 conflict response.
RunningSync
One in-flight sync. Stored behind an Arc so snapshot_for does not need the entire entry to live across the call.
RunningSyncSnapshot
Read-only snapshot of a running sync, used by handlers and conflict responses.
SyncRegistry
In-memory registry: user_id → RunningSync.