cgroups

package
v0.4.31 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCgroupAlreadyExists = errors.New("nested cgroup already exists")
	ErrCgroupNotExists     = errors.New("nested cgroup does not exist")
)

Functions

func NewCgroupManager

func NewCgroupManager(name string, res *specs.LinuxResources) (CGroup, CGroupManager, error)

Types

type CGroup

type CGroup interface {
	// New creates a new cgroup under the calling cgroup.
	New(name string, resources *specs.LinuxResources) (CGroup, error)
	// Add adds a process to the cgroup
	Add(Process) error
	// Delete removes the cgroup as a whole.
	Delete() error
	// Stats returns resource description
	Stats() (*Stats, error)

	Suffix() string
}

type CGroupManager

type CGroupManager interface {
	// Parent returns a parent cgroup.
	Parent() CGroup
	// Attach attaches a new nested cgroup under the parent cgroup, returning
	// that new cgroup handle.
	// Also returns cgroup handle if it is already exists.
	Attach(name string, resources *specs.LinuxResources) (CGroup, error)
	// Detach detaches and deletes a nested cgroup.
	Detach(name string) error
}

type Process added in v0.4.11

type Process struct {
	Subsystem string
	Pid       int
	Path      string
}

type Resources

type Resources specs.LinuxResources

CGroups is a type alias for OCI CGroups spec

func (*Resources) SetYAML

func (r *Resources) SetYAML(tag string, value interface{}) bool

SetYAML implements goyaml.Setter

type Stats

type Stats struct {
	MemoryLimit uint64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL