enginekit

package
v0.2026282.1947 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 8 Imported by: 2

Documentation

Overview

Package enginekit is the container-engine client mechanism: the single place in the status surface that shells out to podman/docker (ps + inspect + exec) and returns structured, batch-derived ContainerSnapshots. All other status code consumes ContainerSnapshot and never touches the engine directly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerSnapshot

type ContainerSnapshot struct {
	Name        string             // "charly-selkies-desktop-185.52.136.164"
	State       string             // "running" | "exited" | "created" | "paused" | "dead" | "removing"
	Status      string             // human "Up 3 hours"
	Box         string             // base box short-name (filled by Collector after parsing the quadlet description)
	Instance    string             // optional instance suffix, ditto
	ImageRef    string             // full image ref:tag from ps — the deployed artifact identity
	NetworkMode string             // "host" | "bridge" | "container:<id>" | named network
	Ports       []spec.PortMapping // runtime mappings from `podman ps`
	Devices     []string           // /dev/dri/..., nvidia.com/gpu=all, ...
	Mounts      []MountInfo        // live mounts from podman inspect .Mounts (RUNTIME truth — what the container is ACTUALLY mounting, not the OCI label default)
}

ContainerSnapshot is the cheap, batch-derived view of one charly-* container. One snapshot is built from a single `podman ps --format json` row plus the matching `podman inspect` blob; both engine calls are batched at the EngineClient level (one ps + one inspect per status invocation, not per container).

func (*ContainerSnapshot) HostPortFor

func (s *ContainerSnapshot) HostPortFor(ctrPort int, proto string) (string, int, bool)

HostPortFor returns the host IP + host port that maps to the given container-side port/proto. Host-networked containers always return ("127.0.0.1", ctrPort, true) — there is no NAT mapping but the port is reachable on localhost. Returns ("", 0, false) when the port is not published.

type EngineClient

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

EngineClient is the only place in the status surface that touches podman/docker. All other code consumes ContainerSnapshot.

func NewEngineClient

func NewEngineClient(engine string) *EngineClient

NewEngineClient builds a client for the given engine name ("podman" or "docker", or "auto" which is resolved via kit.EngineBinary).

func (*EngineClient) Bin

func (e *EngineClient) Bin() string

Bin returns the resolved engine binary name.

func (*EngineClient) ExecBatched

func (e *EngineClient) ExecBatched(ctx context.Context, container, script string) (string, error)

ExecBatched runs `<engine> exec <container> sh -c '<script>'` and returns combined stdout. Used by the GuestProbe batcher to run all probes for one container in a single exec session.

func (*EngineClient) Snapshot

func (e *EngineClient) Snapshot(name string) (*ContainerSnapshot, error)

Snapshot returns a ContainerSnapshot for one named container. Used by interactive single-container commands (WlStatusCmd and the like) that need probe data without enumerating every charly container. Two engine calls (one filtered ps + one inspect of just this name).

func (*EngineClient) SnapshotAll

func (e *EngineClient) SnapshotAll(includeAll bool) ([]ContainerSnapshot, error)

SnapshotAll lists charly-* containers (one ps call), then runs one batched inspect for the whole set. Returns one ContainerSnapshot per container.

type MountInfo

type MountInfo struct {
	Type        string // "bind" | "volume" | "tmpfs"
	Source      string // host path (bind) or volume name (volume)
	Destination string // container path
	Name        string // for type=volume: the named volume; otherwise empty
}

MountInfo represents one live container mount point as reported by `podman inspect .Mounts[]`. Source is the host-side path (or volume name for type=volume); Destination is the container-side path. Type is the engine's mount kind ("bind" / "volume" / "tmpfs"). Used by `charly status` to distinguish a `--bind` / `--encrypt` deploy override from the image-label default volume backing.

Jump to

Keyboard shortcuts

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