pool

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager maintains a warm pool of pre-started containers.

func NewManager

func NewManager(runtimes map[string]runtime.Runtime, cfg config.PoolConfig, log *slog.Logger) *Manager

NewManager creates a new pool manager.

func (*Manager) Claim

func (m *Manager) Claim(image string) (*WarmContainer, bool)

Claim attempts to grab a warm container for the given image. It performs a liveness ping before returning. If the container is dead, it's discarded and the next one is tried.

func (*Manager) Flush

func (m *Manager) Flush(ctx context.Context, profile string) error

Flush destroys and recreates all warm containers for a profile.

func (*Manager) RecordCreation

func (m *Manager) RecordCreation(image string)

RecordCreation records that a sandbox was created for the given image.

func (*Manager) Resize

func (m *Manager) Resize(ctx context.Context, profile string, count int) error

Resize changes the number of warm containers for a profile.

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

Start initializes the warm pool and starts background maintenance.

func (*Manager) Statuses

func (m *Manager) Statuses() []Status

Statuses returns the current pool status for all profiles.

func (*Manager) Stop

func (m *Manager) Stop(ctx context.Context)

Stop shuts down the pool manager and destroys all warm containers.

type Status

type Status struct {
	Profile string  `json:"profile"`
	Image   string  `json:"image"`
	Ready   int     `json:"ready"`
	Memory  string  `json:"memory"`
	CPU     float64 `json:"cpu"`
}

Status describes the state of a pool profile.

type WarmContainer

type WarmContainer struct {
	ContainerID string
	Image       string
	Profile     string
	IP          string
	Memory      int64
	CPU         float64
	AuthToken   string
	Agent       *proxy.AgentConn
	Created     time.Time
	RuntimeName string
}

WarmContainer is a pre-started container ready for assignment.

Jump to

Keyboard shortcuts

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