warmpool

package
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package warmpool maintains a pool of pre-started Docker containers for a single configured image, eliminating docker pull+create latency on the hot path.

The pool is optional. When WARM_POOL_SIZE is 0 or WARM_POOL_IMAGE is unset the pool is disabled and session creation uses the standard on-demand path.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	ContainerID   string
	WorkspacePath string // host path; already bound-mounted inside the container
}

Entry is a pre-warmed container ready for takeover by a new session.

type Pool

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

Pool maintains a buffered channel of warm containers and refills it in the background. All methods are goroutine-safe.

func New

func New(dockerCli *dockerpkg.Client, image string, size int, baseDir string) *Pool

New creates a warm pool. Call Start to begin filling it. The pool uses the docker client's seccomp profile and performs cosign verification before creating each container.

func (*Pool) Acquire

func (p *Pool) Acquire() (Entry, bool)

Acquire pops a warm container (non-blocking). Returns (entry, true) when one is available, or (Entry{}, false) when the pool is empty (caller falls back to on-demand creation).

func (*Pool) Image

func (p *Pool) Image() string

Image returns the image this pool pre-warms.

func (*Pool) Start

func (p *Pool) Start(ctx context.Context)

Start launches the background fill goroutine.

func (*Pool) Stop

func (p *Pool) Stop()

Stop drains and removes all warm containers. Safe to call multiple times.

Jump to

Keyboard shortcuts

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