Expand description
Issue #582 — Analytics slice 4: BatchInsertEndpoint HTTP support.
Owns the config + in-memory idempotency cache that the
POST /collections/:name/batch handler uses to:
- reject batches exceeding
red.batch.max_rowswith413 BatchTooLargebefore any storage work, - deduplicate requests carrying the same
Idempotency-Keywithinred.batch.idempotency_window_secs, returning the previously cached response body verbatim, - 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§
- Batch
Insert Cache - In-memory
(collection, idempotency-key) → CachedResponsemap. Pruned lazily on everylookup/storerather than via a background task — the working set is bounded by theidempotency_windowand aMutexis cheap enough at the batch-insert call rate. - Batch
Insert Config - Knobs for the batch endpoint. Read from
RED_BATCH_*env vars at process start; thered.batch.*config keys in the brief route to the same defaults until the broader config-overlay binding lands. - Cached
Response - A response previously served for a given
(collection, idempotency-key). Stored verbatim so a replay returns byte-for-byte what the caller would have seen the first time, even if the underlying state has since drifted.
Enums§
Functions§
- global_
cache - Process-wide cache. The brief states the dedup window is “in-memory per primary” — one process, one cache.