MCPcopy
hub / github.com/containerd/containerd / Compare

Method Compare

core/diff/proxy/differ.go:78–105  ·  view source on GitHub ↗
(ctx context.Context, a, b []mount.Mount, opts ...diff.Opt)

Source from the content-addressed store, hash-verified

76}
77
78func (r *diffRemote) Compare(ctx context.Context, a, b []mount.Mount, opts ...diff.Opt) (ocispec.Descriptor, error) {
79 var config diff.Config
80 for _, opt := range opts {
81 if err := opt(&config); err != nil {
82 return ocispec.Descriptor{}, err
83 }
84 }
85 if tm := epoch.FromContext(ctx); tm != nil && config.SourceDateEpoch == nil {
86 config.SourceDateEpoch = tm
87 }
88 var sourceDateEpoch *timestamppb.Timestamp
89 if config.SourceDateEpoch != nil {
90 sourceDateEpoch = timestamppb.New(*config.SourceDateEpoch)
91 }
92 req := &diffapi.DiffRequest{
93 Left: mount.ToProto(a),
94 Right: mount.ToProto(b),
95 MediaType: config.MediaType,
96 Ref: config.Reference,
97 Labels: config.Labels,
98 SourceDateEpoch: sourceDateEpoch,
99 }
100 resp, err := r.client.Diff(ctx, req)
101 if err != nil {
102 return ocispec.Descriptor{}, errgrpc.ToNative(err)
103 }
104 return oci.DescriptorFromProto(resp.Diff), nil
105}

Callers

nothing calls this directly

Calls 4

FromContextFunction · 0.92
ToProtoFunction · 0.92
DescriptorFromProtoFunction · 0.92
DiffMethod · 0.65

Tested by

no test coverage detected