use std::collections::HashMap;
use std::sync::Arc;
use crate::landing_zone::{Countable, LandingZone};
use crate::{EncodedBatch, OffsetId, ZerobusResult};
#[derive(Debug, Clone)]
pub(super) struct IngestRequest {
pub(super) payload: EncodedBatch,
pub(super) offset_id: OffsetId,
}
impl Countable for IngestRequest {
fn count(&self) -> usize {
self.payload.get_record_count()
}
}
pub(super) type OneshotMap =
HashMap<OffsetId, tokio::sync::oneshot::Sender<ZerobusResult<OffsetId>>>;
pub(super) type RecordLandingZone = Arc<LandingZone<Box<IngestRequest>>>;
#[derive(Debug, Clone)]
pub(super) enum CallbackMessage {
Ack(OffsetId),
Error(OffsetId, String),
}