/** Per-key coalescing queue for high-frequency row updates. * * Cursor-shaped workloads call `collection.update()` many times a second. Sent * one-for-one, each call is a request, a database write and a broadcast. This * queue holds a single merged slot per row key: while a request is in flight, * further updates for that key merge into the slot and go out as one follow-up * once it lands. Request frequency settles at `min(update rate, 1/RTT)` without * a tuned throttle constant, and the optimistic UI is untouched — only the * network is coalesced. */ export type UpdateQueueConfig = { /** Sends one merged batch of changes and resolves with the canonical row. */ send: (key: TKey, changes: Record) => Promise; /** Called with the server's row before the batch's waiters resolve. Awaited, * so a handler that needs to recover (refetch) finishes first. */ onResult: (row: TRow) => void | Promise; }; export type UpdateQueue = { /** Queues changes for `key`. Resolves once a request carrying them lands. */ enqueue: (key: TKey, changes: Record) => Promise; /** Drops changes still queued for `key` (resolving their waiters) and waits * for any in-flight request to land. For operations that supersede pending * updates and must not race them — a delete of the same row. */ settle: (key: TKey) => Promise; }; export declare function createUpdateQueue(config: UpdateQueueConfig): UpdateQueue; //# sourceMappingURL=update-queue.d.ts.map