0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-16 21:56:37 -05:00

chore: reduce number of spurious log messages produced by GetNextDigestWithBlobPaths (#2727)

Exit early in case of all folders and known non-blob file names.
This avoids the logic for validating digests, and log message generation.

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
This commit is contained in:
Andrei Aaron 2024-10-15 19:29:01 +03:00 committed by GitHub
parent a10c5fa7ab
commit 8820408d0a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1804,17 +1804,28 @@ func (is *ImageStore) GetNextDigestWithBlobPaths(repos []string, lastDigests []g
if fileInfo.IsDir() {
// skip repositories not found in repos
repo := path.Base(fileInfo.Path())
if !zcommon.Contains(repos, repo) && repo != ispec.ImageBlobsDir {
candidateAlgorithm := godigest.Algorithm(repo)
baseName := path.Base(fileInfo.Path())
if zcommon.Contains(repos, baseName) || baseName == ispec.ImageBlobsDir {
return nil
}
candidateAlgorithm := godigest.Algorithm(baseName)
if !candidateAlgorithm.Available() {
return driver.ErrSkipDir
}
}
return nil
}
digestHash := path.Base(fileInfo.Path())
baseName := path.Base(fileInfo.Path())
skippedFiles := []string{ispec.ImageLayoutFile, ispec.ImageIndexFile, "meta.db", "cache.db"}
if zcommon.Contains(skippedFiles, baseName) {
return nil
}
digestHash := baseName
digestAlgorithm := godigest.Algorithm(path.Base(path.Dir(fileInfo.Path())))
blobDigest := godigest.NewDigestFromEncoded(digestAlgorithm, digestHash)