Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type GetQuotas
- type Metric
- type Quota
- type ReConfiguration
- func (reConfiguration *ReConfiguration) Memory() uint64
- func (reConfiguration *ReConfiguration) Process(ctx context.Context) error
- func (reConfiguration *ReConfiguration) Processes() uint8
- func (reConfiguration *ReConfiguration) Quota() Quota
- func (reConfiguration *ReConfiguration) ReConfiguration(configurator configurator.Configurator) error
Constants ¶
View Source
const ( MemoryLimitEnvFieldName = "GOMEMLIMIT" ProcessLimitEnvFieldName = "GOMAXPROC" MemoryLimitHumanReadableFieldName = "quota.memory.limit" CpuSecondsLimitHumanReadableFieldName = "quota.cpu.limit" DelayFieldName = "quota.delay" DelayDefault = 5 * time.Minute )
Variables ¶
View Source
var ( MemoryLimitHumanReadableDefault = os.Getenv(MemoryLimitEnvFieldName) CpuSecondsLimitHumanReadable = os.Getenv(ProcessLimitEnvFieldName) )
View Source
var Component = &app.Component{ Dependencies: app.Components{ logger.Component, configurator.Component, reConfiguration.Component, repeater.Component, }, Constructor: app.Constructor(func(container container.Container) error { return container.Provides( NewMetric, NewConfig, NewReConfigurationWithConfigurator, func(reConfiguration *ReConfiguration) Quota { return reConfiguration }, ) }), BindFlags: app.BindFlags(func(flagSet *pflag.FlagSet, container container.Container) error { return container.Invoke(func(config *Config) { flagSet.StringVar(&config.MemoryLimitHumanReadable, MemoryLimitHumanReadableFieldName, MemoryLimitHumanReadableDefault, "memory limit") flagSet.StringVar(&config.CpuSecondsLimitHumanReadable, CpuSecondsLimitHumanReadableFieldName, CpuSecondsLimitHumanReadable, "cpu limit") flagSet.DurationVar(&config.Delay, DelayFieldName, DelayDefault, "quota update interval") }) }), Run: app.Run(func(container container.Container) error { return container.Invoke(func( logger logger.Logger, quota *ReConfiguration, reConfiguration reConfiguration.ReConfiguration, config *Config, configurator configurator.Configurator, r repeater.Repeater, closer closer.Closer, ) error { reConfiguration.Registration(quota) logger.Info("quota: registration in the reConfigurator") r.AddProcess("quota", config.Delay, quota.Process) return nil }) }), }
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { MemoryLimitHumanReadable string MemoryLimit uint64 CpuSecondsLimitHumanReadable string CpuSecondsLimit uint32 Delay time.Duration }
func Configuration ¶
func Configuration(config *Config, configurator configurator.Configurator) (*Config, error)
type Quota ¶
func NewWithConfigurator ¶
func NewWithConfigurator(config *Config, configurator configurator.Configurator, appConfig *app.Config, metric *Metric, logger logger.Logger) (Quota, error)
type ReConfiguration ¶
type ReConfiguration struct {
// contains filtered or unexported fields
}
func NewReConfiguration ¶
func NewReConfigurationWithConfigurator ¶
func NewReConfigurationWithConfigurator(config *Config, configurator configurator.Configurator, appConfig *app.Config, logger logger.Logger, metric *Metric) (*ReConfiguration, error)
func (*ReConfiguration) Memory ¶
func (reConfiguration *ReConfiguration) Memory() uint64
func (*ReConfiguration) Process ¶ added in v1.9.14
func (reConfiguration *ReConfiguration) Process(ctx context.Context) error
func (*ReConfiguration) Processes ¶
func (reConfiguration *ReConfiguration) Processes() uint8
func (*ReConfiguration) Quota ¶
func (reConfiguration *ReConfiguration) Quota() Quota
func (*ReConfiguration) ReConfiguration ¶
func (reConfiguration *ReConfiguration) ReConfiguration(configurator configurator.Configurator) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.