worker

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWorkerStopped = errors.New("worker stopped")
	ErrWorkerTimeout = errors.New("worker failed to shutdown before timeout")
)

Functions

func Start

func Start(ctx context.Context, services ...Service) error

func Stop

func Stop(ctx context.Context, services ...Service) error

Types

type RunFunc

type RunFunc func(context.Context) error

type Service

type Service interface {
	// Start launches the routine's Run method on a new goroutine.
	Start(context.Context) error
	// Stop cancels the previously started goroutine.
	Stop(context.Context) error
}

func NewService

func NewService(run RunFunc) Service

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL