restart

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(wrapRunner runner.Runner, opts ...Option) runner.Runner

New wraps runner.Runner with restart policy.

Types

type Option

type Option func(*Options)

Option is the functional option func.

func WithRestartInterval

func WithRestartInterval(interval time.Duration) Option

WithRestartInterval sets the interval between restarts of the failed task.

func WithType

func WithType(o Type) Option

WithType sets the type of a service.

type Options

type Options struct {
	// Type describes the service's restart policy.
	Type Type
	// RestartInterval is the interval between restarts for failed runs.
	RestartInterval time.Duration
}

Options is the functional options struct.

func DefaultOptions

func DefaultOptions() *Options

DefaultOptions describes the default options to a runner.

type Type

type Type int

Type represents the service's restart policy.

const (
	// Forever will always restart a process.
	Forever Type = iota
	// Once will run process exactly once.
	Once
	// UntilSuccess will restart process until run succeeds.
	UntilSuccess
)

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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