adapter

package
v1.8.3-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserAgentReplication = "harbor-replication-service"
)

const definition

Variables

This section is empty.

Functions

func HasFactory

func HasFactory(t model.RegistryType) bool

HasFactory checks whether there is given type adapter factory

func ListRegisteredAdapterTypes

func ListRegisteredAdapterTypes() []model.RegistryType

ListRegisteredAdapterTypes lists the registered Adapter type

func RegisterFactory

func RegisterFactory(t model.RegistryType, factory Factory) error

RegisterFactory registers one adapter factory to the registry

Types

type Adapter

type Adapter interface {
	// Info return the information of this adapter
	Info() (*model.RegistryInfo, error)
	// PrepareForPush does the prepare work that needed for pushing/uploading the resources
	// eg: create the namespace or repository
	PrepareForPush([]*model.Resource) error
	// HealthCheck checks health status of registry
	HealthCheck() (model.HealthStatus, error)
}

Adapter interface defines the capabilities of registry

type ChartRegistry

type ChartRegistry interface {
	FetchCharts(filters []*model.Filter) ([]*model.Resource, error)
	ChartExist(name, version string) (bool, error)
	DownloadChart(name, version string) (io.ReadCloser, error)
	UploadChart(name, version string, chart io.Reader) error
	DeleteChart(name, version string) error
}

ChartRegistry defines the capabilities that a chart registry should have

type DefaultImageRegistry

type DefaultImageRegistry struct {
	sync.RWMutex
	*registry_pkg.Registry
	// contains filtered or unexported fields
}

DefaultImageRegistry provides a default implementation for interface ImageRegistry

func NewDefaultImageRegistry

func NewDefaultImageRegistry(registry *model.Registry) (*DefaultImageRegistry, error)

NewDefaultImageRegistry returns an instance of DefaultImageRegistry

func NewDefaultImageRegistryWithCustomizedAuthorizer

func NewDefaultImageRegistryWithCustomizedAuthorizer(registry *model.Registry, authorizer modifier.Modifier) (*DefaultImageRegistry, error)

NewDefaultImageRegistryWithCustomizedAuthorizer returns an instance of DefaultImageRegistry with the customized authorizer

func (*DefaultImageRegistry) BlobExist

func (d *DefaultImageRegistry) BlobExist(repository, digest string) (bool, error)

BlobExist ...

func (*DefaultImageRegistry) DeleteManifest

func (d *DefaultImageRegistry) DeleteManifest(repository, reference string) error

DeleteManifest ...

func (*DefaultImageRegistry) FetchImages

func (d *DefaultImageRegistry) FetchImages(namespaces []string, filters []*model.Filter) ([]*model.Resource, error)

FetchImages ...

func (*DefaultImageRegistry) HealthCheck

func (d *DefaultImageRegistry) HealthCheck() (model.HealthStatus, error)

HealthCheck checks health status of a registry

func (*DefaultImageRegistry) ListTag

func (d *DefaultImageRegistry) ListTag(repository string) ([]string, error)

ListTag ...

func (*DefaultImageRegistry) ManifestExist

func (d *DefaultImageRegistry) ManifestExist(repository, reference string) (bool, string, error)

ManifestExist ...

func (*DefaultImageRegistry) PullBlob

func (d *DefaultImageRegistry) PullBlob(repository, digest string) (int64, io.ReadCloser, error)

PullBlob ...

func (*DefaultImageRegistry) PullManifest

func (d *DefaultImageRegistry) PullManifest(repository, reference string, accepttedMediaTypes []string) (distribution.Manifest, string, error)

PullManifest ...

func (*DefaultImageRegistry) PushBlob

func (d *DefaultImageRegistry) PushBlob(repository, digest string, size int64, blob io.Reader) error

PushBlob ...

func (*DefaultImageRegistry) PushManifest

func (d *DefaultImageRegistry) PushManifest(repository, reference, mediaType string, payload []byte) error

PushManifest ...

type Factory

type Factory func(*model.Registry) (Adapter, error)

Factory creates a specific Adapter according to the params

func GetFactory

func GetFactory(t model.RegistryType) (Factory, error)

GetFactory gets the adapter factory by the specified name

type ImageRegistry

type ImageRegistry interface {
	FetchImages(filters []*model.Filter) ([]*model.Resource, error)
	ManifestExist(repository, reference string) (exist bool, digest string, err error)
	PullManifest(repository, reference string, accepttedMediaTypes []string) (manifest distribution.Manifest, digest string, err error)
	PushManifest(repository, reference, mediaType string, payload []byte) error
	// the "reference" can be "tag" or "digest", the function needs to handle both
	DeleteManifest(repository, reference string) error
	BlobExist(repository, digest string) (exist bool, err error)
	PullBlob(repository, digest string) (size int64, blob io.ReadCloser, err error)
	PushBlob(repository, digest string, size int64, blob io.Reader) error
}

ImageRegistry defines the capabilities that an image registry should have

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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