Skip to content

Commit 60cbbe0

Browse files
committed
Add image.copy.digestOptions
for now, purely to let us internally work on implementing digest choice / conversions; there is no way for a caller to set it. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
1 parent a5aae3f commit 60cbbe0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

image/copy/copy.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/sirupsen/logrus"
1515
"go.podman.io/image/v5/docker/reference"
1616
internalblobinfocache "go.podman.io/image/v5/internal/blobinfocache"
17+
"go.podman.io/image/v5/internal/digests"
1718
"go.podman.io/image/v5/internal/image"
1819
"go.podman.io/image/v5/internal/imagedestination"
1920
"go.podman.io/image/v5/internal/imagesource"
@@ -155,6 +156,15 @@ type Options struct {
155156
// In oci-archive: destinations, this will set the create/mod/access timestamps in each tar entry
156157
// (but not a timestamp of the created archive file).
157158
DestinationTimestamp *time.Time
159+
160+
// FIXME:
161+
// - this reference to an internal type is unusable from the outside even if we made the field public
162+
// - what is the actual semantics? Right now it is probably “choices to use when writing to the destination”, TBD
163+
// - anyway do we want to expose _all_ of the digests.Options tunables, or fewer?
164+
// - … do we want to expose _more_ granularity than that?
165+
// - (“must have at least sha512 integrity when reading”, what does “at least” mean for random pairs of algorithms?)
166+
// - should some of this be in config files, maybe ever per-registry?
167+
digestOptions digests.Options
158168
}
159169

160170
// OptionCompressionVariant allows to supply information about
@@ -200,6 +210,12 @@ func Image(ctx context.Context, policyContext *signature.PolicyContext, destRef,
200210
if options == nil {
201211
options = &Options{}
202212
}
213+
// FIXME: Currently, digestsOptions is not implemented at all, and exists in the codebase
214+
// only to allow gradually building the feature set.
215+
// After c/image/copy consistently implements it, provide a public digest options API of some kind.
216+
optionsCopy := *options
217+
optionsCopy.digestOptions = digests.CanonicalDefault()
218+
options = &optionsCopy
203219

204220
if err := validateImageListSelection(options.ImageListSelection); err != nil {
205221
return nil, err

0 commit comments

Comments
 (0)