tower_batch_control/message.rs
1//! Batch message types.
2
3use tokio::sync::{oneshot, OwnedSemaphorePermit};
4
5use super::error::ServiceError;
6
7/// Message sent to the batch worker
8#[derive(Debug)]
9pub(crate) struct Message<Request, Fut> {
10 pub(crate) request: Request,
11 pub(crate) tx: Tx<Fut>,
12 pub(crate) span: tracing::Span,
13 pub(super) _permit: OwnedSemaphorePermit,
14}
15
16/// Response sender
17pub(crate) type Tx<Fut> = oneshot::Sender<Result<Fut, ServiceError>>;
18
19/// Response receiver
20pub(crate) type Rx<Fut> = oneshot::Receiver<Result<Fut, ServiceError>>;