2013-12-21 11:02:06 -05:00
|
|
|
package cgroups
|
|
|
|
|
|
|
|
import (
|
2014-04-13 20:02:01 -04:00
|
|
|
"errors"
|
2013-12-21 11:02:06 -05:00
|
|
|
)
|
|
|
|
|
2014-04-13 20:02:01 -04:00
|
|
|
var (
|
|
|
|
ErrNotFound = errors.New("mountpoint not found")
|
|
|
|
)
|
|
|
|
|
2014-02-20 18:48:48 -05:00
|
|
|
type Cgroup struct {
|
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
Parent string `json:"parent,omitempty"`
|
|
|
|
|
2014-04-24 01:11:43 -04:00
|
|
|
DeviceAccess bool `json:"device_access,omitempty"` // name of parent cgroup or slice
|
|
|
|
Memory int64 `json:"memory,omitempty"` // Memory limit (in bytes)
|
|
|
|
MemoryReservation int64 `json:"memory_reservation,omitempty"` // Memory reservation or soft_limit (in bytes)
|
|
|
|
MemorySwap int64 `json:"memory_swap,omitempty"` // Total memory usage (memory + swap); set `-1' to disable swap
|
|
|
|
CpuShares int64 `json:"cpu_shares,omitempty"` // CPU shares (relative weight vs. other containers)
|
|
|
|
CpuQuota int64 `json:"cpu_quota,omitempty"` // CPU hardcap limit (in usecs). Allowed cpu time in a given period.
|
|
|
|
CpuPeriod int64 `json:"cpu_period,omitempty"` // CPU period to be used for hardcapping (in usecs). 0 to use system default.
|
|
|
|
CpusetCpus string `json:"cpuset_cpus,omitempty"` // CPU to use
|
2014-04-30 19:07:12 -04:00
|
|
|
Freezer string `json:"freezer,omitempty"` // set the freeze value for the process
|
2014-02-21 08:35:43 -05:00
|
|
|
|
|
|
|
UnitProperties [][2]string `json:"unit_properties,omitempty"` // systemd unit properties
|
2014-02-20 18:48:48 -05:00
|
|
|
}
|
|
|
|
|
2014-03-14 05:47:49 -04:00
|
|
|
type ActiveCgroup interface {
|
|
|
|
Cleanup() error
|
2014-02-20 18:48:48 -05:00
|
|
|
}
|