container

package
v0.0.0-...-fd1ce1a Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package container manages spawning containers/sandboxes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Log *slog.Logger
	DB  database.DB

	// GrainID is the ID of the grain to start
	GrainID types.GrainID

	// Api will be provided to the grain as our bootstrap interface.
	Api grain.SandstormApi

	// Args will be passed to the grain agent as extra arguments.
	Args []string
}

A Command specifies a task to start in a container.

func (Command) Start

func (cmd Command) Start(ctx context.Context) (Container, error)

Start starts the container. It will shut down when ctx is canceled or Kill() is called.

type Container

type Container struct {
	Bootstrap capnp.Client // Bootstrap interface for the Container.
	// contains filtered or unexported fields
}

A Container is a reference to a running container/sandboxed grain.

func (Container) Kill

func (c Container) Kill()

Kill forcably shuts down the container. (Note: we do not provide a way to ask nicely via SIGTERM or such; apps are expected to be crash-only software).

Does not wait for shutdown to complete; see Wait().

func (Container) Wait

func (c Container) Wait()

Wait blocks until the container has shut down and then returns.

Jump to

Keyboard shortcuts

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