Skip to content

Commit bba1d78

Browse files
committed
feat: add FindManifests
1 parent 953f11d commit bba1d78

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pkg/sif/sif.go

+13
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
"io"
99

1010
v1 "github.com/google/go-containerregistry/pkg/v1"
11+
"github.com/google/go-containerregistry/pkg/v1/match"
12+
"github.com/google/go-containerregistry/pkg/v1/partial"
1113
"github.com/sylabs/sif/v2/pkg/sif"
1214
)
1315

@@ -53,3 +55,14 @@ func (f *OCIFileImage) Offset(h v1.Hash) (int64, error) {
5355

5456
return d.Offset(), nil
5557
}
58+
59+
// FindManifests finds the manifests stored in f that are selected by m. If m is nil, all manifests
60+
// are selected.
61+
func (f *OCIFileImage) FindManifests(m match.Matcher, _ ...Option) ([]v1.Descriptor, error) {
62+
ri, err := f.RootIndex()
63+
if err != nil {
64+
return nil, err
65+
}
66+
67+
return partial.FindManifests(ri, matchAllIfNil(m))
68+
}

0 commit comments

Comments
 (0)