Commit b3c87048 authored by Adam Reichold's avatar Adam Reichold
Browse files

Enable support for parallel Zstd compression.

parent 7b53fb3f
Pipeline #42378 passed with stage
in 1 minute and 40 seconds
......@@ -9,4 +9,4 @@ clap = "2.33"
crossbeam-channel = "0.5"
glob = "0.3"
tar = "0.4"
zstd = { version = "0.9", default-features = false, features = ["thin"] }
zstd = { version = "0.9", default-features = false, features = ["zstdmt", "thin"] }
......@@ -20,17 +20,24 @@ fn main() -> Fallible {
.long("jobs")
.default_value("1"),
)
.arg(
Arg::with_name("WORKERS")
.short("w")
.long("workers")
.default_value("1"),
)
.arg(
Arg::with_name("LEVEL")
.short("l")
.long("level")
.default_value("0")
.short("l")
.long("level")
.default_value("0"),
)
.get_matches();
let output = matches.value_of("OUTPUT").unwrap();
let inputs = matches.values_of("INPUTS").unwrap();
let jobs = matches.value_of("JOBS").unwrap().parse::<usize>()?;
let workers = matches.value_of("WORKERS").unwrap().parse::<u32>()?;
let level = matches.value_of("LEVEL").unwrap().parse::<i32>()?;
let (inputs_sender, inputs_receiver) = unbounded();
......@@ -68,7 +75,9 @@ fn main() -> Fallible {
})
}));
let mut builder = Builder::new(Encoder::new(File::create(output)?, level)?);
let mut encoder = Encoder::new(File::create(output)?, level)?;
encoder.multithread(workers)?;
let mut builder = Builder::new(encoder);
for (path, buffer) in buffers_receiver {
eprintln!("{}", path.display());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment