sandbox

package
v1.0.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2017 License: Apache-2.0 Imports: 12 Imported by: 27

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClosedNetNS = errors.New("network namespace is closed")

ErrClosedNetNS is the error returned when network namespace is closed.

Functions

This section is empty.

Types

type Metadata

type Metadata struct {
	// ID is the sandbox id.
	ID string
	// Name is the sandbox name.
	Name string
	// Config is the CRI sandbox config.
	Config *runtime.PodSandboxConfig
	// NetNSPath is the network namespace used by the sandbox.
	NetNSPath string
}

Metadata is the unversioned sandbox metadata.

func (*Metadata) MarshalJSON

func (c *Metadata) MarshalJSON() ([]byte, error)

MarshalJSON encodes Metadata into bytes in json format.

func (*Metadata) UnmarshalJSON

func (c *Metadata) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes Metadata from bytes.

type NetNS

type NetNS struct {
	sync.Mutex
	// contains filtered or unexported fields
}

NetNS holds network namespace for sandbox

func LoadNetNS

func LoadNetNS(path string) (*NetNS, error)

LoadNetNS loads existing network namespace. It returns ErrClosedNetNS if the network namespace has already been closed.

func NewNetNS

func NewNetNS() (*NetNS, error)

NewNetNS creates a network namespace for the sandbox

func (*NetNS) Closed

func (n *NetNS) Closed() bool

Closed checks whether the network namespace has been closed.

func (*NetNS) GetPath

func (n *NetNS) GetPath() string

GetPath returns network namespace path for sandbox container

func (*NetNS) Remove

func (n *NetNS) Remove() error

Remove removes network namepace if it exists and not closed. Remove is idempotent, meaning it might be invoked multiple times and provides consistent result.

type Sandbox

type Sandbox struct {
	// Metadata is the metadata of the sandbox, it is immutable after created.
	Metadata
	// Container is the containerd sandbox container client
	Container containerd.Container
	// CNI network namespace client
	NetNS *NetNS
}

Sandbox contains all resources associated with the sandbox. All methods to mutate the internal state are thread safe.

type Store

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

Store stores all sandboxes.

func NewStore

func NewStore() *Store

NewStore creates a sandbox store.

func (*Store) Add

func (s *Store) Add(sb Sandbox) error

Add a sandbox into the store.

func (*Store) Delete

func (s *Store) Delete(id string)

Delete deletes the sandbox with specified id.

func (*Store) Get

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

Get returns the sandbox with specified id. Returns nil if the sandbox doesn't exist.

func (*Store) List

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

List lists all sandboxes.

Jump to

Keyboard shortcuts

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