cases

package
v3.1.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2020 License: Apache-2.0 Imports: 10 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,
	"redundant-balance-region": newRedundantBalanceRegion,
	"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,
	"import-data":              newImportData,
}

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

View Source
var IDAllocator idAllocator

IDAllocator is used to alloc unique ID.

Functions

This section is empty.

Types

type AddNodesDescriptor

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

AddNodesDescriptor adds nodes.

func (*AddNodesDescriptor) Type

func (w *AddNodesDescriptor) Type() string

Type implements the EventDescriptor interface.

type Case

type Case struct {
	Stores          []*Store
	Regions         []Region
	RegionSplitSize int64
	RegionSplitKeys int64
	Events          []EventDescriptor
	TableNumber     int

	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, []info.StoreStats) bool

CheckerFunc checks if the scheduler is finished.

type DeleteNodesDescriptor

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

DeleteNodesDescriptor removes nodes.

func (*DeleteNodesDescriptor) Type

func (w *DeleteNodesDescriptor) Type() string

Type implements the EventDescriptor interface.

type EventDescriptor

type EventDescriptor interface {
	Type() string
}

EventDescriptor is a detail template for custom events.

type ReadFlowOnRegionDescriptor

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

ReadFlowOnRegionDescriptor reads bytes in some region.

func (*ReadFlowOnRegionDescriptor) Type

Type implements the EventDescriptor 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 WriteFlowOnRegionDescriptor

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

WriteFlowOnRegionDescriptor writes bytes in some region.

func (*WriteFlowOnRegionDescriptor) Type

Type implements the EventDescriptor interface.

type WriteFlowOnSpotDescriptor

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

WriteFlowOnSpotDescriptor writes bytes in some range.

func (*WriteFlowOnSpotDescriptor) Type

Type implements the EventDescriptor interface.

Jump to

Keyboard shortcuts

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