quota

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Component = compogo.Component{
	Name: "resource.quota",
	Dependencies: compogo.Components{
		&manager.Component,
	},
	Init: compogo.StepFunc(func(container compogo.Container) error {
		return container.Provide(NewQuota)
	}),
	PreExecute: compogo.StepFunc(func(container compogo.Container) error {
		return container.Invoke(func(m *manager.Manager, q *Quota) {
			m.OnChangeResource.Subscribe(q.OnChangeResource)
		})
	}),
}

Component — компонент применения квот ресурсов. Подписывается на изменения ресурсов и применяет их к рантайму.

Functions

This section is empty.

Types

type Quota

type Quota struct{}

Quota — применяет ограничения ресурсов к рантайму Go. При изменении лимитов CPU/Memory через cgroup, автоматически настраивает:

  • GOMAXPROCS — количество процессоров
  • SetMemoryLimit — лимит памяти для GC

func NewQuota

func NewQuota() *Quota

NewQuota создаёт новый Quota.

func (*Quota) OnChangeResource

func (quota *Quota) OnChangeResource(_ context.Context, resource *domain.Resource)

OnChangeResource вызывается при изменении ресурсов. Применяет новые лимиты к рантайму.

Jump to

Keyboard shortcuts

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