Documentation
¶
Index ¶
- Variables
- type SentryWorker
- func (w *SentryWorker) Init(l *zap.Logger) error
- func (w *SentryWorker) InitDone() bool
- func (w *SentryWorker) Run() error
- func (w *SentryWorker) RunIsCalled() bool
- func (w *SentryWorker) RunIsCompleted() bool
- func (w *SentryWorker) Terminate() error
- func (w *SentryWorker) TerminatedIsCalled() bool
- func (w *SentryWorker) TerminatedIsCompleted() bool
- func (w *SentryWorker) WaitForInitDone(ctx context.Context) error
- func (w *SentryWorker) WaitForRunCalled(ctx context.Context) error
- func (w *SentryWorker) WaitForRunCompleted(ctx context.Context) error
- func (w *SentryWorker) WaitForTerminateCalled(ctx context.Context) error
- func (w *SentryWorker) WaitForTerminateCompleted(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
var ErrTerminateCalled = fmt.Errorf("terminate called")
Functions ¶
This section is empty.
Types ¶
type SentryWorker ¶
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) 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