use crate::{error::BoxError, message::SourceMessage, sink::Sink};
use std::future::Future;
pub trait TransactionalSink<M: SourceMessage, T>: Sink<T> {
fn verify_source(&self, delivery: &M) -> impl Future<Output = Result<(), BoxError>> + Send;
fn commit(
&self,
batch: &[TransactionEntry<'_, M, Self::Prepared>],
) -> impl Future<Output = Result<(), BoxError>> + Send;
}
pub struct TransactionEntry<'a, M, P> {
pub delivery: &'a M,
pub outputs: &'a [P],
}
impl<M, P> Clone for TransactionEntry<'_, M, P> {
fn clone(&self) -> Self {
*self
}
}
impl<M, P> Copy for TransactionEntry<'_, M, P> {}