Skip to content

Commit

Permalink
resolved some comments
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaoxuan Wang <[email protected]>
  • Loading branch information
wangxiaoxuan273 committed Dec 27, 2023
1 parent 64e7ba8 commit 1212ffa
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions content/oci/oci.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,14 +409,18 @@ func (s *Store) GC(ctx context.Context) error {
s.sync.RLock()
defer s.sync.RUnlock()

rootpath := filepath.Join(s.root, "blobs", "sha256")
rootpath := filepath.Join(s.root, "blobs")
return filepath.Walk(rootpath, func(path string, info fs.FileInfo, err error) error {
if err != nil {
return err
}
// skip the working directory
// skip the directories
if !info.IsDir() {
blobDigest := digest.NewDigestFromEncoded("sha256", info.Name())
alg := filepath.Base(filepath.Dir(path))
blobDigest, err := digest.Parse(fmt.Sprintf("%s:%s", alg, info.Name()))
if err != nil {
return err
}
exists, desc := s.graph.ExistsInStore(blobDigest)
if !exists {
// remove the blob from storage if it does not exist in Store
Expand Down

0 comments on commit 1212ffa

Please sign in to comment.