Extend Applier's Apply() method with an optional options parameter
Extend the Applier interface's Apply method with an optional options parameter. For the container image encryption we intend to use the options parameter to pass image decryption parameters ('dcparameters'), which are primarily (privatte) keys, in form of a JSON document under the map key '_dcparameters', and pass them to the Applier's Apply() method. This helps us to access decryption keys and start the pipeline with the layer decryption before the layer data are unzipped and untarred. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Signed-off-by: Harshal Patil <harshal.patil@in.ibm.com>
This commit is contained in:
10
diff.go
10
diff.go
@@ -45,9 +45,15 @@ type diffRemote struct {
|
||||
client diffapi.DiffClient
|
||||
}
|
||||
|
||||
func (r *diffRemote) Apply(ctx context.Context, diff ocispec.Descriptor, mounts []mount.Mount) (ocispec.Descriptor, error) {
|
||||
func (r *diffRemote) Apply(ctx context.Context, desc ocispec.Descriptor, mounts []mount.Mount, opts ...diff.ApplyOpt) (ocispec.Descriptor, error) {
|
||||
var config diff.ApplyConfig
|
||||
for _, opt := range opts {
|
||||
if err := opt(&config); err != nil {
|
||||
return ocispec.Descriptor{}, err
|
||||
}
|
||||
}
|
||||
req := &diffapi.ApplyRequest{
|
||||
Diff: fromDescriptor(diff),
|
||||
Diff: fromDescriptor(desc),
|
||||
Mounts: fromMounts(mounts),
|
||||
}
|
||||
resp, err := r.client.Apply(ctx, req)
|
||||
|
Reference in New Issue
Block a user