container

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerData

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

ContainerData is a thread-safe map to store container information, indexed by NamespacedName and container name.

func (*ContainerData) GetAllContainerInfo

func (d *ContainerData) GetAllContainerInfo(podNamespace, podName string) (map[string]ContainerInfo, bool)

GetAllContainerInfo retrieves all container information for a specific pod. It returns a map of container names to ContainerInfo and a boolean indicating whether the pod information was found.

func (*ContainerData) GetAllData

func (d *ContainerData) GetAllData() map[types.NamespacedName]map[string]ContainerInfo

GetAllData retrieves all container information for all pods. It returns a map of NamespacedName to a map of container names to ContainerInfo.

func (*ContainerData) GetContainerInfo

func (d *ContainerData) GetContainerInfo(podNamespace, podName, containerName string) (ContainerInfo, bool)

GetContainerInfo retrieves the ContainerInfo for a specific container within a specific pod. It returns the ContainerInfo and a boolean indicating whether the container information was found.

func (*ContainerData) GetOrCreateContainerInfo

func (d *ContainerData) GetOrCreateContainerInfo(podNamespace, podName, containerName string, info ContainerInfo) (ContainerInfo, bool)

GetOrCreateContainerInfo retrieves the ContainerInfo for a specific container within a specific pod, or creates and stores the provided ContainerInfo if it doesn't already exist. It returns the ContainerInfo and a boolean indicating whether the container information was already present.

func (*ContainerData) RemoveAllContainerInfo

func (d *ContainerData) RemoveAllContainerInfo(podNamespace, podName string) (map[string]ContainerInfo, bool)

RemoveAllContainerInfo removes all container information for a specific pod. It returns a map of container names to ContainerInfo and a boolean indicating whether the pod information was found.

func (*ContainerData) SetContainerInfo

func (d *ContainerData) SetContainerInfo(podNamespace, podName, containerName string, info ContainerInfo)

SetContainerInfo sets the ContainerInfo for a specific container within a specific pod.

type ContainerInfo

type ContainerInfo struct {
	ID    string // ID of the container after it was created
	Error error  // Error encountered during container pull or creation
}

ContainerInfo holds information about a Docker container.

func (ContainerInfo) WithError

func (i ContainerInfo) WithError(err error) ContainerInfo

WithError sets the Error of the ContainerInfo and returns the updated ContainerInfo.

func (ContainerInfo) WithID

func (i ContainerInfo) WithID(id string) ContainerInfo

WithID sets the ID of the ContainerInfo and returns the updated ContainerInfo.

Jump to

Keyboard shortcuts

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