sentryworker

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTerminateCalled = fmt.Errorf("terminate called")

Functions

This section is empty.

Types

type SentryWorker

type SentryWorker struct {
	svc.Worker
	// contains filtered or unexported fields
}

func New

func New(maybeWorker svc.Worker) *SentryWorker

Creates a new sentry. Can wrap an existing worker, if nil is provided a nullworker is created.

func (*SentryWorker) Init

func (w *SentryWorker) Init(l *zap.Logger) error

func (*SentryWorker) InitDone

func (w *SentryWorker) InitDone() bool

InitDone checks if Init() has been called

func (*SentryWorker) Run

func (w *SentryWorker) Run() error

func (*SentryWorker) RunIsCalled

func (w *SentryWorker) RunIsCalled() bool

RunIsCalled checks if Run() has been called (but might not have) completed

func (*SentryWorker) RunIsCompleted

func (w *SentryWorker) RunIsCompleted() bool

RunIsCompleted checks if Run() has completed

func (*SentryWorker) Terminate

func (w *SentryWorker) Terminate() error

func (*SentryWorker) TerminatedIsCalled

func (w *SentryWorker) TerminatedIsCalled() bool

TerminatedIsCalled checks if Terminate() has been called (but might not have) completed

func (*SentryWorker) TerminatedIsCompleted

func (w *SentryWorker) TerminatedIsCompleted() bool

TerminatedIsCompleted checks if Terminate() has completed

func (*SentryWorker) WaitForInitDone

func (w *SentryWorker) WaitForInitDone(ctx context.Context) error

WaitForInitDone blocks until Init() is done or the context is canceled. The initialization error is returned (may be nil) or context.Cause(ctx) is returned

func (*SentryWorker) WaitForRunCalled

func (w *SentryWorker) WaitForRunCalled(ctx context.Context) error

WaitForRunCalled blocks until Run() is started or the context is canceled. If the context is canceled, the error is returned; otherwise nil

func (*SentryWorker) WaitForRunCompleted

func (w *SentryWorker) WaitForRunCompleted(ctx context.Context) error

WaitForRunCompleted blocks until Run() has completed The Run() error (may be nil) or context.Cause(ctx) is returned

func (*SentryWorker) WaitForTerminateCalled

func (w *SentryWorker) WaitForTerminateCalled(ctx context.Context) error

WaitForTerminateCalled blocks until Terminate() is started or the context is canceled. If the context is canceled, the error is returned; otherwise nil

func (*SentryWorker) WaitForTerminateCompleted

func (w *SentryWorker) WaitForTerminateCompleted(ctx context.Context) error

WaitForTerminateCompleted blocks until Run() is started or the context is canceled. The Terminate() error (may be nil) or context.Cause(ctx) is returned

Jump to

Keyboard shortcuts

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