Documentation
¶
Index ¶
- Constants
- Variables
- type ConsoleSize
- type CreateOpts
- type ExecOpts
- type Exit
- type IO
- type Process
- type Runtime
- type State
- type Status
- type Task
- type TaskInfo
- type TaskList
- func (l *TaskList) Add(ctx context.Context, t Task) error
- func (l *TaskList) AddWithNamespace(namespace string, t Task) error
- func (l *TaskList) Delete(ctx context.Context, t Task)
- func (l *TaskList) Get(ctx context.Context, id string) (Task, error)
- func (l *TaskList) GetAll(ctx context.Context) ([]Task, error)
- type TaskMonitor
Constants ¶
View Source
const ( TaskCreateEventTopic = "/tasks/create" TaskStartEventTopic = "/tasks/start" TaskOOMEventTopic = "/tasks/oom" TaskExitEventTopic = "/tasks/exit" TaskDeleteEventTopic = "/tasks/delete" TaskExecAddedEventTopic = "/tasks/exec-added" TaskExecStartedEventTopic = "/tasks/exec-started" TaskPausedEventTopic = "/tasks/paused" TaskResumedEventTopic = "/tasks/resumed" TaskCheckpointedEventTopic = "/tasks/checkpointed" TaskUnknownTopic = "/tasks/?" )
Variables ¶
View Source
var ( ErrTaskNotExists = errors.New("task does not exist") ErrTaskAlreadyExists = errors.New("task already exists") )
Functions ¶
This section is empty.
Types ¶
type ConsoleSize ¶ added in v1.0.0
type CreateOpts ¶ added in v1.0.0
type CreateOpts struct {
// Spec is the OCI runtime spec
Spec *types.Any
// Rootfs mounts to perform to gain access to the container's filesystem
Rootfs []mount.Mount
// IO for the container's main process
IO IO
// Checkpoint digest to restore container state
Checkpoint string
// Options for the runtime and container
Options *types.Any
}
type Process ¶
type Process interface {
ID() string
// State returns the process state
State(context.Context) (State, error)
// Kill signals a container
Kill(context.Context, uint32, bool) error
// Pty resizes the processes pty/console
ResizePty(context.Context, ConsoleSize) error
// CloseStdin closes the processes stdin
CloseIO(context.Context) error
// Start the container's user defined process
Start(context.Context) error
}
type Runtime ¶ added in v1.0.0
type Runtime interface {
// ID of the runtime
ID() string
// Create creates a task with the provided id and options.
Create(ctx context.Context, id string, opts CreateOpts) (Task, error)
// Get returns a task.
Get(context.Context, string) (Task, error)
// Tasks returns all the current tasks for the runtime.
// Any container runs at most one task at a time.
Tasks(context.Context) ([]Task, error)
// Delete removes the task in the runtime.
Delete(context.Context, Task) (*Exit, error)
}
Runtime is responsible for the creation of containers for a certain platform, arch, or custom usage.
type State ¶
type State struct {
// Status is the current status of the container
Status Status
// Pid is the main process id for the container
Pid uint32
// ExitStatus of the process
// Only valid if the Status is Stopped
ExitStatus uint32
// ExitedAt is the time at which the process exited
// Only valid if the Status is Stopped
ExitedAt time.Time
Stdin string
Stdout string
Stderr string
Terminal bool
}
type Task ¶ added in v1.0.0
type Task interface {
Process
// Information of the container
Info() TaskInfo
// Pause pauses the container process
Pause(context.Context) error
// Resume unpauses the container process
Resume(context.Context) error
// Exec adds a process into the container
Exec(context.Context, string, ExecOpts) (Process, error)
// Pids returns all pids
Pids(context.Context) ([]uint32, error)
// Checkpoint checkpoints a container to an image with live system data
Checkpoint(context.Context, string, *types.Any) error
// DeleteProcess deletes a specific exec process via its id
DeleteProcess(context.Context, string) (*Exit, error)
// Update sets the provided resources to a running task
Update(context.Context, *types.Any) error
// Process returns a process within the task for the provided id
Process(context.Context, string) (Process, error)
// Metrics returns runtime specific metrics for a task
Metrics(context.Context) (interface{}, error)
}
type TaskList ¶ added in v1.0.0
type TaskList struct {
// contains filtered or unexported fields
}
func NewTaskList ¶ added in v1.0.0
func NewTaskList() *TaskList
func (*TaskList) AddWithNamespace ¶ added in v1.0.0
type TaskMonitor ¶ added in v1.0.0
type TaskMonitor interface {
// Monitor adds the provided container to the monitor
Monitor(Task) error
// Stop stops and removes the provided container from the monitor
Stop(Task) error
}
TaskMonitor provides an interface for monitoring of containers within containerd
func NewMultiTaskMonitor ¶ added in v1.0.0
func NewMultiTaskMonitor(monitors ...TaskMonitor) TaskMonitor
func NewNoopMonitor ¶ added in v1.0.0
func NewNoopMonitor() TaskMonitor
Click to show internal directories.
Click to hide internal directories.