Documentation
¶
Index ¶
- Constants
- func FindPeer(region *metapb.Region, storeID uint64) *metapb.Peer
- func GetDiffPeers(left *metapb.Region, right *metapb.Region) []*metapb.Peer
- func MustGetCf(engine *engine_util.Engines, cf string, key []byte, value []byte)
- func MustGetCfEqual(engine *engine_util.Engines, cf string, key []byte, value []byte)
- func MustGetCfNone(engine *engine_util.Engines, cf string, key []byte)
- func MustGetEqual(engine *engine_util.Engines, key []byte, value []byte)
- func MustGetNone(engine *engine_util.Engines, key []byte)
- func MustSamePeers(left *metapb.Region, right *metapb.Region)
- func NewAdminRequest(regionID uint64, epoch *metapb.RegionEpoch, request *raft_cmdpb.AdminRequest) *raft_cmdpb.RaftCmdRequest
- func NewBaseRequest(regionID uint64, epoch *metapb.RegionEpoch) raft_cmdpb.RaftCmdRequest
- func NewDeleteCfCmd(cf string, key []byte) *raft_cmdpb.Request
- func NewGetCfCmd(cf string, key []byte) *raft_cmdpb.Request
- func NewPeer(storeID, peerID uint64) *metapb.Peer
- func NewPutCfCmd(cf string, key, value []byte) *raft_cmdpb.Request
- func NewRequest(regionID uint64, epoch *metapb.RegionEpoch, requests []*raft_cmdpb.Request) raft_cmdpb.RaftCmdRequest
- func NewSnapCmd() *raft_cmdpb.Request
- func NewTransferLeaderCmd(peer *metapb.Peer) *raft_cmdpb.AdminRequest
- func SleepMS(ms int64)
- type Cluster
- func (c *Cluster) AddFilter(filter Filter)
- func (c *Cluster) AllocPeer(storeID uint64) *metapb.Peer
- func (c *Cluster) CallCommand(request *raft_cmdpb.RaftCmdRequest, timeout time.Duration) (*raft_cmdpb.RaftCmdResponse, *badger.Txn)
- func (c *Cluster) CallCommandOnLeader(request *raft_cmdpb.RaftCmdRequest, timeout time.Duration) (*raft_cmdpb.RaftCmdResponse, *badger.Txn)
- func (c *Cluster) ClearFilters()
- func (c *Cluster) Get(key []byte) []byte
- func (c *Cluster) GetCF(cf string, key []byte) []byte
- func (c *Cluster) GetRandomRegion() *metapb.Region
- func (c *Cluster) GetRegion(key []byte) *metapb.Region
- func (c *Cluster) GetStoreIdsOfRegion(regionID uint64) []uint64
- func (c *Cluster) LeaderOfRegion(regionID uint64) *metapb.Peer
- func (c *Cluster) MustAddPeer(regionID uint64, peer *metapb.Peer)
- func (c *Cluster) MustDelete(key []byte)
- func (c *Cluster) MustDeleteCF(cf string, key []byte)
- func (c *Cluster) MustGet(key []byte, value []byte)
- func (c *Cluster) MustHavePeer(regionID uint64, peer *metapb.Peer)
- func (c *Cluster) MustNonePeer(regionID uint64, peer *metapb.Peer)
- func (c *Cluster) MustPut(key, value []byte)
- func (c *Cluster) MustPutCF(cf string, key, value []byte)
- func (c *Cluster) MustRemovePeer(regionID uint64, peer *metapb.Peer)
- func (c *Cluster) MustTransferLeader(regionID uint64, leader *metapb.Peer)
- func (c *Cluster) Request(key []byte, reqs []*raft_cmdpb.Request, timeout time.Duration) (*raft_cmdpb.RaftCmdResponse, *badger.Txn)
- func (c *Cluster) Scan(start, end []byte) [][]byte
- func (c *Cluster) Shutdown()
- func (c *Cluster) Start()
- func (c *Cluster) StartServer(storeID uint64)
- func (c *Cluster) StopServer(storeID uint64)
- func (c *Cluster) TransferLeader(regionID uint64, leader *metapb.Peer)
- type DropFilter
- type Filter
- type MockSchedulerClient
- func (m *MockSchedulerClient) AddPeer(regionID uint64, peer *metapb.Peer)
- func (m *MockSchedulerClient) AllocID(ctx context.Context) (uint64, error)
- func (m *MockSchedulerClient) AskSplit(ctx context.Context, region *metapb.Region) (*schedulerpb.AskSplitResponse, error)
- func (m *MockSchedulerClient) Bootstrap(ctx context.Context, store *metapb.Store) (*schedulerpb.BootstrapResponse, error)
- func (m *MockSchedulerClient) Close()
- func (m *MockSchedulerClient) GetClusterID(ctx context.Context) uint64
- func (m *MockSchedulerClient) GetRegion(ctx context.Context, key []byte) (*metapb.Region, *metapb.Peer, error)
- func (m *MockSchedulerClient) GetRegionByID(ctx context.Context, regionID uint64) (*metapb.Region, *metapb.Peer, error)
- func (m *MockSchedulerClient) GetStore(ctx context.Context, storeID uint64) (*metapb.Store, error)
- func (m *MockSchedulerClient) IsBootstrapped(ctx context.Context) (bool, error)
- func (m *MockSchedulerClient) PutStore(ctx context.Context, store *metapb.Store) error
- func (m *MockSchedulerClient) RegionHeartbeat(req *schedulerpb.RegionHeartbeatRequest) error
- func (m *MockSchedulerClient) RemovePeer(regionID uint64, peer *metapb.Peer)
- func (m *MockSchedulerClient) SetRegionHeartbeatResponseHandler(storeID uint64, h func(*schedulerpb.RegionHeartbeatResponse))
- func (m *MockSchedulerClient) StoreHeartbeat(ctx context.Context, stats *schedulerpb.StoreStats) error
- func (m *MockSchedulerClient) TransferLeader(regionID uint64, peer *metapb.Peer)
- type MockTransport
- func (t *MockTransport) AddFilter(filter Filter)
- func (t *MockTransport) AddStore(storeID uint64, raftRouter message.RaftRouter, snapMgr *snap.SnapManager)
- func (t *MockTransport) ClearFilters()
- func (t *MockTransport) RemoveStore(storeID uint64)
- func (t *MockTransport) Send(msg *raft_serverpb.RaftMessage) error
- type NodeSimulator
- func (c *NodeSimulator) AddFilter(filter Filter)
- func (c *NodeSimulator) CallCommandOnStore(storeID uint64, request *raft_cmdpb.RaftCmdRequest, timeout time.Duration) (*raft_cmdpb.RaftCmdResponse, *badger.Txn)
- func (c *NodeSimulator) ClearFilters()
- func (c *NodeSimulator) GetStoreIds() []uint64
- func (c *NodeSimulator) RunStore(cfg *config.Config, engine *engine_util.Engines, ctx context.Context) error
- func (c *NodeSimulator) StopStore(storeID uint64)
- type OpAddPeer
- type OpRemovePeer
- type OpTransferLeader
- type Operator
- type OperatorType
- type PartitionFilter
- type Simulator
- type Store
Constants ¶
View Source
const ( OperatorTypeAddPeer = 1 OperatorTypeRemovePeer = 2 OperatorTypeTransferLeader = 3 )
Variables ¶
This section is empty.
Functions ¶
func MustGetCfEqual ¶
func MustGetCfEqual(engine *engine_util.Engines, cf string, key []byte, value []byte)
func MustGetCfNone ¶
func MustGetCfNone(engine *engine_util.Engines, cf string, key []byte)
func MustGetEqual ¶
func MustGetEqual(engine *engine_util.Engines, key []byte, value []byte)
func MustGetNone ¶
func MustGetNone(engine *engine_util.Engines, key []byte)
func NewAdminRequest ¶
func NewAdminRequest(regionID uint64, epoch *metapb.RegionEpoch, request *raft_cmdpb.AdminRequest) *raft_cmdpb.RaftCmdRequest
func NewBaseRequest ¶
func NewBaseRequest(regionID uint64, epoch *metapb.RegionEpoch) raft_cmdpb.RaftCmdRequest
func NewDeleteCfCmd ¶
func NewDeleteCfCmd(cf string, key []byte) *raft_cmdpb.Request
func NewGetCfCmd ¶
func NewGetCfCmd(cf string, key []byte) *raft_cmdpb.Request
func NewPutCfCmd ¶
func NewPutCfCmd(cf string, key, value []byte) *raft_cmdpb.Request
func NewRequest ¶
func NewRequest(regionID uint64, epoch *metapb.RegionEpoch, requests []*raft_cmdpb.Request) raft_cmdpb.RaftCmdRequest
func NewSnapCmd ¶
func NewSnapCmd() *raft_cmdpb.Request
func NewTransferLeaderCmd ¶
func NewTransferLeaderCmd(peer *metapb.Peer) *raft_cmdpb.AdminRequest
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
func NewCluster ¶
func (*Cluster) CallCommand ¶
func (c *Cluster) CallCommand(request *raft_cmdpb.RaftCmdRequest, timeout time.Duration) (*raft_cmdpb.RaftCmdResponse, *badger.Txn)
func (*Cluster) CallCommandOnLeader ¶
func (c *Cluster) CallCommandOnLeader(request *raft_cmdpb.RaftCmdRequest, timeout time.Duration) (*raft_cmdpb.RaftCmdResponse, *badger.Txn)
func (*Cluster) ClearFilters ¶
func (c *Cluster) ClearFilters()
func (*Cluster) GetRandomRegion ¶
func (*Cluster) GetStoreIdsOfRegion ¶
func (*Cluster) MustDelete ¶
func (*Cluster) MustDeleteCF ¶
func (*Cluster) MustRemovePeer ¶
func (*Cluster) MustTransferLeader ¶
func (*Cluster) Request ¶
func (c *Cluster) Request(key []byte, reqs []*raft_cmdpb.Request, timeout time.Duration) (*raft_cmdpb.RaftCmdResponse, *badger.Txn)
func (*Cluster) StartServer ¶
func (*Cluster) StopServer ¶
type DropFilter ¶
type DropFilter struct{}
func (*DropFilter) After ¶
func (f *DropFilter) After()
func (*DropFilter) Before ¶
func (f *DropFilter) Before(msg *rspb.RaftMessage) bool
type Filter ¶
type Filter interface { Before(msgs *rspb.RaftMessage) bool After() }
type MockSchedulerClient ¶
func NewMockSchedulerClient ¶
func NewMockSchedulerClient(clusterID uint64, baseID uint64) *MockSchedulerClient
func (*MockSchedulerClient) AddPeer ¶
func (m *MockSchedulerClient) AddPeer(regionID uint64, peer *metapb.Peer)
Extra API for tests
func (*MockSchedulerClient) AllocID ¶
func (m *MockSchedulerClient) AllocID(ctx context.Context) (uint64, error)
func (*MockSchedulerClient) AskSplit ¶
func (m *MockSchedulerClient) AskSplit(ctx context.Context, region *metapb.Region) (*schedulerpb.AskSplitResponse, error)
func (*MockSchedulerClient) Bootstrap ¶
func (m *MockSchedulerClient) Bootstrap(ctx context.Context, store *metapb.Store) (*schedulerpb.BootstrapResponse, error)
func (*MockSchedulerClient) Close ¶
func (m *MockSchedulerClient) Close()
func (*MockSchedulerClient) GetClusterID ¶
func (m *MockSchedulerClient) GetClusterID(ctx context.Context) uint64
Implement SchedulerClient interface
func (*MockSchedulerClient) GetRegionByID ¶
func (*MockSchedulerClient) IsBootstrapped ¶
func (m *MockSchedulerClient) IsBootstrapped(ctx context.Context) (bool, error)
func (*MockSchedulerClient) RegionHeartbeat ¶
func (m *MockSchedulerClient) RegionHeartbeat(req *schedulerpb.RegionHeartbeatRequest) error
func (*MockSchedulerClient) RemovePeer ¶
func (m *MockSchedulerClient) RemovePeer(regionID uint64, peer *metapb.Peer)
func (*MockSchedulerClient) SetRegionHeartbeatResponseHandler ¶
func (m *MockSchedulerClient) SetRegionHeartbeatResponseHandler(storeID uint64, h func(*schedulerpb.RegionHeartbeatResponse))
func (*MockSchedulerClient) StoreHeartbeat ¶
func (m *MockSchedulerClient) StoreHeartbeat(ctx context.Context, stats *schedulerpb.StoreStats) error
func (*MockSchedulerClient) TransferLeader ¶
func (m *MockSchedulerClient) TransferLeader(regionID uint64, peer *metapb.Peer)
type MockTransport ¶
func NewMockTransport ¶
func NewMockTransport() *MockTransport
func (*MockTransport) AddFilter ¶
func (t *MockTransport) AddFilter(filter Filter)
func (*MockTransport) AddStore ¶
func (t *MockTransport) AddStore(storeID uint64, raftRouter message.RaftRouter, snapMgr *snap.SnapManager)
func (*MockTransport) ClearFilters ¶
func (t *MockTransport) ClearFilters()
func (*MockTransport) RemoveStore ¶
func (t *MockTransport) RemoveStore(storeID uint64)
func (*MockTransport) Send ¶
func (t *MockTransport) Send(msg *raft_serverpb.RaftMessage) error
type NodeSimulator ¶
func NewNodeSimulator ¶
func NewNodeSimulator(schedulerClient scheduler_client.Client) *NodeSimulator
func (*NodeSimulator) AddFilter ¶
func (c *NodeSimulator) AddFilter(filter Filter)
func (*NodeSimulator) CallCommandOnStore ¶
func (c *NodeSimulator) CallCommandOnStore(storeID uint64, request *raft_cmdpb.RaftCmdRequest, timeout time.Duration) (*raft_cmdpb.RaftCmdResponse, *badger.Txn)
func (*NodeSimulator) ClearFilters ¶
func (c *NodeSimulator) ClearFilters()
func (*NodeSimulator) GetStoreIds ¶
func (c *NodeSimulator) GetStoreIds() []uint64
func (*NodeSimulator) RunStore ¶
func (c *NodeSimulator) RunStore(cfg *config.Config, engine *engine_util.Engines, ctx context.Context) error
func (*NodeSimulator) StopStore ¶
func (c *NodeSimulator) StopStore(storeID uint64)
type OpRemovePeer ¶
type OpRemovePeer struct {
// contains filtered or unexported fields
}
type OpTransferLeader ¶
type OpTransferLeader struct {
// contains filtered or unexported fields
}
type Operator ¶
type Operator struct { Type OperatorType Data interface{} }
type OperatorType ¶
type OperatorType int64
type PartitionFilter ¶
type PartitionFilter struct {
// contains filtered or unexported fields
}
func (*PartitionFilter) After ¶
func (f *PartitionFilter) After()
func (*PartitionFilter) Before ¶
func (f *PartitionFilter) Before(msg *rspb.RaftMessage) bool
type Simulator ¶
type Simulator interface { RunStore(raftConf *config.Config, engine *engine_util.Engines, ctx context.Context) error StopStore(storeID uint64) AddFilter(filter Filter) ClearFilters() GetStoreIds() []uint64 CallCommandOnStore(storeID uint64, request *raft_cmdpb.RaftCmdRequest, timeout time.Duration) (*raft_cmdpb.RaftCmdResponse, *badger.Txn) }
Click to show internal directories.
Click to hide internal directories.