shared

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2019 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePodStatusResults added in v1.1.0

func CreatePodStatusResults(ctrStatuses map[string]libpod.ContainerStatus) (string, error)

func CreatePortBindings added in v1.0.0

func CreatePortBindings(ports []string) ([]ocicni.PortMapping, error)

CreatePortBindings iterates ports mappings and exposed ports into a format CNI understands

func GenerateCommand added in v0.10.1

func GenerateCommand(command, imageName, name string) ([]string, error)

GenerateCommand takes a label (string) and converts it to an executable command

func GenerateRunEnvironment added in v0.10.1

func GenerateRunEnvironment(name, imageName string, opts map[string]string) []string

GenerateRunEnvironment merges the current environment variables with optional environment variables provided by the user

func GenerateRunlabelCommand added in v0.12.1

func GenerateRunlabelCommand(runLabel, imageName, name string, opts map[string]string, extraArgs []string) ([]string, []string, error)

GenerateRunlabelCommand generates the command that will eventually be execucted by podman

func GetCtrInspectInfo

func GetCtrInspectInfo(config *libpod.ContainerConfig, ctrInspectData *inspect.ContainerInspectData, createArtifact *cc.CreateConfig) (*inspect.ContainerData, error)

GetCtrInspectInfo takes container inspect data and collects all its info into a ContainerData structure for inspection related methods

func GetNamespaceOptions added in v0.8.4

func GetNamespaceOptions(ns []string) ([]libpod.PodCreateOption, error)

GetNamespaceOptions transforms a slice of kernel namespaces into a slice of pod create options. Currently, not all kernel namespaces are supported, and they will be returned in an error

func GetPodStatus

func GetPodStatus(pod *libpod.Pod) (string, error)

GetPodStatus determines the status of the pod based on the statuses of the containers in the pod. Returns a string representation of the pod status

func GetRunlabel added in v0.12.1

func GetRunlabel(label string, runlabelImage string, ctx context.Context, runtime *libpod.Runtime, pull bool, inputCreds string, dockerRegistryOptions image.DockerRegistryOptions, authfile string, signaturePolicyPath string, output io.Writer) (string, string, error)

GetRunlabel is a helper function for runlabel; it gets the image if needed and begins the contruction of the runlabel output and environment variables

func ParallelExecuteWorkerPool added in v0.11.1

func ParallelExecuteWorkerPool(workers int, functions []ParallelWorkerInput) (map[string]error, int)

ParallelExecuteWorkerPool takes container jobs and performs them in parallel. The worker int determines how many workers/threads should be premade.

func ParallelWorker added in v0.11.1

func ParallelWorker(wg *sync.WaitGroup, jobs <-chan ParallelWorkerInput, results chan<- containerError)

ParallelWorker is a "threaded" worker that takes jobs from the channel "queue"

func Parallelize added in v0.11.1

func Parallelize(job string) int

Parallelize provides the maximum number of parallel workers (int) as calculated by a basic heuristic. This can be overriden by the --max-workers primary switch to podman.

Types

type BatchContainerStruct

type BatchContainerStruct struct {
	ConConfig   *libpod.ContainerConfig
	ConState    libpod.ContainerStatus
	ExitCode    int32
	Exited      bool
	Pid         int
	StartedTime time.Time
	ExitedTime  time.Time
	Size        *ContainerSize
}

BatchContainerStruct is the return obkect from BatchContainer and contains container related information

func BatchContainerOp

func BatchContainerOp(ctr *libpod.Container, opts PsOptions) (BatchContainerStruct, error)

BatchContainer is used in ps to reduce performance hits by "batching" locks.

type ContainerSize

type ContainerSize struct {
	RootFsSize int64 `json:"rootFsSize"`
	RwSize     int64 `json:"rwSize"`
}

ContainerSize holds the size of the container's root filesystem and top read-write layer

type Namespace

type Namespace struct {
	PID    string `json:"pid,omitempty"`
	Cgroup string `json:"cgroup,omitempty"`
	IPC    string `json:"ipc,omitempty"`
	MNT    string `json:"mnt,omitempty"`
	NET    string `json:"net,omitempty"`
	PIDNS  string `json:"pidns,omitempty"`
	User   string `json:"user,omitempty"`
	UTS    string `json:"uts,omitempty"`
}

Namespace describes output for ps namespace

func GetNamespaces

func GetNamespaces(pid int) *Namespace

GetNamespaces returns a populated namespace struct

type ParallelWorkerInput added in v0.11.1

type ParallelWorkerInput struct {
	ContainerID  string
	ParallelFunc pFunc
}

ParallelWorkerInput is a struct used to pass in a slice of parallel funcs to be performed on a container ID

type PsContainerOutput added in v0.11.1

type PsContainerOutput struct {
	ID        string
	Image     string
	Command   string
	Created   string
	Ports     string
	Names     string
	IsInfra   bool
	Status    string
	State     libpod.ContainerStatus
	Pid       int
	Size      *ContainerSize
	Pod       string
	CreatedAt time.Time
	ExitedAt  time.Time
	StartedAt time.Time
	Labels    map[string]string
	PID       string
	Cgroup    string
	IPC       string
	MNT       string
	NET       string
	PIDNS     string
	User      string
	UTS       string
	Mounts    string
}

PsContainerOutput is the struct being returned from a parallel Batch operation

func NewBatchContainer added in v0.11.1

func NewBatchContainer(ctr *libpod.Container, opts PsOptions) (PsContainerOutput, error)

NewBatchContainer runs a batch process under one lock to get container information and only be called in PBatch

func PBatch added in v0.11.1

func PBatch(containers []*libpod.Container, workers int, opts PsOptions) []PsContainerOutput

PBatch is performs batch operations on a container in parallel. It spawns the number of workers relative to the the number of parallel operations desired.

type PsOptions

type PsOptions struct {
	All       bool
	Format    string
	Last      int
	Latest    bool
	NoTrunc   bool
	Pod       bool
	Quiet     bool
	Size      bool
	Sort      string
	Label     string
	Namespace bool
	Sync      bool
}

PsOptions describes the struct being formed for ps

Jump to

Keyboard shortcuts

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