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

Method flush_and_sync

crates/commitlog/src/stream/writer.rs:417–434  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

415 }
416
417 async fn flush_and_sync(&mut self) -> io::Result<()> {
418 self.segment.flush().await?;
419 self.segment.fsync().await;
420 if let Some(mut index) = self.offset_index.take() {
421 let index = spawn_blocking(move || {
422 index
423 .fsync()
424 .inspect_err(|e| warn!("offset index fsync failed: {e}"))
425 .ok();
426 index
427 })
428 .await
429 .unwrap();
430 self.offset_index = Some(index);
431 }
432
433 Ok(())
434 }
435}
436
437/// Create a new segment at offset `last_written_tx_range.end`.

Callers 2

sync_allMethod · 0.45
closeMethod · 0.45

Calls 6

OkFunction · 0.50
flushMethod · 0.45
fsyncMethod · 0.45
takeMethod · 0.45
unwrapMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected