remove impl Write for VirtualFile to discover where it's needed

Insights: it's needed

- for save_metadata and persistent_tenant_conf: these always "replace"
  the file to be overwritten with contents provided in an in-memory
  buffer. We can have a dedicated VirtualFile API for that purpose.

- the Delta / Image layer writers need `Summary::ser_into(&summary, &mut file)?`
  and `write_all` . Probably feasible.
This commit is contained in:
Christian Schwarz
2023-08-31 09:05:55 +00:00
parent 5ac63005c5
commit 7f9897e8e2
-15
View File
@@ -430,21 +430,6 @@ impl Drop for VirtualFile {
}
}
impl Write for VirtualFile {
fn write(&mut self, buf: &[u8]) -> Result<usize, std::io::Error> {
let pos = self.pos;
let n = self.write_at(buf, pos)?;
self.pos += n as u64;
Ok(n)
}
fn flush(&mut self) -> Result<(), std::io::Error> {
// flush is no-op for File (at least on unix), so we don't need to do
// anything here either.
Ok(())
}
}
impl OpenFiles {
fn new(num_slots: usize) -> OpenFiles {
let mut slots = Box::new(Vec::with_capacity(num_slots));