storage

package
v0.0.0-...-fcfc175 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirAccessFailed string = "can't access container directory"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerHandler

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

func (*ContainerHandler) BundleDir

func (h *ContainerHandler) BundleDir() string

func (*ContainerHandler) ContainerDir

func (h *ContainerHandler) ContainerDir() string

func (*ContainerHandler) ContainerID

func (h *ContainerHandler) ContainerID() container.ID

func (*ContainerHandler) RootfsDir

func (h *ContainerHandler) RootfsDir() string

func (*ContainerHandler) RuntimeSpecFile

func (h *ContainerHandler) RuntimeSpecFile() string

type ContainerStore

type ContainerStore interface {
	RootDir() string
	// CreateContainer 在非易失性的位置创建容器目录(它也可能在里面存储一些容器的元数据)
	CreateContainer(id container.ID, rollback *rollback.Rollback) (*ContainerHandler, error)

	CreateContainerBundle(id container.ID, spec oci.RuntimeSpec, rootfs string) error

	GetContainer(id container.ID) (*ContainerHandler, error)

	// DeleteContainer Removes <container_dir>
	DeleteContainer(id container.ID) error

	FindContainers() ([]*ContainerHandler, error)

	ContainerStateRead(id container.ID) (state []byte, err error)

	// ContainerStateWriteAtomic 更新磁盘上容器的状态(原子性的,使用 os.Rename)
	// 容器state 存储在 <container_dir>/state.json
	ContainerStateWriteAtomic(id container.ID, state []byte) error

	// ContainerStateDeleteAtomic 删除 <container_dir>/state.json, 将容器标记为准备好清理
	ContainerStateDeleteAtomic(id container.ID) error
}

func NewContainerStore

func NewContainerStore(rootDir string) ContainerStore

Jump to

Keyboard shortcuts

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