oci

package
v0.0.0-...-a742bf6 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// ContainerStateCreated represents the created state of a container
	ContainerStateCreated = "created"
	// ContainerStateRunning represents the running state of a container
	ContainerStateRunning = "running"
	// ContainerStateStopped represents the stopped state of a container
	ContainerStateStopped = "stopped"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

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

Container respresents a runtime container.

func NewContainer

func NewContainer(id string, name string, bundlePath string, logPath string, labels map[string]string, sandbox string, terminal bool) (*Container, error)

NewContainer creates a container object.

func (*Container) BundlePath

func (c *Container) BundlePath() string

BundlePath returns the bundlePath of the container.

func (*Container) ID

func (c *Container) ID() string

ID returns the id of the container.

func (*Container) Labels

func (c *Container) Labels() map[string]string

Labels returns the labels of the container.

func (*Container) LogPath

func (c *Container) LogPath() string

LogPath returns the log path of the container.

func (*Container) Name

func (c *Container) Name() string

Name returns the name of the container.

func (*Container) NetNsPath

func (c *Container) NetNsPath() (string, error)

NetNsPath returns the path to the network namespace of the container.

func (*Container) Sandbox

func (c *Container) Sandbox() string

Sandbox returns the sandbox name of the container.

type ContainerState

type ContainerState struct {
	specs.State
	Created  time.Time `json:"created"`
	Started  time.Time `json:"started"`
	Finished time.Time `json:"finished"`
	ExitCode int32     `json:"exitCode"`
}

ContainerState represents the status of a container.

type History

type History []*Container

History is a convenience type for storing a list of containers, sorted by creation date in descendant order.

func (*History) Len

func (history *History) Len() int

Len returns the number of containers in the history.

func (*History) Less

func (history *History) Less(i, j int) bool

Less compares two containers and returns true if the second one was created before the first one.

func (*History) Swap

func (history *History) Swap(i, j int)

Swap switches containers i and j positions in the history.

type Runtime

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

Runtime stores the information about a oci runtime

func New

func New(runtimePath string, containerDir string, conmonPath string, conmonEnv []string) (*Runtime, error)

New creates a new Runtime with options provided

func (*Runtime) ContainerDir

func (r *Runtime) ContainerDir() string

ContainerDir returns the path to the base directory for storing container configurations

func (*Runtime) ContainerStatus

func (r *Runtime) ContainerStatus(c *Container) *ContainerState

ContainerStatus returns the state of a container.

func (*Runtime) CreateContainer

func (r *Runtime) CreateContainer(c *Container) error

CreateContainer creates a container.

func (*Runtime) DeleteContainer

func (r *Runtime) DeleteContainer(c *Container) error

DeleteContainer deletes a container.

func (*Runtime) Name

func (r *Runtime) Name() string

Name returns the name of the OCI Runtime

func (*Runtime) Path

func (r *Runtime) Path() string

Path returns the full path the OCI Runtime executable

func (*Runtime) StartContainer

func (r *Runtime) StartContainer(c *Container) error

StartContainer starts a container.

func (*Runtime) StopContainer

func (r *Runtime) StopContainer(c *Container) error

StopContainer stops a container.

func (*Runtime) UpdateStatus

func (r *Runtime) UpdateStatus(c *Container) error

UpdateStatus refreshes the status of the container.

func (*Runtime) Version

func (r *Runtime) Version() (string, error)

Version returns the version of the OCI Runtime

type Store

type Store interface {
	// Add appends a new container to the store.
	Add(string, *Container)
	// Get returns a container from the store by the identifier it was stored with.
	Get(string) *Container
	// Delete removes a container from the store by the identifier it was stored with.
	Delete(string)
	// List returns a list of containers from the store.
	List() []*Container
	// Size returns the number of containers in the store.
	Size() int
	// First returns the first container found in the store by a given filter.
	First(StoreFilter) *Container
	// ApplyAll calls the reducer function with every container in the store.
	ApplyAll(StoreReducer)
}

Store defines an interface that any container store must implement.

func NewMemoryStore

func NewMemoryStore() Store

NewMemoryStore initializes a new memory store.

type StoreFilter

type StoreFilter func(*Container) bool

StoreFilter defines a function to filter container in the store.

type StoreReducer

type StoreReducer func(*Container)

StoreReducer defines a function to manipulate containers in the store

Jump to

Keyboard shortcuts

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