containerwalker

package
v1.7.7 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 6 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerWalker

type ContainerWalker struct {
	Client  *containerd.Client
	OnFound OnFound
}

func (*ContainerWalker) Walk

func (w *ContainerWalker) Walk(ctx context.Context, req string) (int, error)

Walk walks containers and calls w.OnFound . Req is name, short ID, or long ID. Returns the number of the found entries.

func (*ContainerWalker) WalkAll added in v1.2.1

func (w *ContainerWalker) WalkAll(ctx context.Context, reqs []string, forceAll bool) error

WalkAll calls `Walk` for each req in `reqs`.

It can be used when the matchCount is not important (e.g., only care if there is any error or if matchCount == 0 (not found error) when walking all reqs). If `forceAll`, it calls `Walk` on every req and return all errors joined by `\n`. If not `forceAll`, it returns the first error encountered while calling `Walk`.

type Found

type Found struct {
	Container  containerd.Container
	Req        string // The raw request string. name, short ID, or long ID.
	MatchIndex int    // Begins with 0, up to MatchCount - 1.
	MatchCount int    // 1 on exact match. > 1 on ambiguous match. Never be <= 0.
}

type OnFound

type OnFound func(ctx context.Context, found Found) error

Jump to

Keyboard shortcuts

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