sandbox

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToProto

func ToProto(sandbox *Sandbox) *types.Sandbox

ToProto will map Sandbox struct to it's protobuf definition

Types

type Controller

type Controller interface {
	// Start will start new sandbox instance.
	// containerd will run new shim runtime instance and will invoke Start to create a sandbox process.
	// This routine must be invoked before scheduling containers on this instance.
	// Once started clients may run containers via Task service (additionally specifying sandbox id the container will belong to).
	Start(ctx context.Context, sandboxID string) (uint32, error)
	// Shutdown deletes and cleans all tasks and sandbox instance.
	Shutdown(ctx context.Context, sandboxID string) error
	// Wait blocks until sandbox process exits.
	Wait(ctx context.Context, sandboxID string) (*sandbox.ControllerWaitResponse, error)
	// Status will query sandbox process status. It is heavier than Ping call and must be used whenever you need to
	// gather metadata about current sandbox state (status, uptime, resource use, etc).
	Status(ctx context.Context, sandboxID string) (*sandbox.ControllerStatusResponse, error)
}

Controller is an interface to manage sandboxes at runtime. When running in sandbox mode, shim expected to implement `SandboxService`. Shim lifetimes are now managed manually via sandbox API by the containerd's client.

type RuntimeOpts

type RuntimeOpts struct {
	Name    string
	Options typeurl.Any
}

RuntimeOpts holds runtime specific information

type Sandbox

type Sandbox struct {
	// ID uniquely identifies the sandbox in a namespace
	ID string
	// Labels provide metadata extension for a sandbox
	Labels map[string]string
	// Runtime shim to use for this sandbox
	Runtime RuntimeOpts
	// Spec carries the runtime specification used to implement the sandbox
	Spec typeurl.Any
	// CreatedAt is the time at which the sandbox was created
	CreatedAt time.Time
	// UpdatedAt is the time at which the sandbox was updated
	UpdatedAt time.Time
	// Extensions stores client-specified metadata
	Extensions map[string]typeurl.Any
}

Sandbox is an object stored in metadata database

func FromProto

func FromProto(sandboxpb *types.Sandbox) Sandbox

FromProto map protobuf sandbox definition to Sandbox struct

type Store

type Store interface {
	// Create a sandbox record in the store
	Create(ctx context.Context, sandbox Sandbox) (Sandbox, error)

	// Update the sandbox with the provided sandbox object and fields
	Update(ctx context.Context, sandbox Sandbox, fieldpaths ...string) (Sandbox, error)

	// Get sandbox metadata using the id
	Get(ctx context.Context, id string) (Sandbox, error)

	// List returns sandboxes that match one or more of the provided filters
	List(ctx context.Context, filters ...string) ([]Sandbox, error)

	// Delete a sandbox from metadata store using the id
	Delete(ctx context.Context, id string) error
}

Store is a storage interface for sandbox metadata objects

Jump to

Keyboard shortcuts

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