bulkhead

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2019 License: Apache-2.0 Imports: 5 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config) goresilience.Runner

New returns a new bulkhead runner. Bulkhead will limit the execution of execution blocks based on a configuration. The bulkhead implementation will be made using a worker of pools, the workers will pick these execution blocks when they are free, they will execute the logic and pick another block the execution block will wait to be picked by the workers and if they have a max wait time, if that time is passed they will be dropped from the execution queue.

func NewMiddleware

func NewMiddleware(cfg Config) goresilience.Middleware

NewMiddleware returns a new middleware for the runner that returns

bulkhead.New.

Types

type Config

type Config struct {
	// Workers is the number of workers in the execution pool.
	Workers int
	// MaxWaitTime is the max time a runner will wait to execute before
	// being dropped it's execution and return a timeout error.
	MaxWaitTime time.Duration
	// StopC is a channel to stop the workers if required usually used for a graceful stop flow.
	StopC chan (struct{})
}

Config is the configuration of the Bulkhead runner.

Jump to

Keyboard shortcuts

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