From 8a8a1850d035a4dc6286815cf8abf231f2cfb8fd Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 25 Nov 2021 09:45:47 +0100 Subject: [PATCH] remove trait BufferedRead from pbs-tools/src/io.rs We do not need it. Signed-off-by: Dietmar Maurer --- pbs-datastore/src/dynamic_index.rs | 3 --- pbs-tools/src/io.rs | 10 ---------- 2 files changed, 13 deletions(-) diff --git a/pbs-datastore/src/dynamic_index.rs b/pbs-datastore/src/dynamic_index.rs index 9aa1474c..d328a597 100644 --- a/pbs-datastore/src/dynamic_index.rs +++ b/pbs-datastore/src/dynamic_index.rs @@ -599,9 +599,7 @@ impl BufferedDynamicReader { //println!("BUFFER {} {}", self.buffered_chunk_start, end); Ok(()) } -} -impl pbs_tools::io::BufferedRead for BufferedDynamicReader { fn buffered_read(&mut self, offset: u64) -> Result<&[u8], Error> { if offset == self.archive_size { return Ok(&self.read_buffer[0..0]); @@ -641,7 +639,6 @@ impl pbs_tools::io::BufferedRead for BufferedDynamicReader { impl std::io::Read for BufferedDynamicReader { fn read(&mut self, buf: &mut [u8]) -> Result { - use pbs_tools::io::BufferedRead; use std::io::{Error, ErrorKind}; let data = match self.buffered_read(self.read_offset) { diff --git a/pbs-tools/src/io.rs b/pbs-tools/src/io.rs index dfc0ea18..6ddaa539 100644 --- a/pbs-tools/src/io.rs +++ b/pbs-tools/src/io.rs @@ -2,16 +2,6 @@ use proxmox_sys::fd::Fd; -/// The `BufferedRead` trait provides a single function -/// `buffered_read`. It returns a reference to an internal buffer. The -/// purpose of this traid is to avoid unnecessary data copies. -pub trait BufferedRead { - /// This functions tries to fill the internal buffers, then - /// returns a reference to the available data. It returns an empty - /// buffer if `offset` points to the end of the file. - fn buffered_read(&mut self, offset: u64) -> Result<&[u8], anyhow::Error>; -} - /// safe wrapper for `nix::unistd::pipe2` defaulting to `O_CLOEXEC` and guarding the file /// descriptors. pub fn pipe() -> Result<(Fd, Fd), nix::Error> {