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

Method Apply

plugins/services/diff/local.go:101–137  ·  view source on GitHub ↗
(ctx context.Context, er *diffapi.ApplyRequest, _ ...grpc.CallOption)

Source from the content-addressed store, hash-verified

99var _ diffapi.DiffClient = &local{}
100
101func (l *local) Apply(ctx context.Context, er *diffapi.ApplyRequest, _ ...grpc.CallOption) (*diffapi.ApplyResponse, error) {
102 var (
103 ocidesc ocispec.Descriptor
104 err error
105 desc = oci.DescriptorFromProto(er.Diff)
106 mounts = mount.FromProto(er.Mounts)
107 )
108
109 var opts []diff.ApplyOpt
110 if er.Payloads != nil {
111 payloads := make(map[string]typeurl.Any)
112 for k, v := range er.Payloads {
113 payloads[k] = v
114 }
115 opts = append(opts, diff.WithPayloads(payloads))
116 }
117 if l.syncfs {
118 er.SyncFs = true
119 }
120 opts = append(opts, diff.WithSyncFs(er.SyncFs))
121
122 for _, differ := range l.differs {
123 ocidesc, err = differ.Apply(ctx, desc, mounts, opts...)
124 if !errdefs.IsNotImplemented(err) {
125 break
126 }
127 }
128
129 if err != nil {
130 return nil, errgrpc.ToGRPC(err)
131 }
132
133 return &diffapi.ApplyResponse{
134 Applied: oci.DescriptorToProto(ocidesc),
135 }, nil
136
137}
138
139func (l *local) Diff(ctx context.Context, dr *diffapi.DiffRequest, _ ...grpc.CallOption) (*diffapi.DiffResponse, error) {
140 var (

Callers

nothing calls this directly

Calls 6

DescriptorFromProtoFunction · 0.92
FromProtoFunction · 0.92
WithPayloadsFunction · 0.92
WithSyncFsFunction · 0.92
DescriptorToProtoFunction · 0.92
ApplyMethod · 0.65

Tested by

no test coverage detected