Skip to content

Commit

Permalink
resolve comment
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
  • Loading branch information
wangxiaoxuan273 committed Nov 20, 2023
1 parent 410068d commit fad8ed4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 6 additions & 4 deletions content/oci/oci.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ import (
type Store struct {
// AutoSaveIndex controls if the OCI store will automatically save the index
// file when needed.
// - If AutoSaveIndex is set to true, the OCI store will automatically save the
// changes to `index.json` on Tag() and Delete() calls, and when pushing a manifest.
// - If AutoSaveIndex is set to true, the OCI store will automatically save
// the changes to `index.json` when
// 1. pushing a manifest
// 2. calling Tag() or Delete()
// - If AutoSaveIndex is set to false, it's the caller's responsibility
// to manually call SaveIndex() when needed.
// - Default value: true.
Expand All @@ -61,7 +63,7 @@ type Store struct {
// has the exclusive access to Store if a delete operation is underway. Operations
// such as Fetch, Push use sync.RLock(), while Delete uses sync.Lock().
sync sync.RWMutex
// indexLock ensures that only one process is writing to the index.
// indexLock ensures that only one go-routine is writing to the index.
indexLock sync.Mutex
}

Expand Down Expand Up @@ -141,7 +143,7 @@ func (s *Store) Exists(ctx context.Context, target ocispec.Descriptor) (bool, er

// Delete deletes the content matching the descriptor from the store. Delete may
// fail on certain systems (i.e. NTFS), if there is a process (i.e. an unclosed
// Reader) using `target`.
// Reader) using target.
func (s *Store) Delete(ctx context.Context, target ocispec.Descriptor) error {
s.sync.Lock()
defer s.sync.Unlock()
Expand Down
3 changes: 1 addition & 2 deletions content/oci/oci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2064,8 +2064,7 @@ func TestStore_FetchAndDelete(t *testing.T) {
t.Fatal("error =", err)
}
if !bytes.Equal(got, content) {
fmt.Println(got)
t.Fatal("wrong content")
t.Errorf("Store.Fetch() = %v, want %v", string(got), string(content))
}
rc.Close()

Expand Down

0 comments on commit fad8ed4

Please sign in to comment.