setup

package
v0.0.0-...-8cbd207 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionPicker

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

func NewActionPicker

func NewActionPicker(config FaultConfig) *ActionPicker

func (*ActionPicker) DetermineAction

func (actionPicker *ActionPicker) DetermineAction() FaultAction

func (*ActionPicker) GetAction

func (actionPicker *ActionPicker) GetAction(actionType protocol.ActionType) FaultAction

type FaultAction

type FaultAction interface {
	Perform(resetConnFunc func())
	Name() string
	GenerateResponse(*protocol.Message) error
}

type FaultConfig

type FaultConfig struct {
	UnixToDaDomainSocketPath   string `yaml:"unix-to-da-domain-socket-path"`
	UnixFromDaDomainSocketPath string `yaml:"unix-from-da-domain-socket-path"`
	FaultsEnabled              bool   `yaml:"faults-enabled"`
	Actions                    struct {
		Noop struct {
			Probability float64 `yaml:"probability"`
		} `yaml:"noop"`
		Halt struct {
			Probability float64 `yaml:"probability"`
			MaxDuration int     `yaml:"max-duration"`
		} `yaml:"halt"`
		Pause struct {
			Probability     float64 `yaml:"probability"`
			MaxDuration     int     `yaml:"max-duration"`
			PauseCommand    string  `yaml:"pause-command"`
			ContinueCommand string  `yaml:"continue-command"`
		} `yaml:"pause"`
		Stop struct {
			Probability    float64 `yaml:"probability"`
			MaxDuration    int     `yaml:"max-duration"`
			StopCommand    string  `yaml:"stop-command"`
			RestartCommand string  `yaml:"restart-command"`
		} `yaml:"stop"`
		ResendLastMessage struct {
			Probability float64 `yaml:"probability"`
			MaxDuration int     `yaml:"max-duration"`
		} `yaml:"resend-last-message"`
	} `yaml:"actions"`
}

func ReadFaultConfig

func ReadFaultConfig(path string) (FaultConfig, error)

func (*FaultConfig) String

func (config *FaultConfig) String() (string, error)

type HaltAction

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

func (*HaltAction) GenerateResponse

func (action *HaltAction) GenerateResponse(response *protocol.Message) error

func (*HaltAction) Name

func (action *HaltAction) Name() string

func (*HaltAction) Perform

func (action *HaltAction) Perform(func())

type NoopAction

type NoopAction struct {
}

func (*NoopAction) GenerateResponse

func (action *NoopAction) GenerateResponse(response *protocol.Message) error

func (*NoopAction) Name

func (action *NoopAction) Name() string

func (*NoopAction) Perform

func (action *NoopAction) Perform(func())

type PauseAction

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

func (*PauseAction) GenerateResponse

func (action *PauseAction) GenerateResponse(response *protocol.Message) error

func (*PauseAction) Name

func (action *PauseAction) Name() string

func (*PauseAction) Perform

func (action *PauseAction) Perform(func())

type ResendLastMessageAction

type ResendLastMessageAction struct {
}

func (*ResendLastMessageAction) GenerateResponse

func (action *ResendLastMessageAction) GenerateResponse(response *protocol.Message) error

func (*ResendLastMessageAction) Name

func (action *ResendLastMessageAction) Name() string

func (*ResendLastMessageAction) Perform

func (action *ResendLastMessageAction) Perform(func())

type StopAction

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

func (*StopAction) GenerateResponse

func (action *StopAction) GenerateResponse(response *protocol.Message) error

func (*StopAction) Name

func (action *StopAction) Name() string

func (*StopAction) Perform

func (action *StopAction) Perform(resetConnFunc func())

Jump to

Keyboard shortcuts

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