engine

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2017 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Pools []InstancePoolConfig `config:"pools"`
}

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

func New

func New(log *zap.Logger, m Metrics, conf Config) *Engine

func (*Engine) Run

func (e *Engine) Run(ctx context.Context) error

Run runs all instance pools. Run blocks until fail happen, or all pools subroutines are successfully finished.

func (*Engine) Wait

func (e *Engine) Wait()

Wait blocks until all run engine tasks are finished. Useful only in case of fail, because successful run awaits all started tasks.

type InstancePoolConfig

type InstancePoolConfig struct {
	Id              string
	Provider        core.Provider                 `config:"ammo"`
	Aggregator      core.Aggregator               `config:"result"`
	NewGun          func() (core.Gun, error)      `config:"gun"`
	RPSPerInstance  bool                          `config:"rps-per-instance"`
	NewRPSSchedule  func() (core.Schedule, error) `config:"rps"`
	StartupSchedule core.Schedule                 `config:"startup"`
}

type Metrics

type Metrics struct {
	Request        *monitoring.Counter
	Response       *monitoring.Counter
	InstanceStart  *monitoring.Counter
	InstanceFinish *monitoring.Counter
}

TODO(skipor): use something github.com/rcrowley/go-metrics based. Its high level primitives like Meter can be not fast enough, but EWMAs and Counters should good for that.

Jump to

Keyboard shortcuts

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