Skip to main content

Module backlog_flusher

Module backlog_flusher 

Source
Expand description

Local-clip backlog: enqueue offline-captured clips, flush them on (re)connect in chronological order. See docs/superpowers/specs/2026-05-20-clipboard-backlog-flush-design.md.

Structs§

FlushGate
Reentrancy gate for flush_once. Process-local — call try_enter before dispatching a flush; if it returns None, another flush is in progress and the caller should skip silently.
FlushGuard
FlushReport

Enums§

FlushError

Constants§

MAX_UNSYNCED
Cap on number of synced=false rows allowed in the local store. Older rows are dropped when this limit is exceeded.

Functions§

enqueue_local
Persist a clip to the local store with a local-<ULID> id and synced=false, then enforce the offline cap. Returns the temporary id — also used as the relay idempotency_key on flush so the relay can dedup retries.
flush_once
Push every synced=false clip in created_at ASC order. Stops on the first transient (5xx / Network) error; drops rows on permanent (4xx / Decode) errors; drops rows whose plaintext content is missing (media-only).
format_rfc3339_millis
Convert a Unix millis timestamp to the RFC3339 string the relay’s parser expects for client_created_at.