Crate batch_aint_one

Crate batch_aint_one 

Source
Expand description

Batch up multiple items for processing as a single unit.

I got 99 problems, but a batch ain’t one…

Sometimes it is more efficient to process many items at once rather than one at a time. Especially when the processing step has overheads which can be shared between many items.

Often applications work with one item at a time, e.g. select one row or insert one row. Many of these operations can be batched up into more efficient versions: select many rows and insert many rows.

A worker task is run in the background. Many client tasks (e.g. message handlers) can submit items to the worker and wait for them to be processed. The worker task batches together many items and processes them as one unit, before sending a result back to each calling task.

See the README for an example.

Structs§

Batcher
Groups items to be processed in batches.
Limits
A policy controlling limits on batch sizes and concurrency.

Enums§

BatchError
An error that occurred while trying to batch.
BatchingPolicy
A policy controlling when batches get processed.
OnFull
What to do when a batch becomes full.

Traits§

Processor
Process a batch of inputs for a given key.