pg

package
v3.0.0-rc20 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext

func NewContext(ctx context.Context) context.Context

func UnifiedPath

func UnifiedPath() string

Types

type CPUQuota

type CPUQuota string

func (CPUQuota) Convert

func (t CPUQuota) Convert(period uint64) (int64, error)

Convert converts, for a 100us period and 4 cpu threads, * 100%@all => 100000 100000 * 50% => 50000 100000 * 10%@2 => 5000 100000

type Config

type Config struct {
	ID            string
	CPUs          string
	Mems          string
	CPUShares     string
	CPUQuota      string
	MemOOMControl string
	MemLimit      string
	VMemLimit     string
	MemSwappiness string
	BlockIOWeight string
	// contains filtered or unexported fields
}

func (Config) Apply

func (c Config) Apply() error

Apply is a convenience method for compatibility. Use (*Config).Apply() for state-tracking apply.

func (*Config) ApplyOnce

func (c *Config) ApplyOnce() (bool, error)

ApplyOnce applies the pg configuration if it hasn't been applied already. Returns true if the config was applied, false if it was already applied.

func (Config) ApplyProc

func (c Config) ApplyProc(pid int) (created bool, errs error)

ApplyProc creates the cgroup, set caps, and add the specified process

func (*Config) Clean

func (c *Config) Clean() (bool, error)

Clean removes the pg configuration if it was applied.

func (Config) Delete

func (c Config) Delete() (bool, error)

func (Config) String

func (c Config) String() string

func (*Config) WithLogger

func (c *Config) WithLogger(l *plog.Logger) *Config

WithLogger sets the logger for this Config and returns itself for chaining.

type Mgr

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

func FromContext

func FromContext(ctx context.Context) *Mgr

func (*Mgr) ApplyConfigs

func (m *Mgr) ApplyConfigs() error

ApplyConfigs applies all registered pg configs in order (base to leaf). Each config is applied only if not already applied.

func (*Mgr) Clean

func (m *Mgr) Clean()

func (*Mgr) Register

func (m *Mgr) Register(c *Config)

Jump to

Keyboard shortcuts

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