api

package
v1.5.28 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2025 License: GPL-3.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API struct with containerManager field

func NewAPI

func NewAPI(mgr container.Manager) *API

Function to create a new API instance

func (*API) EnsureImages added in v1.2.0

func (api *API) EnsureImages(images []string) error

func (*API) Ping added in v1.2.2

func (api *API) Ping() error

func (*API) RunContainer

func (api *API) RunContainer(cfg container.ContainerConfig, showStats bool) (string, string, error)

RunContainer создаёт, запускает контейнер, стримит stats, ждёт финиша и возвращает логи + JSON-метрики.

func (*API) RunContainerParallel added in v0.9.0

func (api *API) RunContainerParallel(config container.ContainerConfig, wg *sync.WaitGroup, c chan string) error

Function to run containers in parallel using goroutines and channels. The container logs are sent to the channel. Creates. Starts, Waits and Removes the container.

type StatsResponse added in v1.5.26

type StatsResponse struct {
	CPUStats struct {
		// TotalUsage — кумулятивные наносекунды CPU
		CPUUsage struct {
			TotalUsage uint64 `json:"total_usage"`
		} `json:"cpu_usage"`
		// SystemUsage — кумулятивные наносекунды всех ядер
		SystemUsage uint64 `json:"system_cpu_usage"`
	} `json:"cpu_stats"`

	// PreCPUStats нужен, если ты захочешь рассчитывать %-ные изменения по docker-алгоритму
	PreCPUStats struct {
		CPUUsage struct {
			TotalUsage uint64 `json:"total_usage"`
		} `json:"cpu_usage"`
		SystemUsage uint64 `json:"system_cpu_usage"`
	} `json:"precpu_stats"`

	MemoryStats struct {
		Usage uint64 `json:"usage"`
		Limit uint64 `json:"limit"`
	} `json:"memory_stats"`
}

StatsResponse — минимальный набор полей из Docker‐статистики, которые нам нужны.

Jump to

Keyboard shortcuts

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