mirror of
https://github.com/neondatabase/neon.git
synced 2026-10-23 12:12:57 +00:00
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:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user