Decode either the block count or remaining capacity from `data` (an OCF block payload). Returns the number of bytes consumed from `data` along with the number of records decoded.
(&mut self, data: &[u8], count: usize)
| 885 | // |
| 886 | // Returns the number of bytes consumed from `data` along with the number of records decoded. |
| 887 | fn decode_block(&mut self, data: &[u8], count: usize) -> Result<(usize, usize), AvroError> { |
| 888 | // OCF decoding never interleaves records across blocks, so no chunking. |
| 889 | let to_decode = std::cmp::min(count, self.remaining_capacity); |
| 890 | if to_decode == 0 { |
| 891 | return Ok((0, 0)); |
| 892 | } |
| 893 | let consumed = self.active_decoder.decode(data, to_decode)?; |
| 894 | self.remaining_capacity -= to_decode; |
| 895 | Ok((consumed, to_decode)) |
| 896 | } |
| 897 | |
| 898 | // Produce a `RecordBatch` if at least one row is fully decoded, returning |
| 899 | // `Ok(None)` if no new rows are available. |