MCPcopy Create free account
hub / github.com/cosdata/cosdata / flush

Method flush

src/models/buffered_io.rs:61–70  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

59 }
60
61 fn flush(&self) -> Result<(), BufIoError> {
62 let mut file = self.file.write().map_err(|_| BufIoError::Locking)?;
63 file.seek(SeekFrom::Start(self.start))
64 .map_err(BufIoError::Io)?;
65 let buffer = self.buffer.read().map_err(|_| BufIoError::Locking)?;
66 let end = self.end.load(Ordering::SeqCst);
67 file.write_all(&buffer[..end]).map_err(BufIoError::Io)?;
68 self.dirty.store(false, Ordering::SeqCst);
69 Ok(())
70 }
71}
72
73impl Drop for BufferRegion {

Callers 5

dropMethod · 0.45
flush_allMethod · 0.45
newMethod · 0.45
flush_versionedMethod · 0.45
test_write_large_fileFunction · 0.45

Calls 6

loadMethod · 0.80
valuesMethod · 0.80
should_final_flushMethod · 0.80
should_flushMethod · 0.80
readMethod · 0.45
iterMethod · 0.45

Tested by 1

test_write_large_fileFunction · 0.36