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:
parent
a10c5fa7ab
commit
8820408d0a
1 changed files with 19 additions and 8 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue