[pbs-devel] [PATCH bullseye proxmox-backup 1/2] update to zstd 0.6
Fabian Grünbichler
f.gruenbichler at proxmox.com
Wed Jun 2 12:14:37 CEST 2021
compatible with libzstd from bullseye.
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
d/control is autogenerated, so if conflicts arise there just ignore that
hunk..
Cargo.toml | 2 +-
debian/control | 4 ++--
src/backup/data_blob_reader.rs | 16 ++++++++--------
src/backup/data_blob_writer.rs | 14 +++++++-------
src/client/backup_reader.rs | 2 +-
5 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index 93681698..976f18bc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -78,7 +78,7 @@ url = "2.1"
walkdir = "2"
webauthn-rs = "0.2.5"
xdg = "2.2"
-zstd = { version = "0.4", features = [ "bindgen" ] }
+zstd = { version = "0.6", features = [ "bindgen" ] }
nom = "5.1"
crossbeam-channel = "0.5"
diff --git a/debian/control b/debian/control
index 5bf595b4..baa2d13f 100644
--- a/debian/control
+++ b/debian/control
@@ -81,8 +81,8 @@ Build-Depends: debhelper (>= 11),
librust-walkdir-2+default-dev,
librust-webauthn-rs-0.2+default-dev (>= 0.2.5-~~),
librust-xdg-2+default-dev (>= 2.2-~~),
- librust-zstd-0.4+bindgen-dev,
- librust-zstd-0.4+default-dev,
+ librust-zstd-0.6+bindgen-dev,
+ librust-zstd-0.6+default-dev,
libacl1-dev,
libfuse3-dev,
libsystemd-dev,
diff --git a/src/backup/data_blob_reader.rs b/src/backup/data_blob_reader.rs
index fe3a35c4..11a4613e 100644
--- a/src/backup/data_blob_reader.rs
+++ b/src/backup/data_blob_reader.rs
@@ -5,23 +5,23 @@ use proxmox::tools::io::ReadExt;
use super::*;
-enum BlobReaderState<R: Read> {
+enum BlobReaderState<'reader, R: Read> {
Uncompressed { expected_crc: u32, csum_reader: ChecksumReader<R> },
- Compressed { expected_crc: u32, decompr: zstd::stream::read::Decoder<BufReader<ChecksumReader<R>>> },
+ Compressed { expected_crc: u32, decompr: zstd::stream::read::Decoder<'reader, BufReader<ChecksumReader<R>>> },
Encrypted { expected_crc: u32, decrypt_reader: CryptReader<BufReader<ChecksumReader<R>>> },
- EncryptedCompressed { expected_crc: u32, decompr: zstd::stream::read::Decoder<BufReader<CryptReader<BufReader<ChecksumReader<R>>>>> },
+ EncryptedCompressed { expected_crc: u32, decompr: zstd::stream::read::Decoder<'reader, BufReader<CryptReader<BufReader<ChecksumReader<R>>>>> },
}
/// Read data blobs
-pub struct DataBlobReader<R: Read> {
- state: BlobReaderState<R>,
+pub struct DataBlobReader<'reader, R: Read> {
+ state: BlobReaderState<'reader, R>,
}
// zstd_safe::DCtx is not sync but we are, since
// the only public interface is on mutable reference
-unsafe impl<R: Read> Sync for DataBlobReader<R> {}
+unsafe impl<R: Read> Sync for DataBlobReader<'_, R> {}
-impl <R: Read> DataBlobReader<R> {
+impl <R: Read> DataBlobReader<'_, R> {
pub fn new(mut reader: R, config: Option<Arc<CryptConfig>>) -> Result<Self, Error> {
@@ -104,7 +104,7 @@ impl <R: Read> DataBlobReader<R> {
}
}
-impl <R: Read> Read for DataBlobReader<R> {
+impl <R: Read> Read for DataBlobReader<'_, R> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize, std::io::Error> {
match &mut self.state {
diff --git a/src/backup/data_blob_writer.rs b/src/backup/data_blob_writer.rs
index 10b2813a..82bd14c6 100644
--- a/src/backup/data_blob_writer.rs
+++ b/src/backup/data_blob_writer.rs
@@ -5,19 +5,19 @@ use proxmox::tools::io::WriteExt;
use super::*;
-enum BlobWriterState<W: Write> {
+enum BlobWriterState<'writer, W: Write> {
Uncompressed { csum_writer: ChecksumWriter<W> },
- Compressed { compr: zstd::stream::write::Encoder<ChecksumWriter<W>> },
+ Compressed { compr: zstd::stream::write::Encoder<'writer, ChecksumWriter<W>> },
Encrypted { crypt_writer: CryptWriter<ChecksumWriter<W>> },
- EncryptedCompressed { compr: zstd::stream::write::Encoder<CryptWriter<ChecksumWriter<W>>> },
+ EncryptedCompressed { compr: zstd::stream::write::Encoder<'writer, CryptWriter<ChecksumWriter<W>>> },
}
/// Data blob writer
-pub struct DataBlobWriter<W: Write> {
- state: BlobWriterState<W>,
+pub struct DataBlobWriter<'writer, W: Write> {
+ state: BlobWriterState<'writer, W>,
}
-impl <W: Write + Seek> DataBlobWriter<W> {
+impl <W: Write + Seek> DataBlobWriter<'_, W> {
pub fn new_uncompressed(mut writer: W) -> Result<Self, Error> {
writer.seek(SeekFrom::Start(0))?;
@@ -133,7 +133,7 @@ impl <W: Write + Seek> DataBlobWriter<W> {
}
}
-impl <W: Write + Seek> Write for DataBlobWriter<W> {
+impl <W: Write + Seek> Write for DataBlobWriter<'_, W> {
fn write(&mut self, buf: &[u8]) -> Result<usize, std::io::Error> {
match self.state {
diff --git a/src/client/backup_reader.rs b/src/client/backup_reader.rs
index 92200f9e..7f24cb9b 100644
--- a/src/client/backup_reader.rs
+++ b/src/client/backup_reader.rs
@@ -148,7 +148,7 @@ impl BackupReader {
&self,
manifest: &BackupManifest,
name: &str,
- ) -> Result<DataBlobReader<File>, Error> {
+ ) -> Result<DataBlobReader<'_, File>, Error> {
let mut tmpfile = std::fs::OpenOptions::new()
.write(true)
--
2.30.2
More information about the pbs-devel
mailing list