nspawnlifecycle

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package nspawnlifecycle provides host-side nspawn lifecycle operations that applications can expose through their own CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigLoader

type ConfigLoader func(ctx context.Context, machineName string) (cfg *config.AgentConfig, found bool, err error)

ConfigLoader returns the persisted config for a machine. found is false during the initial bootstrap window before the application persists config.

type Hooks

type Hooks struct {
	LoadConfig ConfigLoader
}

Hooks supplies application-owned lifecycle integration points.

type Lifecycle

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

Lifecycle implements reusable pre-start, post-start, and reconcile flows.

func New

func New(log *slog.Logger, hooks Hooks) (*Lifecycle, error)

New returns a lifecycle implementation using shared agent behavior and the application's persisted-config loader.

func (*Lifecycle) PostStart

func (l *Lifecycle) PostStart(ctx context.Context, machineName string) error

PostStart repairs ephemeral NVIDIA state after the managed nspawn unit starts.

func (*Lifecycle) PreStart

func (l *Lifecycle) PreStart(ctx context.Context, machineName string) error

PreStart refreshes host-side nspawn config before the managed unit starts.

func (*Lifecycle) Reconcile

func (l *Lifecycle) Reconcile(ctx context.Context, machineName string) error

Reconcile restarts the managed nspawn unit, which invokes PreStart and PostStart through its generated systemd hooks.

Jump to

Keyboard shortcuts

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