From 7f9897e8e26be330f9d42c665613d4514140e4cf Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Thu, 31 Aug 2023 09:01:56 +0000 Subject: [PATCH] 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. --- pageserver/src/virtual_file.rs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/pageserver/src/virtual_file.rs b/pageserver/src/virtual_file.rs index 8e4f103158..59ad73071b 100644 --- a/pageserver/src/virtual_file.rs +++ b/pageserver/src/virtual_file.rs @@ -430,21 +430,6 @@ impl Drop for VirtualFile { } } -impl Write for VirtualFile { - fn write(&mut self, buf: &[u8]) -> Result { - 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));