use std::time::Duration;
use tokio_util::sync::CancellationToken;
use crate::consumer_supervisor::SupervisorOutcome;
use crate::error::{Result, ShoveError};
use crate::handler::MessageHandler;
use crate::topic::{SequencedTopic, Topic};
#[allow(dead_code)]
pub(crate) trait RegistryImpl: Send {
type GroupConfig;
fn register<T, H>(
&mut self,
config: Self::GroupConfig,
factory: impl Fn() -> H + Send + Sync + 'static,
ctx: H::Context,
) -> impl Future<Output = Result<()>> + Send
where
T: Topic,
H: MessageHandler<T>;
fn register_fifo<T, H>(
&mut self,
_factory: impl Fn() -> H + Send + Sync + 'static,
_ctx: H::Context,
) -> impl Future<Output = Result<()>> + Send
where
T: SequencedTopic,
H: MessageHandler<T>,
{
async {
Err(ShoveError::Topology(
"register_fifo is not yet implemented for this backend; \
use the backend-specific consumer's run_fifo_until_timeout instead"
.into(),
))
}
}
fn cancellation_token(&self) -> CancellationToken;
fn run_until_timeout<S>(
self,
signal: S,
drain_timeout: Duration,
) -> impl Future<Output = SupervisorOutcome> + Send
where
S: Future<Output = ()> + Send + 'static;
}