mirror of
https://github.com/project-zot/zot.git
synced 2026-06-19 22:27:58 +08:00
Catalog content discovery (#2782)
fix(sync): use pagination when querying remote catalog feat(api): added /v2/_catalog pagination, fixes #2715 Signed-off-by: Eusebiu Petu <petu.eusebiu@gmail.com>
This commit is contained in:
@@ -9,19 +9,21 @@ import (
|
||||
ispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
|
||||
"zotregistry.dev/zot/pkg/scheduler"
|
||||
storageTypes "zotregistry.dev/zot/pkg/storage/types"
|
||||
)
|
||||
|
||||
type MockedImageStore struct {
|
||||
NameFn func() string
|
||||
DirExistsFn func(d string) bool
|
||||
RootDirFn func() string
|
||||
InitRepoFn func(name string) error
|
||||
ValidateRepoFn func(name string) (bool, error)
|
||||
GetRepositoriesFn func() ([]string, error)
|
||||
GetNextRepositoryFn func(repo string) (string, error)
|
||||
GetImageTagsFn func(repo string) ([]string, error)
|
||||
GetImageManifestFn func(repo string, reference string) ([]byte, godigest.Digest, string, error)
|
||||
PutImageManifestFn func(repo string, reference string, mediaType string, body []byte) (godigest.Digest,
|
||||
NameFn func() string
|
||||
DirExistsFn func(d string) bool
|
||||
RootDirFn func() string
|
||||
InitRepoFn func(name string) error
|
||||
ValidateRepoFn func(name string) (bool, error)
|
||||
GetRepositoriesFn func() ([]string, error)
|
||||
GetNextRepositoryFn func(repo string) (string, error)
|
||||
GetNextRepositoriesFn func(lastRepo string, maxEntries int, fn storageTypes.FilterRepoFunc) ([]string, bool, error)
|
||||
GetImageTagsFn func(repo string) ([]string, error)
|
||||
GetImageManifestFn func(repo string, reference string) ([]byte, godigest.Digest, string, error)
|
||||
PutImageManifestFn func(repo string, reference string, mediaType string, body []byte) (godigest.Digest,
|
||||
godigest.Digest, error)
|
||||
DeleteImageManifestFn func(repo string, reference string, detectCollision bool) error
|
||||
BlobUploadPathFn func(repo string, uuid string) string
|
||||
@@ -138,6 +140,16 @@ func (is MockedImageStore) GetNextRepository(repo string) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (is MockedImageStore) GetNextRepositories(lastRepo string, maxEntries int,
|
||||
fn storageTypes.FilterRepoFunc,
|
||||
) ([]string, bool, error) {
|
||||
if is.GetNextRepositoriesFn != nil {
|
||||
return is.GetNextRepositoriesFn(lastRepo, maxEntries, fn)
|
||||
}
|
||||
|
||||
return []string{}, false, nil
|
||||
}
|
||||
|
||||
func (is MockedImageStore) GetImageManifest(repo string, reference string) ([]byte, godigest.Digest, string, error) {
|
||||
if is.GetImageManifestFn != nil {
|
||||
return is.GetImageManifestFn(repo, reference)
|
||||
|
||||
Reference in New Issue
Block a user