Documentation
¶
Index ¶
- type Engine
- func (e *Engine) Down(ctx context.Context, ws *workspace.Workspace) error
- func (e *Engine) Remove(ctx context.Context, ws *workspace.Workspace) error
- func (e *Engine) Restart(ctx context.Context, ws *workspace.Workspace) (*RestartResult, error)
- func (e *Engine) SetOutput(stdout, stderr io.Writer)
- func (e *Engine) SetPlugins(m *plugin.Manager)
- func (e *Engine) SetProgress(fn func(string))
- func (e *Engine) SetRuntime(name string)
- func (e *Engine) SetVerbose(v bool)
- func (e *Engine) Status(ctx context.Context, ws *workspace.Workspace) (*StatusResult, error)
- func (e *Engine) Up(ctx context.Context, ws *workspace.Workspace, opts UpOptions) (*UpResult, error)
- type RestartResult
- type StatusResult
- type UpOptions
- type UpResult
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) Down ¶ added in v0.3.0
Down stops and removes the container for the given workspace, but keeps workspace state in the store so that a subsequent "up" can recreate it. Hook markers are cleared so the next "up" runs all lifecycle hooks.
func (*Engine) Remove ¶ added in v0.3.0
Remove stops and removes the container, then deletes all workspace state.
func (*Engine) Restart ¶ added in v0.2.0
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) SetPlugins ¶ added in v0.4.0
SetPlugins attaches a plugin manager to the engine.
func (*Engine) SetProgress ¶
SetProgress sets a callback for user-facing progress messages.
func (*Engine) SetRuntime ¶ added in v0.4.0
SetRuntime stores the runtime name (e.g. "docker", "podman") for plugin requests.
func (*Engine) SetVerbose ¶ added in v0.3.0
SetVerbose enables verbose output (e.g. compose stdout).
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
// Ports lists the published port bindings.
Ports []driver.PortBinding
}
RestartResult holds the outcome of a Restart operation.
type StatusResult ¶ added in v0.3.0
type StatusResult struct {
// Container is the primary container details (nil if not found).
Container *driver.ContainerDetails
// Services holds the status of compose services (nil for non-compose workspaces).
Services []compose.ServiceStatus
}
Status returns the current container details for a workspace, or nil if not found. StatusResult holds the outcome of a Status query.
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
// ImageName is the name of the built image (for compose feature images).
ImageName 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
// Ports lists the published port bindings.
Ports []driver.PortBinding
}
UpResult holds the outcome of a successful Up operation.