image

package
v0.0.0-...-a644469 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: GPL-3.0 Imports: 22 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Available

func Available(image string, opt ...crane.Option) bool

Available checks if the image is available in the remote endpoint.

func CreateTar

func CreateTar(srctar, dstimageTar, imagename, architecture, OS string) error

CreateTar a imagetarball from a standard tarball

func Extract

func Extract(ctx types.Context, img v1.Image, filter func(h *tar.Header) (bool, error), opts ...containerdarchive.ApplyOpt) (int64, string, error)

Extract is just syntax sugar around ExtractReader. It extracts an image into a dir

func ExtractDeltaAdditionsFiles

func ExtractDeltaAdditionsFiles(
	ctx types.Context,
	srcimg v1.Image,
	includes []string, excludes []string,
) (func(h *tar.Header) (bool, error), error)

ExtractDeltaAdditionsFromImages is a filter that takes two images an includes and an excludes list. It computes the delta between the images considering the added files only, and applies a filter on them based on the regexes in the lists.

func ExtractFiles

func ExtractFiles(
	ctx types.Context,
	prefixPath string,
	includes []string, excludes []string,
) func(h *tar.Header) (bool, error)

ExtractFiles returns a filter that extracts files from the given path (if not empty) It then filters files by an include and exclude list. The list can be regexes

func ExtractReader

func ExtractReader(ctx types.Context, reader io.ReadCloser, output string, filter func(h *tar.Header) (bool, error), opts ...containerdarchive.ApplyOpt) (int64, string, error)

ExtractReader perform the extracting action over the io.ReadCloser it extracts the files over output. Accepts a filter as an option and additional containerd Options

func ExtractTo

func ExtractTo(ctx types.Context, img v1.Image, output string, filter func(h *tar.Header) (bool, error), opts ...containerdarchive.ApplyOpt) (int64, string, error)

ExtractTo is just syntax sugar around ExtractReader

Types

type Cache

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

Cache represents a key-value store which is capable to upgrade to disk when it reaches a pre-defined threshold.

func NewCache

func NewCache(path string, maxmemorySize, maxItemsize int) *Cache

New creates a new key-value cache the cache acts in memory as long as the maxItemsize is not reached. Once the threshold is met the cache is offloaded to disk automatically, with a buffer of maxmemorySize into memory.

func (*Cache) All

func (c *Cache) All(fn func(CacheResult))

Iterates over cache by key

func (*Cache) Clean

func (c *Cache) Clean()

Clean the cache

func (*Cache) Count

func (c *Cache) Count() int

Count returns the items in the cache. If it's a disk cache might be an expensive call.

func (*Cache) Get

func (c *Cache) Get(key string) (value string, found bool)

Get attempts to retrieve a value for a key

func (*Cache) Set

func (c *Cache) Set(key, value string) error

Set updates or inserts a new value

func (*Cache) SetValue

func (c *Cache) SetValue(key string, value interface{}) error

SetValue updates or inserts a new value by marshalling it into JSON.

type CacheResult

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

CacheResult represent the key value result when iterating over the cache

func (CacheResult) Key

func (c CacheResult) Key() string

Key returns the cache result key

func (CacheResult) Unmarshal

func (c CacheResult) Unmarshal(i interface{}) error

Unmarshal the result into the interface. Use it to retrieve data set with SetValue

func (CacheResult) Value

func (c CacheResult) Value() string

Value returns the underlying value

type ImageDiff

type ImageDiff struct {
	Additions []ImageDiffNode `json:"Adds"`
	Deletions []ImageDiffNode `json:"Dels"`
	Changes   []ImageDiffNode `json:"Mods"`
}

func Delta

func Delta(srcimg, dstimg v1.Image) (res ImageDiff, err error)

type ImageDiffNode

type ImageDiffNode struct {
	Name string `json:"Name"`
	Size int    `json:"Size"`
}

Jump to

Keyboard shortcuts

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