Documentation ¶
Overview ¶
Package pool provides reference implements of environent pool and cgroup pool
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPool ¶ added in v0.3.0
func NewPool(builder EnvBuilder) envexec.EnvironmentPool
NewPool returns a pool for EnvBuilder
Types ¶
type Cgroup ¶ added in v0.3.0
type Cgroup interface { SetCpuset(string) error SetMemoryLimit(envexec.Size) error SetProcLimit(uint64) error SetCPURate(float64) error CPUUsage() (time.Duration, error) MemoryUsage() (envexec.Size, error) AddProc(int) error Reset() error Destroy() error }
Cgroup defines interface to limit and monitor resources consumption of a process
type CgroupBuilder ¶
CgroupBuilder builds cgroup for runner
type CgroupListPool ¶ added in v0.3.0
type CgroupListPool struct {
// contains filtered or unexported fields
}
CgroupListPool implements cgroup pool
func (*CgroupListPool) Get ¶ added in v0.3.0
func (w *CgroupListPool) Get() (Cgroup, error)
Get gets cgroup from pool, if pool is empty, creates new one
func (*CgroupListPool) Put ¶ added in v0.3.0
func (w *CgroupListPool) Put(c Cgroup)
Put puts cgroup into the pool
func (*CgroupListPool) Shutdown ¶ added in v0.3.0
func (w *CgroupListPool) Shutdown()
Shutdown destroy all cgroup
type CgroupPool ¶
CgroupPool implements pool of Cgroup
func NewCgroupListPool ¶ added in v0.3.0
func NewCgroupListPool(builder CgroupBuilder, cfsPeriod time.Duration) CgroupPool
NewCgroupListPool creates new cgroup pool
func NewFakeCgroupPool ¶
func NewFakeCgroupPool(builder CgroupBuilder, cfsPeriod time.Duration) CgroupPool
NewFakeCgroupPool creates FakeCgroupPool
type Config ¶ added in v0.9.2
type Config struct { Builder EnvironmentBuilder CgroupPool CgroupPool WorkDir string Seccomp []syscall.SockFilter Cpuset string CPURate bool }
Config specifies configuration to build environment builder
type EnvBuilder ¶ added in v0.3.0
type EnvBuilder interface {
Build() (Environment, error)
}
EnvBuilder defines the abstract builder for container environment
func NewEnvBuilder ¶ added in v0.3.0
func NewEnvBuilder(c Config) EnvBuilder
NewEnvBuilder creates builder for linux container pools
type Environment ¶
type Environment interface { envexec.Environment Reset() error Destroy() error }
Environment defines envexec.Environment with destroy
type EnvironmentBuilder ¶
type EnvironmentBuilder interface {
Build() (container.Environment, error)
}
EnvironmentBuilder defines the abstract builder for container environment
type FakeCgroupPool ¶
type FakeCgroupPool struct {
// contains filtered or unexported fields
}
FakeCgroupPool implements cgroup pool but not actually do pool