diff --git a/Cargo.toml b/Cargo.toml index 660e713b..0996a3b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,7 @@ md5 = "0.6" base64 = "0.10" pam-sys = "0.5" pam = "0.7" -lz4 = "1.23" +zstd = "0.4" xdg = "2.2" [patch.crates-io] diff --git a/debian/control b/debian/control index c7e770b7..48275573 100644 --- a/debian/control +++ b/debian/control @@ -6,7 +6,7 @@ Build-Depends: bash-completion, debhelper (>= 10), python3-docutils, python3-sphinx, - liblz4-dev, + libzstd-dev, libpam0g-dev, pkg-config, Standards-Version: 3.9.5 @@ -18,6 +18,6 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, libjs-extjs (>= 6.0.1), fonts-font-awesome, proxmox-widget-toolkit, - liblz4-1, + libzstd1, Description: Proxmox Backup Server This is experimental code used to test Rust. diff --git a/src/backup/chunk_store.rs b/src/backup/chunk_store.rs index 582f514f..12826216 100644 --- a/src/backup/chunk_store.rs +++ b/src/backup/chunk_store.rs @@ -183,7 +183,7 @@ impl ChunkStore { buffer.clear(); let f = std::fs::File::open(&chunk_path)?; - let mut decoder = lz4::Decoder::new(f)?; + let mut decoder = zstd::stream::Decoder::new(f)?; decoder.read_to_end(buffer)?; @@ -333,12 +333,10 @@ impl ChunkStore { let f = std::fs::File::create(&tmp_path)?; - // fixme: what is the fasted lz4 encoder available (see lzbench)? - let mut encoder = lz4::EncoderBuilder::new().level(1).build(f)?; + let mut encoder = zstd::stream::Encoder::new(f, 1)?; encoder.write_all(chunk)?; - let (f, encode_result) = encoder.finish(); - encode_result?; + let f = encoder.finish()?; if let Err(err) = std::fs::rename(&tmp_path, &chunk_path) { if let Err(_) = std::fs::remove_file(&tmp_path) { /* ignore */ }