fix(loadrepodb): statistics are now preserved after reloading zot (#1289)

- before, the download count for a manifest and repo star count were lost after reload

- now we are keeping these values when we reset the repo-meta structure

Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com>
This commit is contained in:
LaurentiuNiculae
2023-03-23 20:08:11 +02:00
committed by GitHub
parent 906f8ce621
commit 91e14bee00
7 changed files with 172 additions and 281 deletions
+10
View File
@@ -25,6 +25,8 @@ type RepoDBMock struct {
GetRepoMetaFn func(repo string) (repodb.RepoMetadata, error)
SetRepoMetaFn func(repo string, repoMeta repodb.RepoMetadata) error
GetMultipleRepoMetaFn func(ctx context.Context, filter func(repoMeta repodb.RepoMetadata) bool,
requestedPage repodb.PageInput) ([]repodb.RepoMetadata, error)
@@ -142,6 +144,14 @@ func (sdm RepoDBMock) GetRepoMeta(repo string) (repodb.RepoMetadata, error) {
return repodb.RepoMetadata{}, nil
}
func (sdm RepoDBMock) SetRepoMeta(repo string, repoMeta repodb.RepoMetadata) error {
if sdm.SetRepoMetaFn != nil {
return sdm.SetRepoMetaFn(repo, repoMeta)
}
return nil
}
func (sdm RepoDBMock) GetMultipleRepoMeta(ctx context.Context, filter func(repoMeta repodb.RepoMetadata) bool,
requestedPage repodb.PageInput,
) ([]repodb.RepoMetadata, error) {