Skip to content

Commit

Permalink
resolved comments
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaoxuan Wang <[email protected]>
  • Loading branch information
wangxiaoxuan273 committed Jan 18, 2024
1 parent 4dc7550 commit 825c955
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions content/oci/oci.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ func (s *Store) GC(ctx context.Context) error {
defer s.sync.Unlock()

// get reachable nodes by reloading the index
err := s.GCIndex(ctx)
err := s.gcIndex(ctx)
if err != nil {
return fmt.Errorf("unable to reload index: %w", err)
}
Expand Down Expand Up @@ -512,8 +512,8 @@ func (s *Store) GC(ctx context.Context) error {
return nil
}

// GCIndex reloads the index and updates metadata.
func (s *Store) GCIndex(ctx context.Context) error {
// gcIndex reloads the index and updates metadata.
func (s *Store) gcIndex(ctx context.Context) error {
refMap := s.tagResolver.Map()
s.tagResolver = resolver.NewMemory()
s.graph = graph.NewMemory()
Expand Down
16 changes: 8 additions & 8 deletions internal/resolver/memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ func TestMemoryNotFound(t *testing.T) {
}

func TestTagSet(t *testing.T) {
foo := "foo"
bar := "bar"
refFoo := "foo"
refBar := "bar"

s := NewMemory()
ctx := context.Background()
Expand All @@ -91,16 +91,16 @@ func TestTagSet(t *testing.T) {
Size: int64(len(content)),
}

s.Tag(ctx, desc, foo)
s.Tag(ctx, desc, bar)
s.Tag(ctx, desc, refFoo)
s.Tag(ctx, desc, refBar)

tagSet := s.TagSet(desc)

if !tagSet.Contains(foo) {
t.Fatalf("tagSet should contain %s", foo)
if !tagSet.Contains(refFoo) {
t.Fatalf("tagSet should contain %s", refFoo)
}
if !tagSet.Contains(bar) {
t.Fatalf("tagSet should contain %s", foo)
if !tagSet.Contains(refBar) {
t.Fatalf("tagSet should contain %s", refFoo)
}
if len(tagSet) != 2 {
t.Fatalf("expect size = %d, got %d", 2, len(tagSet))
Expand Down

0 comments on commit 825c955

Please sign in to comment.