proxy

package
v0.0.0-...-beb5f3f Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const TrimmedManifestlist = "trimmedmanifestlist:"

TrimmedManifestlist - key prefix for trimmed manifest

Variables

This section is empty.

Functions

func NewCacheHandlerRegistry

func NewCacheHandlerRegistry(local localInterface) map[string]ManifestCacheHandler

NewCacheHandlerRegistry ...

func SendPullEvent

func SendPullEvent(ctx context.Context, a *artifact.Artifact, tag, operator string)

SendPullEvent send a pull image event

Types

type Controller

type Controller interface {
	// UseLocalBlob check if the blob should use local copy
	UseLocalBlob(ctx context.Context, art lib.ArtifactInfo) bool
	// UseLocalManifest check manifest should use local copy
	UseLocalManifest(ctx context.Context, art lib.ArtifactInfo, remote RemoteInterface) (bool, *ManifestList, error)
	// ProxyBlob proxy the blob request to the remote server, p is the proxy project
	// art is the ArtifactInfo which includes the digest of the blob
	ProxyBlob(ctx context.Context, p *proModels.Project, art lib.ArtifactInfo) (int64, io.ReadCloser, error)
	// ProxyManifest proxy the manifest request to the remote server, p is the proxy project,
	// art is the ArtifactInfo which includes the tag or digest of the manifest
	ProxyManifest(ctx context.Context, art lib.ArtifactInfo, remote RemoteInterface) (distribution.Manifest, error)
	// HeadManifest send manifest head request to the remote server
	HeadManifest(ctx context.Context, art lib.ArtifactInfo, remote RemoteInterface) (bool, *distribution.Descriptor, error)
	// EnsureTag ensure tag for digest
	EnsureTag(ctx context.Context, art lib.ArtifactInfo, tagName string) error
}

Controller defines the operations related with pull through proxy

func ControllerInstance

func ControllerInstance() Controller

ControllerInstance -- Get the proxy controller instance

type ManifestCache

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

ManifestCache default Manifest handler

func (*ManifestCache) CacheContent

func (m *ManifestCache) CacheContent(ctx context.Context, remoteRepo string, man distribution.Manifest, art lib.ArtifactInfo, r RemoteInterface, _ string)

CacheContent ...

type ManifestCacheHandler

type ManifestCacheHandler interface {
	// CacheContent - cache the content of the manifest
	CacheContent(ctx context.Context, remoteRepo string, man distribution.Manifest, art lib.ArtifactInfo, r RemoteInterface, contentType string)
}

ManifestCacheHandler define how to cache manifest content

type ManifestList

type ManifestList struct {
	Content     []byte
	Digest      string
	ContentType string
}

ManifestList ...

type ManifestListCache

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

ManifestListCache handle Manifest list type and index type

func (*ManifestListCache) CacheContent

func (m *ManifestListCache) CacheContent(ctx context.Context, _ string, man distribution.Manifest, art lib.ArtifactInfo, _ RemoteInterface, contentType string)

CacheContent ...

type RemoteInterface

type RemoteInterface interface {
	// BlobReader create a reader for remote blob
	BlobReader(repo, dig string) (int64, io.ReadCloser, error)
	// Manifest get manifest by reference
	Manifest(repo string, ref string) (distribution.Manifest, string, error)
	// ManifestExist checks manifest exist, if exist, return digest
	ManifestExist(repo string, ref string) (bool, *distribution.Descriptor, error)
	// ListTags returns all tags of the repo
	ListTags(repo string) ([]string, error)
}

RemoteInterface defines operations related to remote repository under proxy

func NewRemoteHelper

func NewRemoteHelper(ctx context.Context, regID int64) (RemoteInterface, error)

NewRemoteHelper create a remote interface

Jump to

Keyboard shortcuts

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