mgr

package
v0.0.0-...-adb5aae Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2017 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerManager

type ContainerManager struct {
	Store     *meta.Store
	Client    *ctrd.Client
	NameToID  *collect.SafeMap
	ImageMgr  ImageMgr
	VolumeMgr VolumeMgr
	IOs       *containerio.Cache
	// contains filtered or unexported fields
}

ContainerManager is the default implement of interface ContainerMgr.

func NewContainerManager

func NewContainerManager(ctx context.Context, store *meta.Store, cli *ctrd.Client, imgMgr ImageMgr, volMgr VolumeMgr) (*ContainerManager, error)

NewContainerManager creates a brand new container manager.

func (*ContainerManager) Attach

func (cm *ContainerManager) Attach(ctx context.Context, name string, attach *types.AttachConfig) error

Attach attachs a container's io.

func (*ContainerManager) Create

Create checks passed in parameters and create a Container object whose status is set at Created.

func (*ContainerManager) List

List returns the container's list.

func (*ContainerManager) Restore

func (cm *ContainerManager) Restore(ctx context.Context) error

Restore containers from meta store to memory and recover those container.

func (*ContainerManager) Start

func (cm *ContainerManager) Start(ctx context.Context, cfg types.ContainerStartConfig) (err error)

Start a pre created Container.

func (*ContainerManager) Stop

func (cm *ContainerManager) Stop(ctx context.Context, name string, timeout time.Duration) error

Stop stops a running container.

type ContainerMgr

type ContainerMgr interface {
	// Create a new container.
	Create(ctx context.Context, name string, config *types.ContainerConfigWrapper) (*types.ContainerCreateResp, error)

	// Start a container.
	Start(ctx context.Context, config types.ContainerStartConfig) error

	// Stop a container.
	Stop(ctx context.Context, name string, timeout time.Duration) error

	// Attach a container.
	Attach(ctx context.Context, name string, attach *types.AttachConfig) error

	// List returns the list of containers.
	List(ctx context.Context) ([]*types.ContainerInfo, error)
}

ContainerMgr as an interface defines all operations against container.

type ImageManager

type ImageManager struct {
	// DefaultRegistry is the default registry of daemon.
	// When users do not specify image repo in image name,
	// daemon will automatically pull images from DefaultRegistry.
	// TODO: make DefaultRegistry can be reloaded.
	DefaultRegistry string
	// contains filtered or unexported fields
}

ImageManager is an implementation of interface ImageMgr. It is a stateless manager, and it will never store image details. When image details needed from users, ImageManager interacts with containerd to get details.

func NewImageManager

func NewImageManager(cfg *config.Config, client *ctrd.Client) (*ImageManager, error)

NewImageManager initializes a brand new image manager.

func (*ImageManager) ListImages

func (mgr *ImageManager) ListImages(ctx context.Context, filters string) ([]types.Image, error)

ListImages lists images stored by containerd.

func (*ImageManager) PullImage

func (mgr *ImageManager) PullImage(pctx context.Context, image, tag string, out io.Writer) error

PullImage pulls images from specified registry.

func (*ImageManager) SearchImages

func (mgr *ImageManager) SearchImages(ctx context.Context, name string, registry string) ([]types.SearchResultItem, error)

SearchImages searches imaged from specified registry.

type ImageMgr

type ImageMgr interface {
	// PullImage pulls images from specified registry.
	PullImage(ctx context.Context, image, tag string, out io.Writer) error

	// ListImages lists images stored by containerd.
	ListImages(ctx context.Context, filters string) ([]types.Image, error)

	// Search Images from specified registry.
	SearchImages(ctx context.Context, name string, registry string) ([]types.SearchResultItem, error)
}

ImageMgr as an interface defines all operations against images.

type SystemManager

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

SystemManager is an instance of system management.

func NewSystemManager

func NewSystemManager(cfg *config.Config) (*SystemManager, error)

NewSystemManager creates a brand new system manager.

func (*SystemManager) Info

func (mgr *SystemManager) Info() (types.SystemInfo, error)

Info shows system information of daemon.

func (*SystemManager) Version

func (mgr *SystemManager) Version() (types.SystemVersion, error)

Version shows version of daemon.

type SystemMgr

type SystemMgr interface {
	Info() (types.SystemInfo, error)
	Version() (types.SystemVersion, error)
}

SystemMgr as an interface defines all operations against host.

type VolumeManager

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

VolumeManager is the default implement of interface VolumeMgr.

func NewVolumeManager

func NewVolumeManager(ms *meta.Store, cfg volume.Config) (*VolumeManager, error)

NewVolumeManager creates a brand new volume manager.

func (*VolumeManager) Attach

func (vm *VolumeManager) Attach(ctx context.Context, name string, options map[string]string) (*types.Volume, error)

Attach is used to bind a volume to container.

func (*VolumeManager) Create

func (vm *VolumeManager) Create(ctx context.Context, name, driver string, options, labels map[string]string) error

Create is used to create volume.

func (*VolumeManager) Detach

func (vm *VolumeManager) Detach(ctx context.Context, name string, options map[string]string) (*types.Volume, error)

Detach is used to unbind a volume from container.

func (*VolumeManager) Info

func (vm *VolumeManager) Info(ctx context.Context, name string) (*types.Volume, error)

Info returns the information of volume that specified name/id.

func (*VolumeManager) List

func (vm *VolumeManager) List(ctx context.Context, labels map[string]string) ([]string, error)

List returns all volumes on this host.

func (*VolumeManager) Path

func (vm *VolumeManager) Path(ctx context.Context, name string) (string, error)

Path returns the mount path of volume.

func (*VolumeManager) Remove

func (vm *VolumeManager) Remove(ctx context.Context, name string) error

Remove is used to delete an existing volume.

type VolumeMgr

type VolumeMgr interface {
	// Create is used to create volume.
	Create(ctx context.Context, name, driver string, options, labels map[string]string) error

	// Remove is used to delete an existing volume.
	Remove(ctx context.Context, name string) error

	// List returns all volumes on this host.
	List(ctx context.Context, labels map[string]string) ([]string, error)

	// Info returns the information of volume that specified name/id.
	Info(ctx context.Context, name string) (*types.Volume, error)

	// Path returns the mount path of volume.
	Path(ctx context.Context, name string) (string, error)

	// Attach is used to bind a volume to container.
	Attach(ctx context.Context, name string, options map[string]string) (*types.Volume, error)

	// Detach is used to unbind a volume from container.
	Detach(ctx context.Context, name string, options map[string]string) (*types.Volume, error)
}

VolumeMgr defines interface to manage container volume.

Jump to

Keyboard shortcuts

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