Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateChildCgroup ¶
func CreateChildCgroup(cgParent string, cgName string, res *specs.LinuxResources) (cgroups.Cgroup, error)
Create a new CGroup with desired resource settings
func UpdateVmCgroup ¶
func UpdateVmCgroup(cgPath string, res *specs.LinuxResources) error
Update a CGroup with desired resource settings
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller represents a named controller for a process
func (*Controller) CgroupExists ¶
func (c *Controller) CgroupExists(ctl string, cgPath string) bool
Check if a particular cgroup exists for a given controller
func (*Controller) Set ¶
func (c *Controller) Set(name string, value interface{}) error
Set sets the value of a controller setting
type Manager ¶
type Manager interface {
// GetProcessControllers returns the mapping between controller types and
// their paths inside cgroup fs for the specified PID.
GetProcessControllers() (map[string]string, error)
// GetProcessController returns a named resource Controller for the specified PID.
GetProcessController(controllerName string) (*Controller, error)
// MoveProcess move the process to the path under a cgroup controller
MoveProcess(controller, path string) error
}
Manager provides an interface to operate on linux cgroups
func NewManager ¶
func NewManager(pid interface{}, fsys fs.FileSystem) Manager
NewManager returns an instance of RealManager
type RealManager ¶
type RealManager struct {
// contains filtered or unexported fields
}
RealManager provides an implementation of Manager which is using default linux system paths to access info about cgroups for processes.
func (*RealManager) GetProcessController ¶
func (c *RealManager) GetProcessController(controllerName string) (*Controller, error)
GetProcessController is an implementation of GetProcessController method of Manager interface.
func (*RealManager) GetProcessControllers ¶
func (c *RealManager) GetProcessControllers() (map[string]string, error)
GetProcessControllers is an implementation of GetProcessControllers method of Manager interface.
func (*RealManager) MoveProcess ¶
func (c *RealManager) MoveProcess(controller, path string) error
MoveProcess implements MoveProcess method of Manager