registry

package
v0.0.0-...-1c5d739 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 10 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrImageNotFound = errors.New("registry index: image not found")
View Source
var (
	ErrOpTimeout = errors.New("operation timed out")
)

Functions

func DeleteRegistryImage

func DeleteRegistryImage(conn client.Connection, id string) error

DeleteRegistryImage removes a registry image from the coordinator index.

func DeleteRegistryLibrary

func DeleteRegistryLibrary(conn client.Connection, library string) error

DeleteRegistryLibrary removes all of the leader nodes in the registry library.

func GetImageUUID

func GetImageUUID(conn client.Connection, tag string) (string, error)

GetImageUUID gets an image UUID from the respective tags registry path, given an image tag, ex. "kjasd8912833hddhla/core_5.0:latest"

func GetRegistryImage

func GetRegistryImage(conn client.Connection, id string) (*registry.Image, error)

GetRegistryImage returns the registry image from the coordinator index.

func SetRegistryImage

func SetRegistryImage(conn client.Connection, rImage registry.Image) error

SetRegistryImage inserts a registry image into the coordinator index.

Types

type Registry

type Registry interface {
	SetConnection(conn client.Connection)
	PullImage(cancel <-chan time.Time, image string) error
	ImagePath(image string) (string, error)
	FindImage(rImg *registry.Image) (*dockerclient.Image, error)
	GetAddress() (addr string)
}

Registry performs specific docker actions based on the registry index

type RegistryImageLeader

type RegistryImageLeader struct {
	HostID string
	// contains filtered or unexported fields
}

RegistryImageLeader is the client that can modify the registry index on the coordinator.

func (*RegistryImageLeader) SetVersion

func (node *RegistryImageLeader) SetVersion(version interface{})

SetVersion implements client.Node

func (*RegistryImageLeader) Version

func (node *RegistryImageLeader) Version() interface{}

Version implements client.Node

type RegistryImageNode

type RegistryImageNode struct {
	Image    registry.Image
	PushedAt time.Time
	// contains filtered or unexported fields
}

RegistryImageNode is the registry image as it is written into the coordinator.

func (*RegistryImageNode) SetVersion

func (node *RegistryImageNode) SetVersion(version interface{})

SetVersion implements client.Node

func (*RegistryImageNode) Version

func (node *RegistryImageNode) Version() interface{}

Version implements client.Node

type RegistryIndex

type RegistryIndex interface {
	FindImage(image string) (*registry.Image, error)
	PushImage(image, uuid string, hash string) error
	RemoveImage(image string) error
	SearchLibraryByTag(library string, tag string) ([]registry.Image, error)
}

RegistryIndex is the index for the docker registry on the server

type RegistryIndexClient

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

RegistryIndexClient is the facade client that runs the docker registry server

func NewRegistryIndexClient

func NewRegistryIndexClient(f facade) *RegistryIndexClient

NewRegistryIndexClient creates a new client for the registry index.

func (*RegistryIndexClient) FindImage

func (client *RegistryIndexClient) FindImage(image string) (*registry.Image, error)

FindImage implements RegistryIndex

func (*RegistryIndexClient) PushImage

func (client *RegistryIndexClient) PushImage(image, uuid string, hash string) error

PushImage implements RegistryIndex

func (*RegistryIndexClient) RemoveImage

func (client *RegistryIndexClient) RemoveImage(image string) error

RemoveImage implements RegistryIndex

func (*RegistryIndexClient) SearchLibraryByTag

func (client *RegistryIndexClient) SearchLibraryByTag(library, tag string) ([]registry.Image, error)

SearchLibraryByTag implements RegistryIndex

type RegistryListener

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

RegistryListener is the push listener for the docker registry index.

func NewRegistryListener

func NewRegistryListener(docker docker.Docker, address, hostid string) *RegistryListener

NewRegistryListener instantiates a new registry listener

func (*RegistryListener) Done

func (l *RegistryListener) Done()

Done implements zzk.Listener

func (*RegistryListener) FindImage

func (l *RegistryListener) FindImage(rImg *registry.Image) (*dockerclient.Image, error)

findImage looks for the registry image locally and in the local registry. It firsts checks locally by UUID,

then by repo, tag, and hash, then it checks if the image is already in the registry, and finally it searches by hash

func (*RegistryListener) GetAddress

func (l *RegistryListener) GetAddress() string

Returns docker registry Address (e.g. localhost:5000)

func (*RegistryListener) GetPath

func (l *RegistryListener) GetPath(nodes ...string) string

GetPath implements zzk.Listener

func (*RegistryListener) ImagePath

func (l *RegistryListener) ImagePath(image string) (string, error)

ImagePath returns the proper path to the registry image

func (*RegistryListener) PostProcess

func (l *RegistryListener) PostProcess(_ map[string]struct{})

PostProcess implements zzk.Listener

func (*RegistryListener) PullImage

func (l *RegistryListener) PullImage(cancel <-chan time.Time, image string) error

PullImage waits for an image to be available on the docker registry so it can be pulled (if it does not exist locally).

func (*RegistryListener) Ready

func (l *RegistryListener) Ready() (err error)

Ready implements zzk.Listener

func (*RegistryListener) SetConnection

func (l *RegistryListener) SetConnection(conn client.Connection)

SetConnection implements zzk.Listener

func (*RegistryListener) Spawn

func (l *RegistryListener) Spawn(shutdown <-chan interface{}, id string)

Spawn watches a registry image and will try to push any images that are not saved in the registry.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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