pub struct Batch<R = Vec<Record<RecordData>, Global>> {
pub base_offset: i64,
pub batch_len: i32,
pub header: BatchHeader,
/* private fields */
}
Fields§
§base_offset: i64
§batch_len: i32
§header: BatchHeader
Implementations§
source§impl<R> Batch<R>
impl<R> Batch<R>
pub fn get_mut_header(&mut self) -> &mut BatchHeader
pub fn get_header(&self) -> &BatchHeader
pub fn own_records(self) -> R
pub fn records(&self) -> &R
pub fn mut_records(&mut self) -> &mut R
pub fn get_base_offset(&self) -> i64
pub fn set_base_offset(&mut self, offset: i64)
pub fn base_offset(self, offset: i64) -> Batch<R>
pub fn add_to_offset_delta(&mut self, delta: i32)
pub fn set_offset_delta(&mut self, delta: i32)
pub fn get_last_offset(&self) -> i64
pub fn records_len(&self) -> usize
sourcepub fn get_last_offset_delta(&self) -> u32
👎Deprecated since 0.9.2: use last_offset_delta instead
pub fn get_last_offset_delta(&self) -> u32
get last offset delta
pub fn last_offset_delta(&self) -> i32
pub fn get_compression(&self) -> Result<Compression, CompressionError>
source§impl<R> Batch<R>where
R: Encoder,
impl<R> Batch<R>where R: Encoder,
sourcepub fn validate_decoding(&self) -> bool
pub fn validate_decoding(&self) -> bool
check if batch is valid after decoded
source§impl<R> Batch<R>where
R: BatchRecords,
impl<R> Batch<R>where R: BatchRecords,
sourcepub fn new_with_len(len: i32) -> Batch<R>
pub fn new_with_len(len: i32) -> Batch<R>
create new batch with len
sourcepub fn computed_last_offset(&self) -> i64
pub fn computed_last_offset(&self) -> i64
computed last offset which is base offset + number of records
source§impl Batch<Vec<Record<RecordData>, Global>>
impl Batch<Vec<Record<RecordData>, Global>>
sourcepub fn add_record(&mut self, record: Record<RecordData>)
pub fn add_record(&mut self, record: Record<RecordData>)
add new record, this will update the offset to correct
pub fn add_records(&mut self, records: &mut Vec<Record<RecordData>, Global>)
pub fn update_offset_deltas(&mut self)
pub fn into_consumer_records_iter( self, partition: u32 ) -> impl Iterator<Item = ConsumerRecord<Record<RecordData>>>
source§impl Batch<RawRecords>
impl Batch<RawRecords>
pub fn memory_records( &self ) -> Result<Vec<Record<RecordData>, Global>, CompressionError>
Trait Implementations§
source§impl<R> Decoder for Batch<R>where
R: BatchRecords,
impl<R> Decoder for Batch<R>where R: BatchRecords,
source§impl<R> Encoder for Batch<R>where
R: BatchRecords,
impl<R> Encoder for Batch<R>where R: BatchRecords,
source§impl<T> From<T> for Batch<Vec<Record<RecordData>, Global>>where
T: Into<Vec<Record<RecordData>, Global>>,
impl<T> From<T> for Batch<Vec<Record<RecordData>, Global>>where T: Into<Vec<Record<RecordData>, Global>>,
source§impl TryFrom<Batch<RawRecords>> for Batch<Vec<Record<RecordData>, Global>>
impl TryFrom<Batch<RawRecords>> for Batch<Vec<Record<RecordData>, Global>>
§type Error = CompressionError
type Error = CompressionError
The type returned in the event of a conversion error.
source§fn try_from(
batch: Batch<RawRecords>
) -> Result<Batch<Vec<Record<RecordData>, Global>>, <Batch<Vec<Record<RecordData>, Global>> as TryFrom<Batch<RawRecords>>>::Error>
fn try_from( batch: Batch<RawRecords> ) -> Result<Batch<Vec<Record<RecordData>, Global>>, <Batch<Vec<Record<RecordData>, Global>> as TryFrom<Batch<RawRecords>>>::Error>
Performs the conversion.
source§impl TryFrom<Batch<Vec<Record<RecordData>, Global>>> for Batch<RawRecords>
impl TryFrom<Batch<Vec<Record<RecordData>, Global>>> for Batch<RawRecords>
§type Error = CompressionError
type Error = CompressionError
The type returned in the event of a conversion error.
source§fn try_from(
f: Batch<Vec<Record<RecordData>, Global>>
) -> Result<Batch<RawRecords>, <Batch<RawRecords> as TryFrom<Batch<Vec<Record<RecordData>, Global>>>>::Error>
fn try_from( f: Batch<Vec<Record<RecordData>, Global>> ) -> Result<Batch<RawRecords>, <Batch<RawRecords> as TryFrom<Batch<Vec<Record<RecordData>, Global>>>>::Error>
Performs the conversion.