timeout

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2023 License: MIT Imports: 16 Imported by: 1

Documentation

Overview

Package timeout encodes a strategy where timeout durations are chosen non deterministically

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBadConfig is returned when creating the strategy config and the required parameters are absent
	ErrBadConfig = errors.New("one of MaxMessageDelay or DelayDistribution should be specified")
)

Functions

func FireTimeout added in v0.1.4

func FireTimeout(t *types.ReplicaTimeout) *strategies.Action

FireTimeout action instructs the replica to fire a timeout

Types

type Distribution added in v0.1.4

type Distribution interface {
	Rand() int
}

Distribution encodes a probability distribution to sample values from

type ExpDistribution added in v0.1.4

type ExpDistribution struct {
	*distuv.Exponential
}

func NewExpDistribution added in v0.1.4

func NewExpDistribution(Rate float64) *ExpDistribution

func (*ExpDistribution) Rand added in v0.1.4

func (p *ExpDistribution) Rand() int

func (*ExpDistribution) SetSrc added in v0.1.4

func (p *ExpDistribution) SetSrc(src rand.Source)

type ParetoDistribution added in v0.1.4

type ParetoDistribution struct {
	*distuv.Pareto
}

func NewParetoDistribution added in v0.1.4

func NewParetoDistribution(Xm, Alpha float64) *ParetoDistribution

func (*ParetoDistribution) Rand added in v0.1.4

func (p *ParetoDistribution) Rand() int

func (*ParetoDistribution) SetSrc added in v0.1.4

func (p *ParetoDistribution) SetSrc(src rand.Source)

type TimeoutStrategy

type TimeoutStrategy struct {
	Actions *types.Channel[*strategies.Action]

	*types.BaseService
	// contains filtered or unexported fields
}

TimeoutStrategy is an experimental strategy to test distributed systems. We non deterministically set the duration of the timeout while maintaining the constraints imposed by a natural monotonic order of time.

func NewTimeoutStrategy

func NewTimeoutStrategy(config *TimeoutStrategyConfig) (*TimeoutStrategy, error)

NewTimeoutStrategy creates a new TimeoutStrategy with the corresponding config. Returns and error when the config is invalid

func (*TimeoutStrategy) ActionsCh added in v0.2.7

func (t *TimeoutStrategy) ActionsCh() *types.Channel[*strategies.Action]

func (*TimeoutStrategy) EndCurIteration added in v0.1.5

func (t *TimeoutStrategy) EndCurIteration(ctx *strategies.Context)

func (*TimeoutStrategy) Finalize added in v0.1.4

func (t *TimeoutStrategy) Finalize(c *strategies.Context)

func (*TimeoutStrategy) NextIteration added in v0.1.4

func (t *TimeoutStrategy) NextIteration(ctx *strategies.Context)

func (*TimeoutStrategy) Start added in v0.1.4

func (t *TimeoutStrategy) Start() error

func (*TimeoutStrategy) Step

func (t *TimeoutStrategy) Step(e *types.Event, ctx *strategies.Context)

func (*TimeoutStrategy) Stop added in v0.1.4

func (t *TimeoutStrategy) Stop() error

type TimeoutStrategyConfig added in v0.1.4

type TimeoutStrategyConfig struct {
	// Accepted as a percentage value (0-100)
	ClockDrift int
	// Maximum message delay time
	// One of MaxMessageDelay or DelayDistribution should be specified
	MaxMessageDelay time.Duration
	// DelayDistribution is the distribution from which message delay values will be sampled
	DelayDistribution Distribution
	// Nondeterministic will fire timeouts randomly ignoring the timeout duration
	Nondeterministic bool
	// SpuriousCheck will enable checking for spuriousness when firing non deterministically
	SpuriousCheck bool
	// Z3Timeout duration for z3 spurious checking
	Z3Timeout time.Duration
	// RecordFilePath stores the data collected to this path
	RecordFilePath string
	// PendingEventThreshold dictates the minimum number of pending events required to choose one
	PendingEventThreshold int
}

type WeibullDistribution added in v0.1.4

type WeibullDistribution struct {
	*distuv.Weibull
}

func NewWeibullDistribution added in v0.1.4

func NewWeibullDistribution(K, Lambda float64) *WeibullDistribution

func (*WeibullDistribution) Rand added in v0.1.4

func (p *WeibullDistribution) Rand() int

func (*WeibullDistribution) SetSrc added in v0.1.4

func (p *WeibullDistribution) SetSrc(src rand.Source)

Jump to

Keyboard shortcuts

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