eventmangler

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckParams

func CheckParams(p *ModuleParams) error

func NewModule

func NewModule(mc ModuleConfig, params *ModuleParams) (modules.PassiveModule, error)

NewModule returns a new instance of the event mangler module. The event mangler probabilistically drops or delays all incoming events. The drop rate and interval of possible delays is determined by the params argument.

Types

type ModuleConfig

type ModuleConfig struct {
	Self  t.ModuleID
	Dest  t.ModuleID
	Timer t.ModuleID
}

type ModuleParams

type ModuleParams struct {

	// All events that are not dropped are delayed at least by MinDelay.
	MinDelay time.Duration

	// All events that are not dropped are delayed by a time chosen uniformly at random between MinDelay and MaxDelay.
	MaxDelay time.Duration

	// Number between 0 and 1 indicating the probability with which an incoming event is dropped.
	DropRate float32

	// Source of randomness used for random decisions.
	// If set to nil, a new pseudo-random generator will be used.
	Rand *rand.Rand
}

func DefaultParams

func DefaultParams() *ModuleParams

Jump to

Keyboard shortcuts

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