containers

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrContainerNotFound = errors.New("container not found")
)

Functions

This section is empty.

Types

type Client

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

Client is generic container client.

func NewClient

func NewClient(log *logging.Logger, cgroupClient *cgroup.Client, containerdSock string) (*Client, error)

func (*Client) AddContainerByID

func (c *Client) AddContainerByID(ctx context.Context, containerID string) (cont *Container, rerrr error)

func (*Client) CleanupCgroup

func (c *Client) CleanupCgroup(cgroup uint64)

func (*Client) GetCgroupsInNamespace

func (c *Client) GetCgroupsInNamespace(namespace string) []uint64

func (*Client) GetContainerForCgroup

func (c *Client) GetContainerForCgroup(ctx context.Context, cgroup uint64) (*Container, error)

func (*Client) Init

func (c *Client) Init(ctx context.Context) error

func (*Client) ListContainers

func (c *Client) ListContainers() []*Container

func (*Client) LookupContainerForCgroupInCache added in v1.1.0

func (c *Client) LookupContainerForCgroupInCache(cgroup uint64) (*Container, bool, error)

func (*Client) RegisterContainerCreatedListener

func (c *Client) RegisterContainerCreatedListener(l ContainerCreatedListener)

func (*Client) RegisterContainerDeletedListener

func (c *Client) RegisterContainerDeletedListener(l ContainerDeletedListener)

type Container

type Container struct {
	ID           string
	Name         string
	CgroupID     uint64
	PodNamespace string
	PodUID       string
	PodName      string
	Cgroup       *cgroup.Cgroup
	PIDs         []uint32
	Err          error
}

type ContainerCreatedListener

type ContainerCreatedListener func(c *Container)

type ContainerDeletedListener

type ContainerDeletedListener func(c *Container)

Jump to

Keyboard shortcuts

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