Documentation ¶
Index ¶
- func Attach(pid string, path string) error
- type ControlProcSl
- type Controller
- func (c *Controller) AddCtlAppPath(path string)
- func (c *Controller) AddCtrlProc(proc *netlink.ProcMessage) error
- func (c *Controller) CheckCtlPathSl(path string) bool
- func (c *Controller) CheckCtlProcExist(proc *netlink.ProcMessage) bool
- func (c *Controller) CheckCtrlPid(ppid string) *netlink.ProcMessage
- func (c *Controller) ClearCtlAppPath()
- func (c *Controller) DelCtlAppPath(path string)
- func (c *Controller) DelCtlProc(proc *netlink.ProcMessage) error
- func (c *Controller) GetCGroupPath() string
- func (c *Controller) GetControlPath() string
- func (c *Controller) GetName() string
- func (c *Controller) MoveIn(path string, inCtSl ControlProcSl) error
- func (c *Controller) MoveOut(path string) ControlProcSl
- func (c *Controller) MoveToController(controller *Controller) error
- func (c *Controller) ReleaseAll() error
- func (c *Controller) ReleaseToManager(path string) error
- func (c *Controller) UpdateFromManager(path string) error
- func (c *Controller) UpdateFromManagerAll() error
- type Manager
- func (m *Manager) CheckControllerExist(name define.Scope, priority define.Priority) bool
- func (m *Manager) CreatePriorityController(name define.Scope, uid int, gid int, priority define.Priority) (*Controller, error)
- func (m *Manager) GetControllerByCtlPath(path string) *Controller
- func (m *Manager) GetControllerByCtrlByPPid(ppid string) *Controller
- func (m *Manager) GetControllerCount() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ControlProcSl ¶
type ControlProcSl []*netlink.ProcMessage
func (*ControlProcSl) Attach ¶
func (ctSl *ControlProcSl) Attach(path string) error
Attach pid to new cgroups
func (*ControlProcSl) CheckCtlProcExist ¶
func (ctSl *ControlProcSl) CheckCtlProcExist(proc *netlink.ProcMessage) bool
check if proc already exist
func (*ControlProcSl) CheckCtrlPidExist ¶
func (ctSl *ControlProcSl) CheckCtrlPidExist(ppid string) *netlink.ProcMessage
check if new proc`s parent proc exist
func (*ControlProcSl) Release ¶
func (ctSl *ControlProcSl) Release() error
Attach pid back to origin cgroup
type Controller ¶
type Controller struct { // controller name Name define.Scope // main app global // Fuzzy Priority Priority define.Priority // control app exe path CtlPathSl []string // current control app message CtlProcMap map[string]ControlProcSl // contains filtered or unexported fields }
source controller
func (*Controller) AddCtlAppPath ¶
func (c *Controller) AddCtlAppPath(path string)
add control app path
func (*Controller) AddCtrlProc ¶
func (c *Controller) AddCtrlProc(proc *netlink.ProcMessage) error
add current control proc
func (*Controller) CheckCtlPathSl ¶
func (c *Controller) CheckCtlPathSl(path string) bool
check control app path exist
func (*Controller) CheckCtlProcExist ¶
func (c *Controller) CheckCtlProcExist(proc *netlink.ProcMessage) bool
check if current control proc exist
func (*Controller) CheckCtrlPid ¶
func (c *Controller) CheckCtrlPid(ppid string) *netlink.ProcMessage
check if new proc`s parent proc exist
func (*Controller) DelCtlProc ¶
func (c *Controller) DelCtlProc(proc *netlink.ProcMessage) error
delete current control proc
func (*Controller) GetCGroupPath ¶
func (c *Controller) GetCGroupPath() string
/sys/fs/cgroup/unified/App.slice
func (*Controller) GetControlPath ¶
func (c *Controller) GetControlPath() string
/sys/fs/cgroup/unified/App.slice/cgroup.procs
func (*Controller) MoveIn ¶
func (c *Controller) MoveIn(path string, inCtSl ControlProcSl) error
move in control procs
func (*Controller) MoveOut ¶
func (c *Controller) MoveOut(path string) ControlProcSl
move out control procs
func (*Controller) MoveToController ¶
func (c *Controller) MoveToController(controller *Controller) error
move to control procs
func (*Controller) ReleaseAll ¶
func (c *Controller) ReleaseAll() error
release all proc from controller, that may happen when stop controller
func (*Controller) ReleaseToManager ¶
func (c *Controller) ReleaseToManager(path string) error
move now proc to lower controller or to default cgroups
func (*Controller) UpdateFromManager ¶
func (c *Controller) UpdateFromManager(path string) error
move lower priority proc in
func (*Controller) UpdateFromManagerAll ¶
func (c *Controller) UpdateFromManagerAll() error
move lower priority proc in
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) CheckControllerExist ¶
check if name controller already exist
func (*Manager) CreatePriorityController ¶
func (m *Manager) CreatePriorityController(name define.Scope, uid int, gid int, priority define.Priority) (*Controller, error)
create controller handler
func (*Manager) GetControllerByCtlPath ¶
func (m *Manager) GetControllerByCtlPath(path string) *Controller
get controller by control app path
func (*Manager) GetControllerByCtrlByPPid ¶
func (m *Manager) GetControllerByCtrlByPPid(ppid string) *Controller
get controller by control pid
func (*Manager) GetControllerCount ¶
get controller count