containerruntime

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRuntimeMonitoring

func IsRuntimeMonitoring(runtimeID string) bool

IsRuntimeMonitoring reports whether runtimeID is currently monitored.

func MarkIfNotMonitoring

func MarkIfNotMonitoring(runtimeID string) bool

MarkIfNotMonitoring atomically marks runtimeID as monitored if it is not already. Returns true if the runtimeID was newly marked.

func MarkRuntimeMonitoring

func MarkRuntimeMonitoring(runtimeID string)

MarkRuntimeMonitoring marks runtimeID as actively monitored. It is reference-counted so multiple monitor goroutines for the same runtimeID can coexist safely.

func RuntimeMonitoringSnapshot

func RuntimeMonitoringSnapshot() map[string]int

RuntimeMonitoringSnapshot returns a copy of the process-global monitoring table. Key is runtimeID and value is monitoring reference count.

func SetMonitoringRegistry

func SetMonitoringRegistry(reg MonitoringRegistry)

SetMonitoringRegistry replaces the process-global monitoring registry. Passing nil is ignored.

func UnmarkRuntimeMonitoring

func UnmarkRuntimeMonitoring(runtimeID string)

UnmarkRuntimeMonitoring releases one monitoring reference for runtimeID.

Types

type MonitoringRegistry

type MonitoringRegistry interface {
	Mark(runtimeID string)
	Unmark(runtimeID string)
	IsMonitoring(runtimeID string) bool
	MarkIfNotMonitoring(runtimeID string) bool
	Snapshot() map[string]int
}

MonitoringRegistry abstracts runtime monitoring membership operations. Implementations can be in-memory, Redis-backed, etc.

func NewInMemoryMonitoringRegistry

func NewInMemoryMonitoringRegistry() MonitoringRegistry

type Registry

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

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Get

func (r *Registry) Get(name string) Runtime

func (*Registry) List

func (r *Registry) List() []Runtime

func (*Registry) Register

func (r *Registry) Register(name string, rt Runtime)

type Runtime

type Runtime interface {
	Name() string

	Create(ctx context.Context, spec *types.ContainerSpec) (string, error)

	Start(ctx context.Context, runtimeID string) error

	Stop(ctx context.Context, runtimeID string) error

	Pause(ctx context.Context, runtimeID string) error

	Resume(ctx context.Context, runtimeID string) error

	Delete(ctx context.Context, runtimeID string) error

	Logs(ctx context.Context, runtimeID string, tail int) (string, error)

	SetEventHandler(handler RuntimeEventHandler)

	Exec(ctx context.Context, runtimeID string, cmd []string) (string, error)
}

type RuntimeEvent

type RuntimeEvent struct {
	Type      string
	RuntimeID string
	Message   string
}

type RuntimeEventHandler

type RuntimeEventHandler interface {
	OnEvent(event RuntimeEvent)
}

type RuntimeImageManager

type RuntimeImageManager interface {
	EnsureImage(ctx context.Context, image string, pullPolicy string) error
}

RuntimeImageManager is an optional extension interface for runtime-side image lifecycle operations used by ImageManager.

type RuntimeInspection

type RuntimeInspection struct {
	IPAddress string
	NodeName  string
}

RuntimeInspection carries runtime-specific inspect data used by manager/service.

type RuntimeInspector

type RuntimeInspector interface {
	Inspect(ctx context.Context, runtimeID string) (*RuntimeInspection, error)
}

RuntimeInspector is an optional extension interface. Implementations can expose inspect metadata (such as container internal IP) without forcing all runtimes.

type RuntimeMonitor

type RuntimeMonitor interface {
	Monitor(ctx context.Context, runtimeID string) error
}

RuntimeMonitor is an optional extension interface for reconnecting runtime lifecycle monitoring after process restarts.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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