Help us shape the future of Go! Take the 2026 Go Developer Survey

engine

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine orchestrates devcontainer lifecycle operations.

func New

func New(d driver.Driver, composeHelper *compose.Helper, store *workspace.Store, logger *slog.Logger) *Engine

New creates an Engine with the given dependencies.

func (*Engine) Delete

func (e *Engine) Delete(ctx context.Context, ws *workspace.Workspace) error

Delete removes the container and workspace state.

func (*Engine) Restart added in v0.2.0

func (e *Engine) Restart(ctx context.Context, ws *workspace.Workspace) (*RestartResult, error)

Restart restarts the container for the given workspace. It implements a "warm recreate" strategy:

  • If the devcontainer config hasn't changed, it does a simple container restart and runs only the resume-flow lifecycle hooks (postStartCommand, postAttachCommand).
  • If only "safe" properties changed (volumes, mounts, ports, env, runArgs), it recreates the container without rebuilding the image and runs the resume flow.
  • If image-affecting properties changed (image, Dockerfile, features, build args), it returns an error suggesting `crib rebuild`.

func (*Engine) SetOutput

func (e *Engine) SetOutput(stdout, stderr io.Writer)

SetOutput overrides the default stdout and stderr writers.

func (*Engine) SetProgress

func (e *Engine) SetProgress(fn func(string))

SetProgress sets a callback for user-facing progress messages.

func (*Engine) Status

Status returns the current container details for a workspace, or nil if not found.

func (*Engine) Stop

func (e *Engine) Stop(ctx context.Context, ws *workspace.Workspace) error

Stop stops the container for the given workspace.

func (*Engine) Up

func (e *Engine) Up(ctx context.Context, ws *workspace.Workspace, opts UpOptions) (*UpResult, error)

Up brings a devcontainer up for the given workspace.

type RestartResult added in v0.2.0

type RestartResult struct {
	// ContainerID is the container ID.
	ContainerID string

	// WorkspaceFolder is the path inside the container where the project is mounted.
	WorkspaceFolder string

	// RemoteUser is the user to run commands as inside the container.
	RemoteUser string

	// Recreated indicates whether the container was recreated (config changed)
	// rather than simply restarted.
	Recreated bool
}

RestartResult holds the outcome of a Restart operation.

type UpOptions

type UpOptions struct {
	// Recreate forces container recreation even if one already exists.
	Recreate bool
}

UpOptions controls the behavior of the Up operation.

type UpResult

type UpResult struct {
	// ContainerID is the container ID.
	ContainerID string

	// WorkspaceFolder is the path inside the container where the project is mounted.
	WorkspaceFolder string

	// RemoteUser is the user to run commands as inside the container.
	RemoteUser string
}

UpResult holds the outcome of a successful Up operation.

Jump to

Keyboard shortcuts

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