Documentation
¶
Index ¶
- func Manager(options *ManagerOptions) *managerBuilder
- func Periodic(opts PeriodicOptions, runnable Runnable) *periodic
- func Run(runner Runnable)
- func RunGroup(runners ...Runnable)
- type CloserOptions
- type GroupRunner
- type Logger
- type ManagerOptions
- type PanicError
- type PeriodicOptions
- type RecoverRunner
- type RestartOptions
- type Runnable
- type RunnableCleanup
- type RunnableError
- type RunnableInit
- type RunnableInitCleanup
- type ServerWithShutdown
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Manager ¶ added in v0.4.0
func Manager(options *ManagerOptions) *managerBuilder
Manager returns a runnable that execute runnables in go routines. Runnables can declare a dependency on another runnable. Dependencies are started first and stopped last.
func Periodic ¶ added in v0.1.0
func Periodic(opts PeriodicOptions, runnable Runnable) *periodic
Periodic returns a runnable that will periodically run the runnable passed in argument.
Types ¶
type CloserOptions ¶ added in v0.4.0
CloserOptions configures the behavior of a Closer runnable.
type GroupRunner ¶
func Group ¶
func Group(runnables ...Runnable) *GroupRunner
Group returns a runnable that concurrently runs all runnables passed in argument.
type ManagerOptions ¶ added in v0.4.0
ManagerOptions configures the behavior of a Manager.
type PanicError ¶
type PanicError struct {
// contains filtered or unexported fields
}
func (*PanicError) Error ¶
func (e *PanicError) Error() string
func (*PanicError) Unwrap ¶
func (e *PanicError) Unwrap() error
type PeriodicOptions ¶ added in v0.1.0
PeriodicOptions configures the behavior of a Periodic runnable.
type RecoverRunner ¶
type RecoverRunner struct {
// contains filtered or unexported fields
}
type RestartOptions ¶
type RestartOptions struct {
RestartLimit int // Number of restart after which the runnable will not be restarted.
CrashLimit int // Number of crash after which the runnable will not be restarted.
BackoffSleep time.Duration // Time to wait before restarting.
CrashBackoffSleep time.Duration // Time to wait before restarting after a crash
}
RestartOptions configures the behavior of the Restart runnable
type Runnable ¶
Runnable is the contract for anything that runs with a Go context, respects the concellation contract, and expects the caller to handle errors.
func Closer ¶ added in v0.4.0
func Closer(object io.Closer, opts *CloserOptions) Runnable
Closer returns a runnable that will close what is passed in argument.
func HTTPServer ¶ added in v0.3.0
func HTTPServer(server ServerWithShutdown) Runnable
HTTPServer returns a runnable that runs a ServerWithShutdown (like *http.Server).
func Recover ¶
Recover returns a runnable that recovers when a runnable panics and return an error to represent this panic.
func Restart ¶
func Restart(opts RestartOptions, runnable Runnable) Runnable
Restart returns a runnable that runs a runnable and restarts it when it fails, with some conditions.
type RunnableCleanup ¶ added in v0.2.0
type RunnableError ¶ added in v0.4.0
type RunnableError struct {
// contains filtered or unexported fields
}
func (*RunnableError) Error ¶ added in v0.4.0
func (e *RunnableError) Error() string
func (*RunnableError) Unwrap ¶ added in v0.4.0
func (e *RunnableError) Unwrap() error