src/backup/chunk_store.rs: use zstd compression insteadf of lz4
Provides better compressionm rate, and is still fast.
This commit is contained in:
parent
d2690f74bb
commit
141f062e08
|
@ -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]
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 */ }
|
||||
|
|
Loading…
Reference in New Issue