multirun

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: MIT Imports: 8 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorClosed = errors.New("The multirun was closed")
)

Functions

This section is empty.

Types

type MultiRun

type MultiRun struct {
	sync.Mutex
	// contains filtered or unexported fields
}

MultiRun runs multiple Runnable objects

func (*MultiRun) Close

func (m *MultiRun) Close() error

Close calls the Close method on all Items.

func (*MultiRun) HandleSIGTERM

func (m *MultiRun) HandleSIGTERM()

func (*MultiRun) RegisterFunc

func (m *MultiRun) RegisterFunc(runCb func() error, closeCb func() error)

func (*MultiRun) RegisterRunnable

func (m *MultiRun) RegisterRunnable(item Runnable)

func (*MultiRun) RegisterRunnableReady

func (m *MultiRun) RegisterRunnableReady(item RunnableReady)

func (*MultiRun) Run

func (m *MultiRun) Run(ready func()) error

Run runs multiple Runnable Items and waits for all of them to complete. If one of the Runnables return an error, the others are also stopped.

type Runnable

type Runnable interface {
	Run() error
	Close() error
}

Runnable specifies an object with a blocking Run method and a Close method that makes Run return.

type RunnableReady

type RunnableReady interface {
	Run(func()) error
	Close() error
}

RunnableReady specifies an object with a blocking Run method and a Close method that makes Run return.

Jump to

Keyboard shortcuts

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