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

Method Stop

plugins/sandbox/controller.go:221–247  ·  view source on GitHub ↗
(ctx context.Context, sandboxID string, opts ...sandbox.StopOpt)

Source from the content-addressed store, hash-verified

219}
220
221func (c *controllerLocal) Stop(ctx context.Context, sandboxID string, opts ...sandbox.StopOpt) error {
222 var soptions sandbox.StopOptions
223 for _, opt := range opts {
224 opt(&soptions)
225 }
226 req := &runtimeAPI.StopSandboxRequest{SandboxID: sandboxID}
227 if soptions.Timeout != nil {
228 req.TimeoutSecs = uint32(soptions.Timeout.Seconds())
229 }
230
231 svc, err := c.getSandbox(ctx, sandboxID)
232 if errdefs.IsNotFound(err) {
233 return nil
234 }
235 if err != nil {
236 return err
237 }
238
239 if _, err := svc.StopSandbox(ctx, req); err != nil {
240 err = errgrpc.ToNative(err)
241 if !errdefs.IsNotFound(err) && !errdefs.IsUnavailable(err) {
242 return fmt.Errorf("failed to stop sandbox: %w", err)
243 }
244 }
245
246 return nil
247}
248
249func (c *controllerLocal) Shutdown(ctx context.Context, sandboxID string) error {
250 svc, err := c.getSandbox(ctx, sandboxID)

Callers

nothing calls this directly

Calls 2

getSandboxMethod · 0.95
StopSandboxMethod · 0.65

Tested by

no test coverage detected