use arrow::record_batch::RecordBatch;
#[cfg(feature = "cdc")]
pub mod cdc;
#[cfg(feature = "mq")]
pub mod mq;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct BatchEnvelope<P> {
source_position: P,
schema_revision: u64,
}
impl<P> BatchEnvelope<P> {
#[must_use]
pub const fn new(source_position: P, schema_revision: u64) -> Self {
Self {
source_position,
schema_revision,
}
}
#[must_use]
pub const fn source_position(&self) -> &P {
&self.source_position
}
#[must_use]
pub const fn schema_revision(&self) -> u64 {
self.schema_revision
}
#[must_use]
pub fn into_source_position(self) -> P {
self.source_position
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct EnvelopedBatch<T, P> {
batch: T,
envelope: BatchEnvelope<P>,
}
impl<T, P> EnvelopedBatch<T, P> {
#[must_use]
pub const fn new(batch: T, envelope: BatchEnvelope<P>) -> Self {
Self { batch, envelope }
}
#[must_use]
pub const fn batch(&self) -> &T {
&self.batch
}
#[must_use]
pub const fn envelope(&self) -> &BatchEnvelope<P> {
&self.envelope
}
#[must_use]
pub fn into_batch(self) -> T {
self.batch
}
#[must_use]
pub fn into_parts(self) -> (T, BatchEnvelope<P>) {
(self.batch, self.envelope)
}
}
pub type EnvelopedRecordBatch<P> = EnvelopedBatch<RecordBatch, P>;