Documentation ¶
Index ¶
- type AddNodes
- type Client
- type Connection
- type DeleteNodes
- type Driver
- type Event
- type EventRunner
- type Node
- type RaftEngine
- func (r *RaftEngine) BootstrapRegion() *core.RegionInfo
- func (r *RaftEngine) GetRegion(regionID uint64) *core.RegionInfo
- func (r *RaftEngine) GetRegionChange(storeID uint64) []uint64
- func (r *RaftEngine) GetRegions() []*core.RegionInfo
- func (r *RaftEngine) NeedSplit(size, rows int64) bool
- func (r *RaftEngine) ResetRegionChange(storeID uint64, regionID uint64)
- func (r *RaftEngine) SearchRegion(regionKey []byte) *core.RegionInfo
- func (r *RaftEngine) SetRegion(region *core.RegionInfo) []*core.RegionInfo
- type ReadFlowOnRegion
- type SimConfig
- type Task
- type WriteFlowOnRegion
- type WriteFlowOnSpot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddNodes ¶
type AddNodes struct {
// contains filtered or unexported fields
}
AddNodes adds nodes.
type Client ¶
type Client interface { GetClusterID(ctx context.Context) uint64 AllocID(ctx context.Context) (uint64, error) Bootstrap(ctx context.Context, store *metapb.Store, region *metapb.Region) error PutStore(ctx context.Context, store *metapb.Store) error StoreHeartbeat(ctx context.Context, stats *pdpb.StoreStats) error RegionHeartbeat(ctx context.Context, region *core.RegionInfo) error Close() }
Client is a PD (Placement Driver) client. It should not be used after calling Close().
type Connection ¶
Connection records the informations of connection among nodes.
func NewConnection ¶
NewConnection creates nodes according to the configuration and returns the connection among nodes.
type DeleteNodes ¶
type DeleteNodes struct {
// contains filtered or unexported fields
}
DeleteNodes deletes nodes.
func (*DeleteNodes) Run ¶
func (e *DeleteNodes) Run(raft *RaftEngine, tickCount int64) bool
Run implements the event interface.
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver promotes the cluster status change.
func (*Driver) GetBootstrapInfo ¶
GetBootstrapInfo returns a valid bootstrap store and region.
func (*Driver) Prepare ¶
Prepare initializes cluster information, bootstraps cluster and starts nodes.
func (*Driver) PrintStatistics ¶
func (d *Driver) PrintStatistics()
PrintStatistics prints the statistics of the scheduler.
type Event ¶
type Event interface {
Run(raft *RaftEngine, tickCount int64) bool
}
Event affects the status of the cluster.
type EventRunner ¶
type EventRunner struct {
// contains filtered or unexported fields
}
EventRunner includes all events.
func NewEventRunner ¶
func NewEventRunner(events []cases.EventDescriptor, raftEngine *RaftEngine) *EventRunner
NewEventRunner creates an event runner.
type Node ¶
Node simulates a TiKV.
func (*Node) GetState ¶
func (n *Node) GetState() metapb.StoreState
GetState returns current node state.
type RaftEngine ¶
RaftEngine records all raft information.
func NewRaftEngine ¶
func NewRaftEngine(conf *cases.Case, conn *Connection, storeConfig *SimConfig) *RaftEngine
NewRaftEngine creates the initialized raft with the configuration.
func (*RaftEngine) BootstrapRegion ¶
func (r *RaftEngine) BootstrapRegion() *core.RegionInfo
BootstrapRegion gets a region to construct bootstrap info.
func (*RaftEngine) GetRegion ¶
func (r *RaftEngine) GetRegion(regionID uint64) *core.RegionInfo
GetRegion returns the RegionInfo with regionID.
func (*RaftEngine) GetRegionChange ¶
func (r *RaftEngine) GetRegionChange(storeID uint64) []uint64
GetRegionChange returns a list of RegionID for a given store.
func (*RaftEngine) GetRegions ¶
func (r *RaftEngine) GetRegions() []*core.RegionInfo
GetRegions gets all RegionInfo from regionMap
func (*RaftEngine) NeedSplit ¶
func (r *RaftEngine) NeedSplit(size, rows int64) bool
NeedSplit checks whether the region needs to split according its size and number of keys.
func (*RaftEngine) ResetRegionChange ¶
func (r *RaftEngine) ResetRegionChange(storeID uint64, regionID uint64)
ResetRegionChange resets RegionInfo on a specific store with a given Region ID
func (*RaftEngine) SearchRegion ¶
func (r *RaftEngine) SearchRegion(regionKey []byte) *core.RegionInfo
SearchRegion searches the RegionInfo from regionTree
func (*RaftEngine) SetRegion ¶
func (r *RaftEngine) SetRegion(region *core.RegionInfo) []*core.RegionInfo
SetRegion sets the RegionInfo with regionID
type ReadFlowOnRegion ¶
type ReadFlowOnRegion struct {
// contains filtered or unexported fields
}
ReadFlowOnRegion reads bytes in some region
func (*ReadFlowOnRegion) Run ¶
func (e *ReadFlowOnRegion) Run(raft *RaftEngine, tickCount int64) bool
Run implements the event interface.
type SimConfig ¶
type SimConfig struct { // tick SimTickInterval typeutil.Duration `toml:"sim-tick-interval"` // store StoreCapacityGB uint64 `toml:"store-capacity"` StoreAvailableGB uint64 `toml:"store-available"` StoreIOMBPerSecond int64 `toml:"store-io-per-second"` StoreVersion string `toml:"store-version"` // server ServerConfig *config.Config `toml:"server"` }
SimConfig is the simulator configuration.
func NewSimConfig ¶
NewSimConfig create a new configuration of the simulator.
type Task ¶
type Task interface { Desc() string RegionID() uint64 Step(r *RaftEngine) IsFinished() bool }
Task running in node.
type WriteFlowOnRegion ¶
type WriteFlowOnRegion struct {
// contains filtered or unexported fields
}
WriteFlowOnRegion writes bytes in some region.
func (*WriteFlowOnRegion) Run ¶
func (e *WriteFlowOnRegion) Run(raft *RaftEngine, tickCount int64) bool
Run implements the event interface.
type WriteFlowOnSpot ¶
type WriteFlowOnSpot struct {
// contains filtered or unexported fields
}
WriteFlowOnSpot writes bytes in some range.
func (*WriteFlowOnSpot) Run ¶
func (e *WriteFlowOnSpot) Run(raft *RaftEngine, tickCount int64) bool
Run implements the event interface.