Skip to content

Commit

Permalink
fixup: review comments (function names, deprecations)
Browse files Browse the repository at this point in the history
  • Loading branch information
dtrudg committed Sep 27, 2024
1 parent f6e9323 commit 15041b9
Showing 3 changed files with 10 additions and 11 deletions.
7 changes: 5 additions & 2 deletions pkg/sif/index.go
Original file line number Diff line number Diff line change
@@ -18,8 +18,11 @@ import (
var _ v1.ImageIndex = (*imageIndex)(nil)

// ImageIndexFromFileImage is a convenience function which constructs an
// OCIFileImage from a sif.FileImage, and returns its RootIndex as
// a v1.ImageIndex.
// OCIFileImage from a sif.FileImage, and returns its RootIndex as a
// v1.ImageIndex.
//
// Deprecated: Use OCIFileImage.RootIndex instead. ImageIndexFromFileImage will
// be removed in a future version.
func ImageIndexFromFileImage(fi *sif.FileImage) (v1.ImageIndex, error) {
f := &OCIFileImage{fi}

2 changes: 1 addition & 1 deletion pkg/sif/update.go
Original file line number Diff line number Diff line change
@@ -123,7 +123,7 @@ func (f *OCIFileImage) UpdateRootIndex(ii v1.ImageIndex, opts ...UpdateOpt) erro
// Update is a convenience function, for backward compatibility, which calls
// OCIFileImage.UpdateRootIndex against the sif.FileImage fi.
//
// Deprecated: Use OCIFileImage.Update instead.
// Deprecated: Use OCIFileImage.UpdateRootIndex instead.
func Update(fi *sif.FileImage, ii v1.ImageIndex, opts ...UpdateOpt) error {
f, err := FromFileImage(fi)
if err != nil {
12 changes: 4 additions & 8 deletions pkg/sif/write.go
Original file line number Diff line number Diff line change
@@ -101,12 +101,8 @@ func blobFromIndex(ii v1.ImageIndex, digest v1.Hash) (io.ReadCloser, error) {
}

// writeIndex writes an index and all of its child indexes, manifests and blobs
// to f. This function does not update the RootIndex.
func (f *OCIFileImage) writeIndex(ii v1.ImageIndex) error {
return f.writeIndexorRootIndex(ii, false)
}

func (f *OCIFileImage) writeIndexorRootIndex(ii v1.ImageIndex, rootIndex bool) error {
// to f.
func (f *OCIFileImage) writeIndex(ii v1.ImageIndex, rootIndex bool) error {
index, err := ii.IndexManifest()
if err != nil {
return err
@@ -121,7 +117,7 @@ func (f *OCIFileImage) writeIndexorRootIndex(ii v1.ImageIndex, rootIndex bool) e
return err
}

if err := f.writeIndex(ii); err != nil {
if err := f.writeIndex(ii, false); err != nil {
return err
}

@@ -266,5 +262,5 @@ func Write(path string, ii v1.ImageIndex, opts ...WriteOpt) error {

f := OCIFileImage{fi}

return f.writeIndexorRootIndex(ii, true)
return f.writeIndex(ii, true)
}

0 comments on commit 15041b9

Please sign in to comment.