control

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 License: Apache-2.0 Imports: 24 Imported by: 26

Documentation

Index

Constants

View Source
const (
	ModeMixed = iota
	ModeSequential
	ModeSelfScheduled
)

Modes enum

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Mode is for switch between control modes
	Mode Mode
	// DB is the name which we want to run.
	DB string
	// Nodes are addresses of nodes.
	Nodes []cluster.Node
	// ClientNode are addresses of client usage.
	ClientNodes []cluster.ClientNode
	// ClientCount controls the count of clients
	ClientCount int
	// Chaos NS
	ChaosNamespace string

	// RunRound controls how many round the controller runs tests.
	RunRound int
	// RunTime controls how long a round takes.
	RunTime time.Duration
	// RequestCount controls how many requests a client sends to the db.
	RequestCount int

	// History file
	History string

	// ClientConfig can be anything, use type assertion in your case
	ClientConfig interface{}
}

Config is the configuration for the controller.

type Controller

type Controller struct {

	// protect nemesisGenerators' reading and updating
	sync.RWMutex
	// contains filtered or unexported fields
}

Controller controls the whole cluster. It sends request to the database, and also uses nemesis to disturb the cluster. Here have only 5 nodes, and the hosts are n1 - n5.

func NewController

func NewController(
	ctx context.Context,
	cfg *Config,
	clientCreator core.ClientCreator,
	nemesisGenerators core.NemesisGenerators,
	clientRequestGenerator func(ctx context.Context, client core.Client, node cluster.ClientNode, proc *int64, requestCount *int64, recorder *history.Recorder),
	verifySuit verify.Suit,
	plugins []Plugin,
	lokiCli *loki.Client,
	logPath string,
) *Controller

NewController creates a controller.

func (*Controller) Close

func (c *Controller) Close()

Close closes the controller.

func (*Controller) Run

func (c *Controller) Run()

Run runs the controller.

func (*Controller) RunMixed

func (c *Controller) RunMixed()

RunMixed runs workload round by round, with nemesis injected seamlessly Nemesis and workload are running concurrently, nemesis won't pause when one round of workload is finished

func (*Controller) RunSelfScheduled

func (c *Controller) RunSelfScheduled()

RunSelfScheduled runs the controller with self scheduled

func (*Controller) RunWithNemesisSequential

func (c *Controller) RunWithNemesisSequential()

RunWithNemesisSequential runs nemesis sequential, with n round of workload running with each kind of nemesis. eg. nemesis1, round 1, round 2, ... round n ->

nemesis2, round 1, round 2, ... round n ->
... nemesis n, round 1, round 2, ... round n

func (*Controller) UpdateNemesisGenerators

func (c *Controller) UpdateNemesisGenerators(gs core.NemesisGenerators)

UpdateNemesisGenerators updates nemesis generators

type LeakCheck

type LeakCheck struct {
	*Controller
}

LeakCheck ...

func (*LeakCheck) InitPlugin

func (l *LeakCheck) InitPlugin(control *Controller)

InitPlugin ...

type Mode

type Mode int

Mode enums control modes

func (Mode) String

func (m Mode) String() string

type PanicCheck

type PanicCheck struct {
	*Controller
	// contains filtered or unexported fields
}

PanicCheck impls Plugin

func (*PanicCheck) InitPlugin

func (c *PanicCheck) InitPlugin(control *Controller)

InitPlugin ...

type Plugin

type Plugin interface {
	InitPlugin(control *Controller)
}

Plugin defines a middleware

type Stack

type Stack struct {
	ID    uint64
	State string
	Up    int
	Func  []string
	Line  []string
	Raw   []byte
}

Stack is stack

func (*Stack) Signature

func (s *Stack) Signature() []byte

Signature signs stack

Jump to

Keyboard shortcuts

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