Documentation
¶
Index ¶
- Constants
- func GetRemoteRepo(art lib.ArtifactInfo) string
- func NewCacheHandlerRegistry(local localInterface) map[string]ManifestCacheHandler
- func SendPullEvent(ctx context.Context, a *artifact.Artifact, tag, operator string)
- type Controller
- type ManifestCache
- type ManifestCacheHandler
- type ManifestList
- type ManifestListCache
- type Option
- type Options
- type RemoteInterface
Constants ¶
View Source
const TrimmedManifestlist = "trimmedmanifestlist:"
TrimmedManifestlist - key prefix for trimmed manifest
Variables ¶
This section is empty.
Functions ¶
func GetRemoteRepo ¶
func GetRemoteRepo(art lib.ArtifactInfo) string
GetRemoteRepo get the remote repository name, used in proxy cache
func NewCacheHandlerRegistry ¶
func NewCacheHandlerRegistry(local localInterface) map[string]ManifestCacheHandler
NewCacheHandlerRegistry ...
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, p *proModels.Project) (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 ¶
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 Options ¶
type Options struct {
// Speed is the data transfer speed for proxy cache from Harbor to upstream registry, no limit by default.
Speed int32
}
func NewOptions ¶
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, returns digest
ManifestExist(repo string, ref string) (bool, *distribution.Descriptor, error)
// ListTags returns all tags of the repo
ListTags(repo string) ([]string, error)
// ListReferrers returns all referrers
ListReferrers(repo string, digest string, rawQuery string) (*ocispec.Index, map[string][]string, error)
}
RemoteInterface defines operations related to remote repository under proxy
func NewRemoteHelper ¶
NewRemoteHelper create a remote interface
Click to show internal directories.
Click to hide internal directories.