MCPcopy
hub / github.com/containerd/containerd / Update

Method Update

client/task.go:653–679  ·  view source on GitHub ↗
(ctx context.Context, opts ...UpdateTaskOpts)

Source from the content-addressed store, hash-verified

651type UpdateTaskOpts func(context.Context, *Client, *UpdateTaskInfo) error
652
653func (t *task) Update(ctx context.Context, opts ...UpdateTaskOpts) error {
654 ctx, span := tracing.StartSpan(ctx, "task.Update",
655 tracing.WithAttribute("task.id", t.ID()),
656 )
657 defer span.End()
658 request := &tasks.UpdateTaskRequest{
659 ContainerID: t.id,
660 }
661 var i UpdateTaskInfo
662 for _, o := range opts {
663 if err := o(ctx, t.client, &i); err != nil {
664 return err
665 }
666 }
667 if i.Resources != nil {
668 r, err := typeurl.MarshalAny(i.Resources)
669 if err != nil {
670 return err
671 }
672 request.Resources = typeurl.MarshalProto(r)
673 }
674 if i.Annotations != nil {
675 request.Annotations = i.Annotations
676 }
677 _, err := t.client.TaskService().Update(ctx, request)
678 return errgrpc.ToNative(err)
679}
680
681func (t *task) LoadProcess(ctx context.Context, id string, ioAttach cio.Attach) (Process, error) {
682 if id == t.id && ioAttach == nil {

Callers

nothing calls this directly

Calls 7

IDMethod · 0.95
StartSpanFunction · 0.92
WithAttributeFunction · 0.92
EndMethod · 0.80
TaskServiceMethod · 0.80
MarshalAnyMethod · 0.65
UpdateMethod · 0.65

Tested by

no test coverage detected