conductor

package
v0.0.0-...-706fd46 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HookSignals

func HookSignals() func(*Conductor)

This hooks SIGTERM and SIGINT and will shut down the Conductor if one is detected.

func Noisy

func Noisy() func(*Conductor)

tells the Conductor to log output

func ShutdownTimeout

func ShutdownTimeout(d time.Duration) func(*Conductor)

Sets the time allowed for a service to stop before timing out

func StartupTimeout

func StartupTimeout(d time.Duration) func(*Conductor)

Sets the time allowed for a service to start before timing out

Types

type Conductor

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

func NewConductor

func NewConductor(opts ...func(*Conductor)) *Conductor
Create a new conductor instance, accepts Option funcs (see README.md)

for changing default behaviours

func (*Conductor) Service

func (c *Conductor) Service(name string, service Service)

Add a Service with a name to be started in order when Start is called

func (*Conductor) Start

func (c *Conductor) Start() chan bool

Start the conductor, each service is started in turn

func (*Conductor) Stop

func (c *Conductor) Stop()

stop the conductor, begin shutting down services

type Service

type Service interface {
	Run(chan bool, chan bool, chan context.Context) error
}

Jump to

Keyboard shortcuts

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