package shutdown

import "github.com/containerd/containerd/pkg/shutdown"

Index

Variables

var ErrShutdown = errors.New("shutdown")

ErrShutdown is the error condition when a context has been fully shutdown

Types

type Service

type Service interface {
	// Shutdown initiates shutdown
	Shutdown()
	// RegisterCallback registers functions to be called on shutdown and before
	// the shutdown channel is closed. A callback error will propagate to the
	// context error
	RegisterCallback(func(context.Context) error)
}

Service is used to facilitate shutdown by through callback registration and shutdown initiation

func WithShutdown

func WithShutdown(ctx context.Context) (context.Context, Service)

WithShutdown returns a context which is similar to a cancel context, but with callbacks which can propagate to the context error. Unlike a cancel context, the shutdown context cannot be canceled from the parent context. However, future child contexes will be canceled upon shutdown.

Source Files

shutdown.go

Version
v1.6.23
Published
Aug 14, 2023
Platform
js/wasm
Imports
5 packages
Last checked
3 minutes ago

Tools for package owners.