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

Method flush_and_sync

crates/commitlog/src/lib.rs:310–317  ·  view source on GitHub ↗

Write all outstanding transaction records to disk and flush OS buffers. Equivalent to calling [`Self::flush`] followed by [`Self::sync`], but without releasing the write lock in between. # Errors An error is returned if writing to disk fails due to an I/O error. # Panics This method panics if syncing fails irrecoverably.

(&self)

Source from the content-addressed store, hash-verified

308 ///
309 /// This method panics if syncing fails irrecoverably.
310 pub fn flush_and_sync(&self) -> io::Result<Option<u64>> {
311 let mut inner = self.inner.write().unwrap();
312 trace!("flush and sync commitlog");
313 inner.flush()?;
314 inner.sync();
315
316 Ok(inner.max_committed_offset())
317 }
318
319 /// Obtain an iterator which traverses the log from the start, yielding
320 /// [`StoredCommit`]s.

Callers 5

bench_appendFunction · 0.45
smokeFunction · 0.45
resetsFunction · 0.45
compressionFunction · 0.45
fill_logFunction · 0.45

Calls 6

OkFunction · 0.50
unwrapMethod · 0.45
writeMethod · 0.45
flushMethod · 0.45
syncMethod · 0.45
max_committed_offsetMethod · 0.45

Tested by 4

smokeFunction · 0.36
resetsFunction · 0.36
compressionFunction · 0.36
fill_logFunction · 0.36