MCPcopy Index your code
hub / github.com/containerd/containerd / Diff

Method Diff

plugins/services/diff/local.go:139–175  ·  view source on GitHub ↗
(ctx context.Context, dr *diffapi.DiffRequest, _ ...grpc.CallOption)

Source from the content-addressed store, hash-verified

137}
138
139func (l *local) Diff(ctx context.Context, dr *diffapi.DiffRequest, _ ...grpc.CallOption) (*diffapi.DiffResponse, error) {
140 var (
141 ocidesc ocispec.Descriptor
142 err error
143 aMounts = mount.FromProto(dr.Left)
144 bMounts = mount.FromProto(dr.Right)
145 )
146
147 var opts []diff.Opt
148 if dr.MediaType != "" {
149 opts = append(opts, diff.WithMediaType(dr.MediaType))
150 }
151 if dr.Ref != "" {
152 opts = append(opts, diff.WithReference(dr.Ref))
153 }
154 if dr.Labels != nil {
155 opts = append(opts, diff.WithLabels(dr.Labels))
156 }
157 if dr.SourceDateEpoch != nil {
158 tm := dr.SourceDateEpoch.AsTime()
159 opts = append(opts, diff.WithSourceDateEpoch(&tm))
160 }
161
162 for _, d := range l.differs {
163 ocidesc, err = d.Compare(ctx, aMounts, bMounts, opts...)
164 if !errdefs.IsNotImplemented(err) {
165 break
166 }
167 }
168 if err != nil {
169 return nil, errgrpc.ToGRPC(err)
170 }
171
172 return &diffapi.DiffResponse{
173 Diff: oci.DescriptorToProto(ocidesc),
174 }, nil
175}

Callers

nothing calls this directly

Calls 7

FromProtoFunction · 0.92
WithMediaTypeFunction · 0.92
WithReferenceFunction · 0.92
WithLabelsFunction · 0.92
WithSourceDateEpochFunction · 0.92
DescriptorToProtoFunction · 0.92
CompareMethod · 0.65

Tested by

no test coverage detected