I've started working on an API that looks like this:
let cgroup: Cgroup = CgroupBuilder::new("hello", V1)
.memory()
.kernel_memory_limit(1024 * 1024)
.memory_hard_limit(1024 * 1024)
.done()
.cpu()
.shares(100)
.done()
.build();
Thoughts?
In particular, I'd prefer to leave out an API that adds a pid to the control group. That's racy and it might introduce subtle race conditions into applications depending on this crate. Instead, the API will likely include an include_command() build that starts the Command in the control group. This would be done via a trait ideally, so people can extend it.
I've started working on an API that looks like this:
Thoughts?
In particular, I'd prefer to leave out an API that adds a
pidto the control group. That's racy and it might introduce subtle race conditions into applications depending on this crate. Instead, the API will likely include aninclude_command()build that starts theCommandin the control group. This would be done via a trait ideally, so people can extend it.