update to zstd 0.6
compatible with libzstd from bullseye. Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
2165f0d450
commit
90ff75f85c
@ -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"
|
||||
|
||||
|
4
debian/control
vendored
4
debian/control
vendored
@ -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,
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user