* in case of single-digit octet). The goal is a kind of
* load-balancing the data into files, but making sure the same
* IP addresses are together in the same file.
*
* As it is a small utility for rare manual run, most errors
* simply panic through unwrap() or expect(). We would terminate
* the program anyway.
*/
externcratecsv;
externcrateregex;
externcratescoped_pool;
usestd::process::*;
usestd::thread;
usestd::sync::*;
usestd::collections::HashMap;
usestd::collections::{HashMap,HashSet};
usestd::io::Write;
useregex::Regex;
...
...
@@ -33,11 +37,15 @@ struct SplitOutput {
}
implSplitOutput{
/**
* Create a new SplitOutput. It openes the compressor and stores its output. The name is the
* prefix of the file.
*/
fnnew(name:&str)->SplitOutput{
SplitOutput{compressor:Command::new("/bin/sh").arg("-c").arg(format!("gzip >{}.csv.gz",name)).stdin(Stdio::piped()).spawn().expect("Failed to start gzip")}