MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / write_to

Method write_to

nodedb/src/storage/segment.rs:99–104  ·  view source on GitHub ↗

Write the footer to a file.

(&self, path: &Path)

Source from the content-addressed store, hash-verified

97
98 /// Write the footer to a file.
99 pub fn write_to(&self, path: &Path) -> crate::Result<()> {
100 let mut file = std::fs::OpenOptions::new().append(true).open(path)?;
101 file.write_all(&self.to_bytes())?;
102 file.flush()?;
103 Ok(())
104 }
105
106 /// Read the footer from the end of a file.
107 pub fn read_from(path: &Path) -> crate::Result<Self> {

Callers 1

write_and_read_fileFunction · 0.80

Calls 4

openMethod · 0.45
appendMethod · 0.45
to_bytesMethod · 0.45
flushMethod · 0.45

Tested by 1

write_and_read_fileFunction · 0.64