(ctx context.Context, dr *diffapi.DiffRequest, _ ...grpc.CallOption)
| 137 | } |
| 138 | |
| 139 | func (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 | } |
nothing calls this directly
no test coverage detected