adapter

package
v0.0.0-...-591d4ee Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: Apache-2.0 Imports: 6 Imported by: 400

Documentation

Index

Constants

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

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 ListAdapterInfos

func ListAdapterInfos() map[model.RegistryType]*model.AdapterPattern

ListAdapterInfos list the adapter infos

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 ArtifactRegistry

type ArtifactRegistry interface {
	FetchArtifacts(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) (string, error)
	DeleteManifest(repository, reference string) error // the "reference" can be "tag" or "digest", the function needs to handle both
	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
	DeleteTag(repository, tag string) error
}

ArtifactRegistry defines the capabilities that an artifact registry should have

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 Factory

type Factory interface {
	Create(*model.Registry) (Adapter, error)
	AdapterPattern() *model.AdapterPattern
}

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

Directories

Path Synopsis
v1
v2

Jump to

Keyboard shortcuts

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