1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! A Tower middleware that provides a buffered mpsc for processing requests in batches.
//!
//! Writing data in bulk is a common technique for improving the efficiency of certain tasks.
//! `tower-batch` is a middleware that allows you to buffer requests for batch processing until
//! the buffer reaches a maximum size OR a maximum duration elapses.
//!
//! Clients enqueue requests by sending on the channel from any of the handles ([`Batch`]), and the
//! single service running elsewhere (usually spawned) receives and collects the requests wrapped
//! in [`Item(R)`](BatchControl::Item). Once the [`Batch`]) buffer is full or the maximum duration
//! elapses, the service is instructed to write the data with a [`Flush`](BatchControl::Flush)
//! request. Upon completion of the flush operation, the client's will receive a response with the
//! outcome.
/// Export tower's alias for a type-erased error type.
pub use BoxError;
pub use BatchLayer;
pub use Batch;
/// Signaling mechanism for services that allow processing in batches.