usage mesasge

serial
Avril 4 years ago
parent 0a4d055fff
commit 0ecee59258
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -8,16 +8,35 @@ mod work;
mod consts;
fn usage() -> !
{
eprintln!("uasge: {} <output file> <input files...>", std::env::args().next().unwrap());
eprintln!();
eprintln!("mapcat v{}: mmap() based file concatenation", env!("CARGO_PKG_VERSION"));
eprintln!(" by {} with <3 (licensed GPL3+)", env!("CARGO_PKG_AUTHORS"));
eprintln!();
eprintln!("NOTES:");
eprintln!("The output file is required, if one is not provided, we will just exit with error code `2`. If there are no input files, it will just create an empty output and return with error code `0` (unless there were other errors)");
eprintln!("Output files are always clobbered regardless if there are any inputs, or if the concatenation operation succeeds / fails");
eprintln!();
eprintln!(" (compiled with write parallelisation enabled)"); //TODO: we will eventually feature gate the threaded scheduler based solution. but for now, it is the only one implemented so we'll just print this always
std::process::exit(0)
}
fn main() {
println!("Hello, world!");
usage()
// todo:
// - create and open output file
// - open and stat all input files (`job::create_from_file`).
// - open and stat all input files in order (`job::create_from_file`).
// - `fallocate` the output file fd to the sum of all input file sizes
// - `mmap` the output file as writable
//
// - spawn the task thread pool
// - dispatch jobs with their fds, stats, and calculated output offsets along with a reference to the output mapped file (`job::Prelude::start`)
// - move the output mapped file to the thread-safe refcounted `state::State`.
// - dispatch jobs to the pool with their fds, stats, and calculated output offsets; along with a reference to the output mapped file (`job::Prelude::start`)
// - wait on all worker threads to complete.
// - ensure all data was written.
}

Loading…
Cancel
Save