container

package
v0.0.0-...-89e5b94 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	// Metadata is the metadata of the container, it is **immutable** after created.
	Metadata

	sync.RWMutex
	// contains filtered or unexported fields
}

Container contains all resources associated with the container. All methods to mutate the internal state are thread-safe.

func NewContainer

func NewContainer(config *runtime.ContainerConfig, logDirectory, sandboxID string, sandboxBundle *layout.Bundle, imageStore store.Store) (*Container, error)

NewContainer creates an internally used container type.

func (*Container) Create

func (c *Container) Create(mountType kii.MountType) error

func (*Container) GetCRIStatus

func (c *Container) GetCRIStatus() *runtime.ContainerStatus

func (*Container) GetStatus

func (c *Container) GetStatus() Status

func (*Container) Release

func (c *Container) Release() error

func (*Container) Start

func (c *Container) Start() (retErr error)

func (*Container) Stop

func (c *Container) Stop() error

type Metadata

type Metadata struct {
	// ID is the container id.
	ID string
	// Name is the container name.
	Name string
	// SandboxID is the sandbox id the container belongs to.
	SandboxID string
	// Config is the CRI container config.
	// NOTE(random-liu): Resource limits are updatable, the source
	// of truth for resource limits are in containerd.
	Config *runtime.ContainerConfig
	// ImageManifest is the manifest of image used by the container.
	ImageManifest *kii.Manifest
	// LogPath is the container log path.
	LogPath string
	// StopSignal is the system call signal that will be sent to the container to exit.
	StopSignal string
	// RooDirt is the root directory of the container
	RootDir string
}

type Opts

type Opts func(*Container) error

Opts sets specific information to newly created Container.

type Status

type Status struct {
	// Pid is the init process id of the container.
	Pid int
	// CreatedAt is the created timestamp.
	CreatedAt int64
	// StartedAt is the started timestamp.
	StartedAt int64
	// FinishedAt is the finished timestamp.
	FinishedAt int64
	// ExitCode is the container exit code.
	ExitCode int
	// CamelCase string explaining why container is in its current state.
	Reason string
	// Human-readable message indicating details about why container is in its
	// current state.
	Message string
	// Unknown indicates that the container status is not fully loaded.
	// This field doesn't need to be checkpointed.
	Unknown bool `json:"-"`
	// Released indicates that the container is released.
	Released bool
	// Resources has container runtime resource constraints
	Resources *runtime.ContainerResources
}

Status is the status of a container.

func (*Status) State

func (s *Status) State() runtime.ContainerState

State returns current state of the container based on the container status.

type Store

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

Store stores all Containers.

func NewStore

func NewStore() *Store

NewStore creates a container store.

func (*Store) Add

func (s *Store) Add(c *Container) error

Add a container into the store. Returns store.ErrAlreadyExist if the container already exists.

func (*Store) Delete

func (s *Store) Delete(id string)

Delete deletes the container from store with specified id.

func (*Store) Get

func (s *Store) Get(id string) (*Container, error)

Get returns the container with specified id. Returns errdefs.ErrNotExist if the container doesn't exist.

func (*Store) List

func (s *Store) List() []*Container

List lists all containers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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