util

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HealthMap = map[string]model.ContainerHealth{
	"starting":  model.TransitionState,
	"healthy":   model.HealthyState,
	"unhealthy": model.UnhealthyState,
}
View Source
var MountTypeRMap = func() map[model.MountType]mount.Type {
	m := make(map[model.MountType]mount.Type)
	for k, v := range MountTypeMap {
		m[v] = k
	}
	return m
}()
View Source
var NetTypeMap = map[string]model.NetworkType{
	"bridge":  model.BridgeNet,
	"macvlan": model.MACVlanNet,
	"host":    model.HostNet,
}
View Source
var NetTypeRMap = func() map[model.NetworkType]string {
	m := make(map[model.NetworkType]string)
	for k, v := range NetTypeMap {
		m[v] = k
	}
	return m
}()
View Source
var PortTypeMap = map[string]model.PortType{
	"tcp":  model.TcpPort,
	"udp":  model.UdpPort,
	"sctp": model.SctpPort,
}
View Source
var PortTypeRMap = func() map[model.PortType]string {
	m := make(map[model.PortType]string)
	for k, v := range PortTypeMap {
		m[v] = k
	}
	return m
}()
View Source
var RestartPolicyMap = map[string]model.RestartStrategy{
	"no":             model.RestartNever,
	"on-failure":     model.RestartOnFail,
	"always":         model.RestartAlways,
	"unless-stopped": model.RestartNotStopped,
}
View Source
var RestartPolicyRMap = func() map[model.RestartStrategy]string {
	m := make(map[model.RestartStrategy]string)
	for k, v := range RestartPolicyMap {
		m[v] = k
	}
	return m
}()
View Source
var StateMap = map[string]model.ContainerState{
	"created":    model.InitState,
	"running":    model.RunningState,
	"paused":     model.PausedState,
	"restarting": model.RestartingState,
	"removing":   model.RemovingState,
	"exited":     model.StoppedState,
	"dead":       model.DeadState,
}
View Source
var StateRMap = func() map[model.ContainerState]string {
	m := make(map[model.ContainerState]string)
	for k, v := range StateMap {
		m[v] = k
	}
	return m
}()

Functions

func CheckNetworks

func CheckNetworks(n []model.ContainerNet) error

func GenContainerFilterArgs

func GenContainerFilterArgs(filter model.ContainerFilter) filters.Args

func GenDevices

func GenDevices(devices []model.Device) ([]container.DeviceMapping, error)

func GenEnv

func GenEnv(ev map[string]string) (env []string)

func GenImageFilterArgs

func GenImageFilterArgs(filter model.ImageFilter) filters.Args

func GenMounts

func GenMounts(mounts []model.Mount) ([]mount.Mount, error)

func GenNetIPAMConfig

func GenNetIPAMConfig(n model.Network) (c []network.IPAMConfig)

func GenPortMap

func GenPortMap(ports []model.Port) (nat.PortMap, error)

func GenRestartPolicy

func GenRestartPolicy(strategy model.RestartStrategy, retries *int) (rp container.RestartPolicy, err error)

func GenStopTimeout

func GenStopTimeout(d *time.Duration) *int

func GenVolumeFilterArgs

func GenVolumeFilterArgs(filter model.VolumeFilter) filters.Args

func GetConst

func GetConst(s string, m map[string]string) string

func ParseContainerName

func ParseContainerName(s string) string

func ParseEndpointSettings

func ParseEndpointSettings(endptSettings map[string]*network.EndpointSettings) (netInfo []model.ContainerNet)

func ParseEnv

func ParseEnv(ev []string) (env map[string]string)

func ParseMountPoints

func ParseMountPoints(mountPoints []types.MountPoint) (mounts []model.Mount)

func ParseMounts

func ParseMounts(mts []mount.Mount) (mounts []model.Mount)

func ParseNetIPAMConfig

func ParseNetIPAMConfig(c []network.IPAMConfig) (s model.Subnet, gw model.IPAddr)

func ParsePortSetAndMap

func ParsePortSetAndMap(portSet nat.PortSet, portMap nat.PortMap) ([]model.Port, error)

func ParseRestartPolicy

func ParseRestartPolicy(rp container.RestartPolicy) (strategy model.RestartStrategy, retires *int)

func ParseStopTimeout

func ParseStopTimeout(t *int) *time.Duration

func ParseTimestamp

func ParseTimestamp(s string) (time.Time, error)

Types

type ImgPullResp

type ImgPullResp struct {
	Status         string `json:"status"`
	Message        string `json:"message"`
	ID             string `json:"id"`
	ProgressDetail struct {
		Current int `json:"current"`
		Total   int `json:"total"`
	} `json:"progressDetail"`
}

func (ImgPullResp) String

func (r ImgPullResp) String() string

type RCWrapper added in v0.2.0

type RCWrapper struct {
	ReadCloser io.ReadCloser
	// contains filtered or unexported fields
}

func (*RCWrapper) Close added in v0.2.0

func (c *RCWrapper) Close() error

func (*RCWrapper) Read added in v0.2.0

func (c *RCWrapper) Read(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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