restart

package
Version: v0.0.0-...-04005c2 Latest Latest
Warning

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

Go to latest
Published: May 6, 2015 License: MIT, MIT Imports: 3 Imported by: 0

Documentation

Overview

The restart package implements common restart strategies for ifrit processes.

The API is still experimental and subject to change.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoLoadCallback = errors.New("ErrNoLoadCallback")

ErrNoLoadCallback is returned by Restarter if it is Invoked without a Load function.

Functions

func OnError

func OnError(runner ifrit.Runner, err error, errors ...error) ifrit.Runner

OnError is a restart strategy for Safely Restartable Runners. It will restart the Runner only if it exits with a matching error.

Types

type Restarter

type Restarter struct {
	Runner ifrit.Runner
	Load   func(runner ifrit.Runner, err error) ifrit.Runner
}

Restarter takes an inital runner and a Load function. When the inital Runner exits, the load function is called. If the Load function retuns a Runner, the Restarter will invoke the Runner. This continues until the Load function returns nil, or the Restarter is signaled to stop. The Restarter returns the error of the final Runner it invoked.

func (Restarter) Run

func (r Restarter) Run(signals <-chan os.Signal, ready chan<- struct{}) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL