[pbs-devel] [RFC pxar 3/20] fix #3174: decoder: impl skip_bytes for sync dec

Christian Ebner c.ebner at proxmox.com
Fri Sep 22 09:16:04 CEST 2023


Allows to skip over a given number of bytes during pxar archive
decoding. This is used to skip over unneeded contents in a pxar
appendix.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
 src/decoder/sync.rs | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/decoder/sync.rs b/src/decoder/sync.rs
index 5597a03..a3820c8 100644
--- a/src/decoder/sync.rs
+++ b/src/decoder/sync.rs
@@ -81,6 +81,12 @@ impl<T: SeqRead> Decoder<T> {
     pub fn enable_goodbye_entries(&mut self, on: bool) {
         self.inner.with_goodbye_tables = on;
     }
+
+    /// Skip bytes in decoder stream.
+    pub fn skip_bytes(&mut self, len: u64) -> io::Result<()> {
+        let len = usize::try_from(len).unwrap();
+        poll_result_once(self.inner.skip_bytes(len))
+    }
 }
 
 impl<T: SeqRead> Iterator for Decoder<T> {
-- 
2.39.2






More information about the pbs-devel mailing list