cases

package
v2.1.14+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	B = 1 << (iota * 10)
	KB
	MB
	GB
	TB
)

unit of storage

Variables

View Source
var CaseMap = map[string]func() *Case{
	"balance-leader":       newBalanceLeader,
	"add-nodes":            newAddNodes,
	"add-nodes-dynamic":    newAddNodesDynamic,
	"delete-nodes":         newDeleteNodes,
	"region-split":         newRegionSplit,
	"region-merge":         newRegionMerge,
	"hot-read":             newHotRead,
	"hot-write":            newHotWrite,
	"makeup-down-replicas": newMakeupDownReplicas,
}

CaseMap is a mapping of the cases to the their corresponding initialize functions.

Functions

This section is empty.

Types

type AddNodesInner

type AddNodesInner struct {
	Step func(tick int64) uint64
}

AddNodesInner adds nodes.

func (*AddNodesInner) Type

func (w *AddNodesInner) Type() string

Type implements the EventInner interface.

type Case

type Case struct {
	Stores          []*Store
	Regions         []Region
	MaxID           uint64
	RegionSplitSize int64
	RegionSplitKeys int64
	Events          []EventInner

	Checker CheckerFunc // To check the schedule is finished.
}

Case represents a test suite for simulator.

func NewCase

func NewCase(name string) *Case

NewCase creates a new case.

type CheckerFunc

type CheckerFunc func(*core.RegionsInfo) bool

CheckerFunc checks if the scheduler is finished.

type DeleteNodesInner

type DeleteNodesInner struct {
	Step func(tick int64) uint64
}

DeleteNodesInner removes nodes.

func (*DeleteNodesInner) Type

func (w *DeleteNodesInner) Type() string

Type implements the EventInner interface.

type EventInner

type EventInner interface {
	Type() string
}

EventInner is a detail template for custom events.

type ReadFlowOnRegionInner

type ReadFlowOnRegionInner struct {
	Step func(tick int64) map[uint64]int64
}

ReadFlowOnRegionInner reads bytes in some region.

func (*ReadFlowOnRegionInner) Type

func (w *ReadFlowOnRegionInner) Type() string

Type implements the EventInner interface.

type Region

type Region struct {
	ID     uint64
	Peers  []*metapb.Peer
	Leader *metapb.Peer
	Size   int64
	Keys   int64
}

Region is used to simulate a region.

type Store

type Store struct {
	ID           uint64
	Status       metapb.StoreState
	Labels       []*metapb.StoreLabel
	Capacity     uint64
	Available    uint64
	LeaderWeight float32
	RegionWeight float32
	Version      string
}

Store is used to simulate tikv.

type WriteFlowOnRegionInner

type WriteFlowOnRegionInner struct {
	Step func(tick int64) map[uint64]int64
}

WriteFlowOnRegionInner writes bytes in some region.

func (*WriteFlowOnRegionInner) Type

func (w *WriteFlowOnRegionInner) Type() string

Type implements the EventInner interface.

type WriteFlowOnSpotInner

type WriteFlowOnSpotInner struct {
	Step func(tick int64) map[string]int64
}

WriteFlowOnSpotInner writes bytes in some range.

func (*WriteFlowOnSpotInner) Type

func (w *WriteFlowOnSpotInner) Type() string

Type implements the EventInner interface.

Jump to

Keyboard shortcuts

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