environment

package
v0.2.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package environment keeps the registry of managed containerd hosts (ADR-0006). MVP registers a single "local" environment backed by the containerd socket; remote agent-backed environments (#69, #70) implement the same runtime.Runtime interface.

Index

Constants

View Source
const (
	KindLocal = "local"
)

Kinds of environments.

View Source
const LocalID = "local"

LocalID is the ID of the environment for the host nerdui runs on.

Variables

View Source
var ErrDuplicate = errors.New("environment already registered")

ErrDuplicate is returned when an environment ID is already registered.

Functions

This section is empty.

Types

type Environment

type Environment struct {
	ID               string
	Name             string
	Kind             string
	DefaultNamespace string
	Runtime          runtime.Runtime
	// Events fans out the environment's containerd events; Run it for the server lifetime.
	Events *events.Hub
}

Environment is a managed containerd host.

func Local

func Local(rt runtime.Runtime, defaultNamespace string) *Environment

Local returns the environment for the local containerd socket.

type Registry

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

Registry is a concurrency-safe, ordered set of environments.

func NewRegistry

func NewRegistry(envs ...*Environment) *Registry

NewRegistry returns a registry with envs in the given order. It panics on duplicate IDs.

func (*Registry) Add

func (r *Registry) Add(e *Environment) error

Add registers e.

func (*Registry) Close

func (r *Registry) Close() error

Close closes every environment's runtime.

func (*Registry) Get

func (r *Registry) Get(id string) (*Environment, bool)

Get returns the environment with id.

func (*Registry) List

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

List returns environments in registration order.

Jump to

Keyboard shortcuts

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