Skip to main content

Module batch_insert

Module batch_insert 

Source
Expand description

Issue #582 — Analytics slice 4: BatchInsertEndpoint HTTP support.

Owns the config + durable idempotency receipts that the POST /collections/:name/batch handler uses to:

  • reject batches exceeding red.batch.max_rows with 413 BatchTooLarge before any storage work,
  • deduplicate requests carrying the same Idempotency-Key within red.batch.idempotency_window_secs, returning the previously committed response body verbatim across process failover,
  • report row-level validation failures by index so the caller can pinpoint the row that broke the all-or-nothing commit.

The actual commit + AnalyticsSchemaRegistry validation runs in the handler (server::handlers_entity::handle_batch_insert). This module only owns the pieces that need to be unit-testable without booting a full HTTP server.

Structs§

BatchInsertConfig
Knobs for the batch endpoint. Read from RED_BATCH_* env vars at process start; the red.batch.* config keys in the brief route to the same defaults until the broader config-overlay binding lands.
DurableReceipt
A committed response for a (collection, idempotency-key) pair.

Enums§

BatchInsertError

Functions§

insert_durable_receipt
lock_durable_commit
lookup_durable_receipt
unix_time_ms