Skip to main content

Module queue

Module queue 

Source
Expand description

Generic primitives shared by every per-engine outbound sync queue.

Each *Outbound (columnar, vector, fts, spatial, timeseries) shares the same shape: a mutex-protected Vec<Pending…> plus a monotonic batch-ID counter for ACK correlation. Before this module was extracted that pattern was copy-pasted across five files (~1.1k lines of near-identical drain/ack/requeue plumbing). It now lives here exactly once.

Engine-specific code only writes:

  • the Pending… struct (a row payload + a batch_id field)
  • the public-facing wrapper that calls enqueue / drain / retain / requeue and exposes engine-specific acknowledge_* semantics

The mutex guards are deliberately recovered with let Ok(mut g) = lock: a poisoned outbound queue means another thread already crashed mid-sync, and silently dropping further sync work is preferable to propagating the poison and tearing down the whole runtime — the writes are already durable in the local engine.

Structs§

BatchIdGen
Monotonic batch-ID generator shared between sibling queues (e.g. the insert and delete queues of a single engine) so every in-flight ACK ID is globally unique inside one outbound.
PendingQueue
Mutex-wrapped pending queue. T is the engine-specific pending entry (e.g. PendingVectorInsert).