linuxcontainer

package
v1.8.5 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEnvBuilder

func NewEnvBuilder(c Config) pool.EnvBuilder

NewEnvBuilder creates builder for linux container pools

Types

type Cgroup

type Cgroup interface {
	SetCpuset(string) error
	SetMemoryLimit(envexec.Size) error
	SetProcLimit(uint64) error
	SetCPURate(uint64) error // 1000 as 1

	CPUUsage() (time.Duration, error)
	CurrentMemory() (envexec.Size, error)
	MaxMemory() (envexec.Size, error)

	AddProc(int) error
	Reset() error
	Destroy() error
}

Cgroup defines interface to limit and monitor resources consumption of a process

type CgroupBuilder

type CgroupBuilder interface {
	Random(string) (cg cgroup.Cgroup, err error)
}

CgroupBuilder builds cgroup for runner

type CgroupListPool

type CgroupListPool struct {
	// contains filtered or unexported fields
}

CgroupListPool implements cgroup pool

func (*CgroupListPool) Get

func (w *CgroupListPool) Get() (Cgroup, error)

Get gets cgroup from pool, if pool is empty, creates new one

func (*CgroupListPool) Put

func (w *CgroupListPool) Put(c Cgroup)

Put puts cgroup into the pool

func (*CgroupListPool) Shutdown

func (w *CgroupListPool) Shutdown()

Shutdown destroy all cgroup

type CgroupPool

type CgroupPool interface {
	Get() (Cgroup, error)
	Put(Cgroup)
}

CgroupPool implements pool of Cgroup

func NewCgroupListPool

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

type Config struct {
	Builder    EnvironmentBuilder
	CgroupPool CgroupPool
	WorkDir    string
	Seccomp    []syscall.SockFilter
	Cpuset     string
	CPURate    bool
}

Config specifies configuration to build environment builder

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

func (*FakeCgroupPool) Get

func (f *FakeCgroupPool) Get() (Cgroup, error)

Get gets new cgroup

func (*FakeCgroupPool) Put

func (f *FakeCgroupPool) Put(c Cgroup)

Put destroy the cgroup

func (*FakeCgroupPool) Shutdown

func (f *FakeCgroupPool) Shutdown()

Shutdown noop

Jump to

Keyboard shortcuts

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