pub struct CgroupController { /* private fields */ }Expand description
CgroupController is the main component in cgumi, and it should always be created first.
All CgroupNode should be created by CgroupController.
Implementations§
Source§impl CgroupController
impl CgroupController
Sourcepub fn new(
root: &str,
request_func: Option<Box<dyn Fn(&PrivilegeOpType, &str) -> Result<(), Error>>>,
) -> Self
pub fn new( root: &str, request_func: Option<Box<dyn Fn(&PrivilegeOpType, &str) -> Result<(), Error>>>, ) -> Self
root is the cgroupv2 mountpoint, and request_func is an optional
function that prompts users to run commands in root permission.
pub fn root(&self) -> &PathBuf
Sourcepub fn create_from_path(
&self,
name: &PathBuf,
allow_exists: bool,
) -> Result<CgroupNode<'_>, CgroupError>
pub fn create_from_path( &self, name: &PathBuf, allow_exists: bool, ) -> Result<CgroupNode<'_>, CgroupError>
Create a CgroupNode from a relative path (name).
Sourcepub fn get_from_current(&self) -> Result<CgroupNode<'_>, CgroupError>
pub fn get_from_current(&self) -> Result<CgroupNode<'_>, CgroupError>
Get the CgroupNode from what current program is in.
Sourcepub fn create_from_node_path(
&self,
node: &CgroupNode<'_>,
name: &PathBuf,
allow_exists: bool,
) -> Result<CgroupNode<'_>, CgroupError>
pub fn create_from_node_path( &self, node: &CgroupNode<'_>, name: &PathBuf, allow_exists: bool, ) -> Result<CgroupNode<'_>, CgroupError>
Create a CgroupNode from a node and a name relative to the node.
Sourcepub fn get_root_node(&self) -> Result<CgroupNode<'_>, CgroupError>
pub fn get_root_node(&self) -> Result<CgroupNode<'_>, CgroupError>
Get the root as a CgroupNode.
Sourcepub fn create_systemd_cgroup(
&self,
name: &str,
) -> Result<CgroupNode<'_>, CgroupError>
pub fn create_systemd_cgroup( &self, name: &str, ) -> Result<CgroupNode<'_>, CgroupError>
Create a systemd scope, and therefore get a cgroup node from that.
Trait Implementations§
Source§impl Debug for CgroupController
impl Debug for CgroupController
Auto Trait Implementations§
impl Freeze for CgroupController
impl !RefUnwindSafe for CgroupController
impl !Send for CgroupController
impl !Sync for CgroupController
impl Unpin for CgroupController
impl !UnwindSafe for CgroupController
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more