Either append to index or save offsets to append at future fsync
(
&mut self,
min_tx_offset: TxOffset,
byte_offset: u64,
commit_len: u64,
)
| 332 | |
| 333 | /// Either append to index or save offsets to append at future fsync |
| 334 | pub fn append_after_commit( |
| 335 | &mut self, |
| 336 | min_tx_offset: TxOffset, |
| 337 | byte_offset: u64, |
| 338 | commit_len: u64, |
| 339 | ) -> Result<(), IndexError> { |
| 340 | self.bytes_since_last_index += commit_len; |
| 341 | |
| 342 | if self.candidate_min_tx_offset == 0 { |
| 343 | self.candidate_byte_offset = byte_offset; |
| 344 | self.candidate_min_tx_offset = min_tx_offset; |
| 345 | } |
| 346 | |
| 347 | if !self.require_segment_fsync { |
| 348 | self.append_internal()?; |
| 349 | } |
| 350 | |
| 351 | Ok(()) |
| 352 | } |
| 353 | |
| 354 | fn append_internal(&mut self) -> Result<(), IndexError> { |
| 355 | // If the candidate offset is zero, there has not been a commit since the last offset entry |