manager

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: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Component = compogo.Component{
	Name: "resource.manager",
	Dependencies: compogo.Components{
		&manager.Component,
		&repeater.Component,
	},
	Init: compogo.StepFunc(func(container compogo.Container) error {
		return container.Provide(NewManager)
	}),
	Execute: compogo.StepFunc(func(container compogo.Container) error {
		return container.Invoke(func(r repeater.Repeater, config *manager.Config, m *Manager) error {
			return r.AddProcess(repeater.NewTask("resource.manager", config.Delay, m.Process))
		})
	}),
}

Component — компонент менеджера ресурсов. Запускает периодический сбор статистики через Repeater.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	OnChangeResource emitter.Emitter[*domain.Resource]
	// contains filtered or unexported fields
}

Manager — менеджер ресурсов. Собирает статистику использования CPU и Memory через cgroup. При изменении ресурсов генерирует событие OnChangeResource.

func NewManager

func NewManager(closer compogo.Closer) *Manager

NewManager создаёт новый менеджер ресурсов.

func (*Manager) CPU

func (manager *Manager) CPU() *domain.Resource

CPU возвращает текущий CPU ресурс.

func (*Manager) Memory

func (manager *Manager) Memory() *domain.Resource

Memory возвращает текущий Memory ресурс.

func (*Manager) Process

func (manager *Manager) Process(_ context.Context) error

Process собирает статистику ресурсов и генерирует события при изменениях. Вызывается периодически через Repeater.

Jump to

Keyboard shortcuts

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