Skip to content

Commit

Permalink
content: Add InfoReaderProvider
Browse files Browse the repository at this point in the history
Create interface that combines both content.InfoProvider and
content.Provider in `content` package.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit 8235665)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
  • Loading branch information
vvoland committed Jan 19, 2024
1 parent 71909c1 commit 8364779
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 6 additions & 0 deletions content/content.go
Expand Up @@ -108,6 +108,12 @@ type Status struct {
// WalkFunc defines the callback for a blob walk.
type WalkFunc func(Info) error

// InfoReaderProvider provides both info and reader for the specific content.
type InfoReaderProvider interface {
InfoProvider
Provider
}

// InfoProvider provides info for content inspection.
type InfoProvider interface {
// Info will return metadata about content available in the content store.
Expand Down
8 changes: 1 addition & 7 deletions images/archive/exporter.go
Expand Up @@ -148,7 +148,7 @@ func WithSkipNonDistributableBlobs() ExportOpt {
// The manifest itself is excluded only if it's not present locally.
// This allows to export multi-platform images if not all platforms are present
// while still persisting the multi-platform index.
func WithSkipMissing(store ContentProvider) ExportOpt {
func WithSkipMissing(store content.InfoReaderProvider) ExportOpt {
return func(ctx context.Context, o *exportOptions) error {
o.blobRecordOptions.childrenHandler = images.HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) (subdescs []ocispec.Descriptor, err error) {
children, err := images.Children(ctx, store, desc)
Expand Down Expand Up @@ -211,12 +211,6 @@ func copySourceLabels(ctx context.Context, infoProvider content.InfoProvider, de
return desc, nil
}

// ContentProvider provides both content and info about content
type ContentProvider interface {
content.Provider
content.InfoProvider
}

// Export implements Exporter.
func Export(ctx context.Context, store content.Provider, writer io.Writer, opts ...ExportOpt) error {
var eo exportOptions
Expand Down

0 comments on commit 8364779

Please sign in to comment.