job

package
v0.9.23 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package job [contains all the attack types db1000n can simulate]

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfigPathCSV = ""

Functions

func ParseConfig

func ParseConfig(c Config, args config.Args, global GlobalConfig) error

Types

type BasicJobConfig

type BasicJobConfig struct {
	IntervalMs     int
	Interval       *time.Duration
	RandomInterval time.Duration
	utils.Counter
	Backoff *utils.BackoffConfig
}

BasicJobConfig comment for linter

func (*BasicJobConfig) FromGlobal

func (c *BasicJobConfig) FromGlobal(global GlobalConfig)

func (BasicJobConfig) GetInterval

func (c BasicJobConfig) GetInterval(stable bool) time.Duration

func (*BasicJobConfig) Next

func (c *BasicJobConfig) Next(ctx context.Context) bool

Next comment for linter

type Config

type Config interface {
	FromGlobal(GlobalConfig)
}

type ConfigOptions

type ConfigOptions struct {
	PathsCSV       string        // Comma-separated config location URLs
	BackupConfig   string        // Raw backup config
	Format         string        // json or yaml
	RefreshTimeout time.Duration // How often to refresh config
}

ConfigOptions for fetching job configs for the runner

func NewConfigOptionsWithFlags

func NewConfigOptionsWithFlags() *ConfigOptions

NewConfigOptionsWithFlags returns ConfigOptions initialized with command line flags.

type GlobalConfig

type GlobalConfig struct {
	ClientID string
	UserID   string
	Source   string

	SkipEncrypted       bool
	EnablePrimitiveJobs bool
	ScaleFactor         float64
	RandomInterval      time.Duration
	MinInterval         time.Duration
	Backoff             utils.BackoffConfig
	// contains filtered or unexported fields
}

GlobalConfig passes commandline arguments to every job.

func NewGlobalConfigWithFlags

func NewGlobalConfigWithFlags() *GlobalConfig

NewGlobalConfigWithFlags returns a GlobalConfig initialized with command line flags.

func (GlobalConfig) GetProxyParams added in v0.9.0

func (g GlobalConfig) GetProxyParams(logger *zap.Logger, data any) utils.ProxyParams

type Job

type Job = func(ctx context.Context, args config.Args, globalConfig *GlobalConfig, a *metrics.Accumulator, logger *zap.Logger) (data any, err error)

Job comment for linter

func Get

func Get(t string) Job

Get job by type name

type Runner

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

Runner executes jobs according to the (fetched from remote) configuration

func NewRunner

func NewRunner(cfgOptions *ConfigOptions, globalJobsCfg *GlobalConfig, reporter metrics.Reporter) *Runner

NewRunner according to the config

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, logger *zap.Logger)

Run the runner and block until Stop() is called

Directories

Path Synopsis
Package config [used for configuring the package]
Package config [used for configuring the package]

Jump to

Keyboard shortcuts

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