injection

package
v0.0.0-...-25a9806 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initalize

func Initalize(pstrTestType string, pITestCount interface{}, parrErrRates []float64, pOutput *Output)

Set up the testing environment with the test type, number of changes/iterations or duration in seconds, and error rates. This is PER error rate. i.e. 5 minutes and ten error rates will be 50 minutes. Test types: 'iteration' - increments for each bit flipped 'variable' - increments for each variable, regardless of bits flipped 'time' - checks against passage of time since started

Types

type Config

type Config struct {
	Initialized bool   `json:"initialized"`
	Path        string `json:"path"`

	State struct {
		TestType         string        `json:"test_type"`
		TestCounter      int           `json:"test_counter"`
		Iterations       int           `json:"iterations"`
		VariablesChanged int           `json:"variables_changed"`
		Duration         time.Duration `json:"duration"`
		StartTime        time.Time     `json:"start_time"`
		RateIndex        int           `json:"rate_index"`
		ErrorRates       []int         `json:"error_rates"`
	} `json:"state_variables"`

	Server struct {
		Post bool   `json:"post"`
		Host string `json:"host"`
	} `json:"server"`
}

TODO: Import from config

type ErrorData

type ErrorData struct {
	PreviousValue *big.Int
	PreviousByte  string
	IntBits       []int
	ErrorValue    *big.Int
	ErrorByte     string
	DeltaValue    *big.Int
	When          string
}

type ErrorRate

type ErrorRate struct {
	Rate     float64
	FlipData []Iteration
}

type IBitFlip

type IBitFlip interface {
	Initalize(pstrTestType string, pITestCount interface{}, parrErrRates []float64, pOutput Output)
	BitFlip(pbigNum *big.Int) *big.Int
}

TODO: Populate with remaining functions

type Iteration

type Iteration struct {
	IterationNum int
	ErrorData    ErrorData
}

type Output

type Output struct {
	Data []ErrorRate
}

func (*Output) BitFlip

func (jsonOut *Output) BitFlip(pbigNum *big.Int) *big.Int

BitFlip will run the odds of flipping a bit within pbigNum based on error rate pdecRate. The iteration count will increment and both the new number and the iteration error data will be returned.

func (Output) Marshal

func (jsonOut Output) Marshal() string

func (Output) MarshalIndent

func (jsonOut Output) MarshalIndent() string

func (Output) PostAPI

func (jsonOut Output) PostAPI(url string) int

Jump to

Keyboard shortcuts

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