cr

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Default = func() ContainerRegistry {
	crs := []ContainerRegistry{}

	c, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
	if err == nil {
		if _, err = c.Ping(context.Background()); err == nil {
			crs = append(crs, &Daemon{c})
		}
	}

	return Coalesce(append(crs, new(Remote)))
}()

Functions

func Pull

func Pull(ctx context.Context, ref string) (pkg.Image, error)

func Push

func Push(ctx context.Context, ref string, image pkg.Image) error

Types

type Coalesce

type Coalesce []ContainerRegistry

func (Coalesce) Pull

func (c Coalesce) Pull(ctx context.Context, ref string) (pkg.Image, error)

func (Coalesce) Push

func (c Coalesce) Push(ctx context.Context, ref string, image pkg.Image) error

type ContainerRegistry

type ContainerRegistry interface {
	Pull(context.Context, string) (pkg.Image, error)
	Push(context.Context, string, pkg.Image) error
}

type Daemon

type Daemon struct {
	DaemonClient
}

func (*Daemon) Pull

func (cr *Daemon) Pull(ctx context.Context, ref string) (pkg.Image, error)

func (*Daemon) Push

func (cr *Daemon) Push(ctx context.Context, ref string, image pkg.Image) error

type DaemonClient

type DaemonClient interface {
	daemon.Client
	ImageInspectWithRaw(context.Context, string) (types.ImageInspect, []byte, error)
	ImagePull(context.Context, string, types.ImagePullOptions) (io.ReadCloser, error)
}

type Remote

type Remote struct{}

func (*Remote) Pull

func (cr *Remote) Pull(ctx context.Context, ref string) (pkg.Image, error)

func (*Remote) Push

func (cr *Remote) Push(ctx context.Context, ref string, image pkg.Image) error

Jump to

Keyboard shortcuts

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