runners

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2021 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service provides a simplified means of tracking/running a service, preventing multiple calls to `.Run()` and multiple calls to `.Stop()` when changes of state are in progress

func (*Service) Done

func (svc *Service) Done() <-chan struct{}

Done returns a channel that's closed when the Manager stops, which is whenever the function supplied in Manager.Start() returns

func (*Service) Run

func (svc *Service) Run(fn func(context.Context)) bool

Run will run the supplied function until completion, use supplied context to indicate if stopped. Immediately returns false if the service is already running, and true after completd run. You MUST NOT call other Service methods WITHIN provided function

func (*Service) Running

func (svc *Service) Running() bool

Running will return true if the manager is started

func (*Service) Stop

func (svc *Service) Stop(fn func()) bool

Stop will attempt to stop the service, and allows you to run supplied function during the mutex locked state change (if was running). Immediately returns false if not running, and true after Service has full stopped. You MUST NOT call other Service methods WITHIN provided function

func (*Service) Stopping

func (svc *Service) Stopping() bool

Stopping will return true if the manager is in the act of stopping (stop been called, start not yet returned)

Jump to

Keyboard shortcuts

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