common

package
v0.0.0-...-1cebe21 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Basin 项目名
	Basin = "basin"

	// CgroupName Cgroup名
	CgroupName = Basin + "-cgroup"

	// Running 容器状态为运行中
	Running = "running"
	// Stop 容器状态为结束
	Stop = "stopped"
	// Exit 容器状态为退出
	Exit = "exited"

	// IdLength 容器ID的默认长度
	IdLength = 10

	// ContainerDataUrl 容器数据主路径
	ContainerDataUrl = "/var/run/" + Basin + "/"
	// ContainerDataUrlFormat 用于根据容器名拼装数据路径
	ContainerDataUrlFormat = ContainerDataUrl + "%s/"
	// ConfigFileName 配置文件名
	ConfigFileName = "config.json"
	// LogFileName 日志文件名
	LogFileName = "container.log"

	// RootUrl 根路径
	RootUrl = "/root/"
	// LowerDirFormat lower层路径
	LowerDirFormat = RootUrl + "%s/lower"
	// UpperDirFormat upper层路径
	UpperDirFormat = RootUrl + "%s/upper"
	// WorkDirFormat work层路径
	WorkDirFormat = RootUrl + "%s/work"
	// MergedDirFormat merged层路径
	MergedDirFormat = RootUrl + "%s/merged"
	// OverlayFsFormat 拼接命令格式
	OverlayFsFormat = "lowerdir=%s,upperdir=%s,workdir=%s"

	// Perm0777 用户、组用户和其它用户都有读/写/执行权限
	Perm0777 = 0777
	// Perm0755 用户具有读/写/执行权限,组用户和其它用户具有读/写权限;
	Perm0755 = 0755
	// Perm0644 用户具有读/写权限,组用户和其它用户具只读权限;
	Perm0644 = 0644
	// Perm0622 用户具有读/写权限,组用户和其它用户具只写权限;
	Perm0622 = 0622

	MountPointIndex = 4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseConfig

type BaseConfig struct {
	Pid         string   `json:"pid"`
	Id          string   `json:"id"`
	Name        string   `json:"name"`
	Command     string   `json:"command"`
	Status      string   `json:"status"`
	Volume      string   `json:"volume"`
	PortMapping []string `json:"portmapping"`
	CreatedTime string   `json:"createTime"`
}

type CgroupParam

type CgroupParam struct {
	CpuCfsQuota int
	CpuSet      string
	// TODO ?
	CpuShare    string
	MemoryLimit string
}

type RunParam

type RunParam struct {
	TTY               bool
	ContainerName     string
	Envs              []string
	Network           string
	PortMapping       []string
	Volume            string
	ImageName         string
	CgroupConfig      *CgroupParam
	ContainerCommands []string
}

Jump to

Keyboard shortcuts

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