pub struct Batch<R = Vec<Record>> {
pub base_offset: i64,
pub batch_len: i32,
pub header: BatchHeader,
pub schema_id: SchemaId,
/* private fields */
}
Fields§
§base_offset: i64
§batch_len: i32
§header: BatchHeader
§schema_id: SchemaId
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>
pub fn get_base_timestamp(&self) -> i64
sourcepub fn decode_from_file_buf<T>(
&mut self,
src: &mut T,
version: i16
) -> Result<(), Error>where
T: Buf,
pub fn decode_from_file_buf<T>(
&mut self,
src: &mut T,
version: i16
) -> Result<(), Error>where
T: Buf,
decode from buf stored in the file read all excluding records
pub fn schema_id(&self) -> SchemaId
pub fn set_schema_id(&mut self, sid: SchemaId)
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
impl Batch
sourcepub fn add_record(&mut self, record: Record)
pub fn add_record(&mut self, record: Record)
add new record, this will update the offset to correct
pub fn add_records(&mut self, records: &mut Vec<Record>)
pub fn update_offset_deltas(&mut self)
pub fn into_consumer_records_iter( self, partition: u32 ) -> impl Iterator<Item = ConsumerRecord>
source§impl Batch<RawRecords>
impl Batch<RawRecords>
pub fn memory_records(&self) -> Result<Vec<Record>, 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 TryFrom<Batch<RawRecords>> for Batch
impl TryFrom<Batch<RawRecords>> for Batch
§type Error = CompressionError
type Error = CompressionError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl<R> Freeze for Batch<R>where
R: Freeze,
impl<R> RefUnwindSafe for Batch<R>where
R: RefUnwindSafe,
impl<R> Send for Batch<R>where
R: Send,
impl<R> Sync for Batch<R>where
R: Sync,
impl<R> Unpin for Batch<R>where
R: Unpin,
impl<R> UnwindSafe for Batch<R>where
R: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more