schedule

package
v0.5.16 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MPL-2.0 Imports: 5 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewComposite

func NewComposite(scheds ...core.Schedule) core.Schedule

func NewCompositeConf

func NewCompositeConf(conf CompositeConf) core.Schedule

func NewConst

func NewConst(ops float64, duration time.Duration) core.Schedule

func NewConstConf

func NewConstConf(conf ConstConfig) core.Schedule

func NewDoAtSchedule

func NewDoAtSchedule(duration time.Duration, n int64, doAt DoAt) core.Schedule

func NewInstanceStep added in v0.4.0

func NewInstanceStep(from, to int64, step int64, stepDuration time.Duration) core.Schedule

func NewInstanceStepConf added in v0.4.0

func NewInstanceStepConf(conf InstanceStepConfig) core.Schedule

func NewLine

func NewLine(from, to float64, duration time.Duration) core.Schedule

func NewLineConf

func NewLineConf(conf LineConfig) core.Schedule

func NewOnce

func NewOnce(n int64) core.Schedule

NewOnce returns schedule that emits all passed operation token at start time. That is, is schedule for zero duration, unlimited RPS, and n operations.

func NewOnceConf

func NewOnceConf(conf OnceConfig) core.Schedule

func NewStep added in v0.3.3

func NewStep(from, to float64, step int64, duration time.Duration) core.Schedule

func NewStepConf added in v0.3.3

func NewStepConf(conf StepConfig) core.Schedule

func NewUnlimited

func NewUnlimited(duration time.Duration) core.Schedule

NewUnlimited returns schedule that generates unlimited ops for passed duration.

func NewUnlimitedConf

func NewUnlimitedConf(conf UnlimitedConfig) core.Schedule

Types

type CompositeConf

type CompositeConf struct {
	Nested []core.Schedule `config:"nested"`
}

type ConstConfig

type ConstConfig struct {
	Ops      float64       `validate:"min=0"`
	Duration time.Duration `validate:"min-time=1ms"`
}

type DoAt

type DoAt func(i int64) time.Duration

DoAt returns when i'th operation should be performed, assuming that schedule started at 0.

type InstanceStepConfig added in v0.4.0

type InstanceStepConfig struct {
	From         int64         `validate:"min=0"`
	To           int64         `validate:"min=0"`
	Step         int64         `validate:"min=1"`
	StepDuration time.Duration `validate:"min-time=1ms"`
}

type LineConfig

type LineConfig struct {
	From     float64       `validate:"min=0"`
	To       float64       `validate:"min=0"`
	Duration time.Duration `validate:"min-time=1ms"`
}

type OnceConfig

type OnceConfig struct {
	Times int64 `validate:"min=1"` // N is decoded like bool
}

type StartSync added in v0.3.0

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

StartSync is util to make schedule start goroutine safe. See doAtSchedule as example.

func (*StartSync) IsStarted added in v0.3.0

func (s *StartSync) IsStarted() bool

func (*StartSync) MarkStarted added in v0.3.0

func (s *StartSync) MarkStarted()

type StepConfig added in v0.3.3

type StepConfig struct {
	From     float64       `validate:"min=0"`
	To       float64       `validate:"min=0"`
	Step     int64         `validate:"min=1"`
	Duration time.Duration `validate:"min-time=1ms"`
}

type UnlimitedConfig

type UnlimitedConfig struct {
	Duration time.Duration `validate:"min-time=1ms"`
}

Jump to

Keyboard shortcuts

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