MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / append_after_commit

Method append_after_commit

crates/commitlog/src/segment.rs:334–352  ·  view source on GitHub ↗

Either append to index or save offsets to append at future fsync

(
        &mut self,
        min_tx_offset: TxOffset,
        byte_offset: u64,
        commit_len: u64,
    )

Source from the content-addressed store, hash-verified

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

Callers 3

commitMethod · 0.80
append_all_innerMethod · 0.80

Calls 2

append_internalMethod · 0.80
OkFunction · 0.50

Tested by 1