Documentation
¶
Index ¶
- func CalculateParallelLimit(n int, limit int) int
- func CalculateUptime(container *types.Container) time.Duration
- func Copy(sourcePath string, destPath string, bufferSize int) error
- func CopyContainer(source *types.Container) types.Container
- func FileNotExistEmptyOrDir(filename string) error
- func FillDefaults(container *types.Container) bool
- func FillMemorySwap(container *types.Container)
- func GetDirChildrenNames(dirPath string) ([]string, error)
- func GetImageHost(imageRef string) string
- func IsContainerCreated(c *types.Container) bool
- func IsContainerDead(c *types.Container) bool
- func IsContainerNetworkBridge(container *types.Container) bool
- func IsContainerNetworkHost(container *types.Container) bool
- func IsContainerRunningOrPaused(c *types.Container) bool
- func IsDirectory(path string) (bool, error)
- func IsFile(path string) (bool, error)
- func IsRestartPolicyAlways(policy *types.RestartPolicy) bool
- func IsRestartPolicyNone(policy *types.RestartPolicy) bool
- func IsRestartPolicyOnFailure(policy *types.RestartPolicy) bool
- func IsRestartPolicyUnlessStopped(policy *types.RestartPolicy) bool
- func MkDir(dirname string) error
- func MkDirs(dirNames ...string) error
- func RemoveChildren(dirPath string) ([]string, error)
- func SetContainerStatusCreated(c *types.Container)
- func SetContainerStatusDead(c *types.Container)
- func SetContainerStatusExited(c *types.Container, exitCode int64, errMsg string, oomKilled bool)
- func SetContainerStatusPaused(c *types.Container)
- func SetContainerStatusRunning(c *types.Container, pid int64)
- func SetContainerStatusStopped(c *types.Container, exitCode int64, errMsg string)
- func SetContainerStatusUnpaused(c *types.Container)
- func SizeRecalculate(sizeStr string, eval func(float64) float64) (string, error)
- func SizeToBytes(sizeStr string) (int64, error)
- func ToSignal(signal string) syscall.Signal
- func ValidateContainer(container *types.Container) error
- func ValidateDeviceMapping(devMapping types.DeviceMapping) error
- func ValidateDeviceMappings(devMappings []types.DeviceMapping) error
- func ValidateHostConfig(hostConfig *types.HostConfig) error
- func ValidateImage(img types.Image) error
- func ValidateLogConfig(logCfg *types.LogConfiguration) error
- func ValidateMountPoint(mp types.MountPoint) error
- func ValidateMounts(mounts []types.MountPoint) error
- func ValidateName(name string) error
- func ValidateNetworking(hostConfig *types.HostConfig) error
- func ValidateResources(resources *types.Resources) error
- func ValidateRestartPolicy(rsPolicy *types.RestartPolicy) error
- func ValidateStopOpts(opts *types.StopOpts) error
- type LocksCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateParallelLimit ¶
CalculateParallelLimit calculates the limit for starting parallel jobs
func CalculateUptime ¶
CalculateUptime calculates the uptime of a container instance
func CopyContainer ¶
CopyContainer creates a new container instance from the provided parameter
func FileNotExistEmptyOrDir ¶
FileNotExistEmptyOrDir validates whether the provided filename refers to an existing non-empty file
func FillDefaults ¶
FillDefaults sets all default configurations which are not required as an input but are required for processing the container's configuration
func FillMemorySwap ¶
FillMemorySwap sets the swap memory of a container. Memory swap should be filled only once during creation.
func GetDirChildrenNames ¶
GetDirChildrenNames returns all child directories of the provided one
func GetImageHost ¶
GetImageHost retrieves the host name of the container imager registry for the provided image
func IsContainerCreated ¶
IsContainerCreated returns if container is in the created state or not
func IsContainerDead ¶
IsContainerDead returns whether the container is in Dead state
func IsContainerNetworkBridge ¶
IsContainerNetworkBridge returns true if the network mode is bridge
func IsContainerNetworkHost ¶
IsContainerNetworkHost returns true if the network mode is host
func IsContainerRunningOrPaused ¶
IsContainerRunningOrPaused returns true if the container is running or paused
func IsDirectory ¶
IsDirectory returns true if the given path is a directory
func IsRestartPolicyAlways ¶
func IsRestartPolicyAlways(policy *types.RestartPolicy) bool
IsRestartPolicyAlways checks if the restart policy type is set to always
func IsRestartPolicyNone ¶
func IsRestartPolicyNone(policy *types.RestartPolicy) bool
IsRestartPolicyNone checks if the restart policy type is set to no
func IsRestartPolicyOnFailure ¶
func IsRestartPolicyOnFailure(policy *types.RestartPolicy) bool
IsRestartPolicyOnFailure checks if the restart policy is set to on-failure
func IsRestartPolicyUnlessStopped ¶
func IsRestartPolicyUnlessStopped(policy *types.RestartPolicy) bool
IsRestartPolicyUnlessStopped checks if the restart policy is set to unless-stopped
func RemoveChildren ¶
RemoveChildren removes all children of a given directory
Returns [], nil if everything went OK Returns nil, error if the error happened before or during the retrieval of the children. For example the path did not exist was locked or something else similar. If an error occurs on some or all of the children it will return a []string, error where the list contains the children that where not deleted
func SetContainerStatusCreated ¶
SetContainerStatusCreated sets the container state to created updating all required fields and flags
func SetContainerStatusDead ¶
SetContainerStatusDead sets the container state to dead updating all required fields and flags
func SetContainerStatusExited ¶
SetContainerStatusExited sets the container state to exited updating all required fields and flags
func SetContainerStatusPaused ¶
SetContainerStatusPaused sets the container state to paused updating all required fields and flags
func SetContainerStatusRunning ¶
SetContainerStatusRunning sets the container state to running updating all required fields and flags
func SetContainerStatusStopped ¶
SetContainerStatusStopped sets the container state to stopped updating all required fields and flags
func SetContainerStatusUnpaused ¶
SetContainerStatusUnpaused is added for completion as the container's state is actually running
func SizeRecalculate ¶
SizeRecalculate takes size string representation and returns a new recalculated size string representation
func SizeToBytes ¶
SizeToBytes converts size string representation to a number
func ToSignal ¶
ToSignal parses a string to syscall.Signal. Signals are accepted as both number and name: SIGKILL or 9. Returns the syscall.Signal for the provided number or name. Returns 0 if a signal with the provided name is not found.
func ValidateContainer ¶
ValidateContainer validats all container properties
func ValidateDeviceMapping ¶
func ValidateDeviceMapping(devMapping types.DeviceMapping) error
ValidateDeviceMapping validates the mapping between the path on the host and the path in the container and checks if the cgroup permissions are set
func ValidateDeviceMappings ¶
func ValidateDeviceMappings(devMappings []types.DeviceMapping) error
ValidateDeviceMappings validates all device mappings
func ValidateHostConfig ¶
func ValidateHostConfig(hostConfig *types.HostConfig) error
ValidateHostConfig validates the container host configuration
func ValidateImage ¶
ValidateImage validates the container image
func ValidateLogConfig ¶
func ValidateLogConfig(logCfg *types.LogConfiguration) error
ValidateLogConfig validates the log configuration
func ValidateMountPoint ¶
func ValidateMountPoint(mp types.MountPoint) error
ValidateMountPoint validates the cointainer mount configuration
func ValidateMounts ¶
func ValidateMounts(mounts []types.MountPoint) error
ValidateMounts validates all the cointainer mount points
func ValidateNetworking ¶
func ValidateNetworking(hostConfig *types.HostConfig) error
ValidateNetworking validates the container networking
func ValidateResources ¶
ValidateResources validates the container resources limitations
func ValidateRestartPolicy ¶
func ValidateRestartPolicy(rsPolicy *types.RestartPolicy) error
ValidateRestartPolicy validates the container restart policy
func ValidateStopOpts ¶
ValidateStopOpts validates stop options. Returns error if timeout is negative or signal is invalid.
Types ¶
type LocksCache ¶
type LocksCache struct {
// contains filtered or unexported fields
}
LocksCache provides cache management for identifiable *sync.RWMutex instances.
func (*LocksCache) GetLock ¶
func (cache *LocksCache) GetLock(key string) *sync.RWMutex
GetLock returns the lock by provided key
func (*LocksCache) RemoveLock ¶
func (cache *LocksCache) RemoveLock(key string)
RemoveLock removes the lock by provided key