MCPcopy
hub / github.com/containerd/containerd / Apply

Method Apply

core/diff/proxy/differ.go:47–76  ·  view source on GitHub ↗
(ctx context.Context, desc ocispec.Descriptor, mounts []mount.Mount, opts ...diff.ApplyOpt)

Source from the content-addressed store, hash-verified

45}
46
47func (r *diffRemote) Apply(ctx context.Context, desc ocispec.Descriptor, mounts []mount.Mount, opts ...diff.ApplyOpt) (ocispec.Descriptor, error) {
48 var config diff.ApplyConfig
49 for _, opt := range opts {
50 if err := opt(ctx, desc, &config); err != nil {
51 return ocispec.Descriptor{}, err
52 }
53 }
54
55 payloads := make(map[string]*ptypes.Any)
56 for k, v := range config.ProcessorPayloads {
57 payloads[k] = typeurl.MarshalProto(v)
58 }
59 if config.Progress != nil {
60 config.Progress(0)
61 }
62 req := &diffapi.ApplyRequest{
63 Diff: oci.DescriptorToProto(desc),
64 Mounts: mount.ToProto(mounts),
65 Payloads: payloads,
66 SyncFs: config.SyncFs,
67 }
68 resp, err := r.client.Apply(ctx, req)
69 if err != nil {
70 return ocispec.Descriptor{}, errgrpc.ToNative(err)
71 }
72 if config.Progress != nil {
73 config.Progress(desc.Size)
74 }
75 return oci.DescriptorFromProto(resp.Applied), nil
76}
77
78func (r *diffRemote) Compare(ctx context.Context, a, b []mount.Mount, opts ...diff.Opt) (ocispec.Descriptor, error) {
79 var config diff.Config

Callers

nothing calls this directly

Calls 5

DescriptorToProtoFunction · 0.92
ToProtoFunction · 0.92
DescriptorFromProtoFunction · 0.92
ProgressMethod · 0.80
ApplyMethod · 0.65

Tested by

no test coverage detected