Documentation ¶
Index ¶
- Variables
- func InitCluster(ctx context.Context, cli pd.Client, httpCli pdHttp.Client) error
- type Case
- type Config
- type Coordinator
- func (c *Coordinator) GetAllETCDCases() map[string]*Config
- func (c *Coordinator) GetAllGRPCCases() map[string]*Config
- func (c *Coordinator) GetAllHTTPCases() map[string]*Config
- func (c *Coordinator) GetETCDCase(name string) (*Config, error)
- func (c *Coordinator) GetGRPCCase(name string) (*Config, error)
- func (c *Coordinator) GetHTTPCase(name string) (*Config, error)
- func (c *Coordinator) SetETCDCase(name string, cfg *Config) error
- func (c *Coordinator) SetGRPCCase(name string, cfg *Config) error
- func (c *Coordinator) SetHTTPCase(name string, cfg *Config) error
- type ETCDCase
- type ETCDCreateFn
- type GRPCCase
- type GRPCCreateFn
- type HTTPCase
- type HTTPCreateFn
Constants ¶
This section is empty.
Variables ¶
var ( // Debug is the flag to print the output of api response for debug. Debug bool )
var ETCDCaseFnMap = map[string]ETCDCreateFn{
"Get": newGetKV(),
"Put": newPutKV(),
"Delete": newDeleteKV(),
"Txn": newTxnKV(),
}
ETCDCaseFnMap is the map for all ETCD case creation function.
var GRPCCaseFnMap = map[string]GRPCCreateFn{
"GetRegion": newGetRegion(),
"GetRegionEnableFollower": newGetRegionEnableFollower(),
"GetStore": newGetStore(),
"GetStores": newGetStores(),
"ScanRegions": newScanRegions(),
"Tso": newTso(),
"UpdateGCSafePoint": newUpdateGCSafePoint(),
"UpdateServiceGCSafePoint": newUpdateServiceGCSafePoint(),
}
GRPCCaseFnMap is the map for all gRPC case creation function.
var HTTPCaseFnMap = map[string]HTTPCreateFn{
"GetRegionStatus": newRegionStats(),
"GetMinResolvedTS": newMinResolvedTS(),
}
HTTPCaseFnMap is the map for all HTTP case creation function.
Functions ¶
Types ¶
type Case ¶
type Case interface { Name() string SetQPS(int64) GetQPS() int64 SetBurst(int64) GetBurst() int64 GetConfig() *Config }
Case is the interface for all cases.
type Coordinator ¶
type Coordinator struct {
// contains filtered or unexported fields
}
Coordinator managers the operation of the gRPC and HTTP case.
func NewCoordinator ¶
func NewCoordinator(ctx context.Context, httpClients []pdHttp.Client, gRPCClients []pd.Client, etcdClients []*clientv3.Client) *Coordinator
NewCoordinator returns a new coordinator.
func (*Coordinator) GetAllETCDCases ¶
func (c *Coordinator) GetAllETCDCases() map[string]*Config
GetAllETCDCases returns the all etcd case configs.
func (*Coordinator) GetAllGRPCCases ¶
func (c *Coordinator) GetAllGRPCCases() map[string]*Config
GetAllGRPCCases returns the all gRPC case configs.
func (*Coordinator) GetAllHTTPCases ¶
func (c *Coordinator) GetAllHTTPCases() map[string]*Config
GetAllHTTPCases returns the all HTTP case configs.
func (*Coordinator) GetETCDCase ¶
func (c *Coordinator) GetETCDCase(name string) (*Config, error)
GetETCDCase returns the etcd case config.
func (*Coordinator) GetGRPCCase ¶
func (c *Coordinator) GetGRPCCase(name string) (*Config, error)
GetGRPCCase returns the gRPC case config.
func (*Coordinator) GetHTTPCase ¶
func (c *Coordinator) GetHTTPCase(name string) (*Config, error)
GetHTTPCase returns the HTTP case config.
func (*Coordinator) SetETCDCase ¶
func (c *Coordinator) SetETCDCase(name string, cfg *Config) error
SetETCDCase sets the config for the specific case.
func (*Coordinator) SetGRPCCase ¶
func (c *Coordinator) SetGRPCCase(name string, cfg *Config) error
SetGRPCCase sets the config for the specific case.
func (*Coordinator) SetHTTPCase ¶
func (c *Coordinator) SetHTTPCase(name string, cfg *Config) error
SetHTTPCase sets the config for the specific case.
type ETCDCase ¶
type ETCDCase interface { Case Init(context.Context, *clientv3.Client) error Unary(context.Context, *clientv3.Client) error }
ETCDCase is the interface for all etcd api cases.
type ETCDCreateFn ¶
type ETCDCreateFn func() ETCDCase
ETCDCreateFn is function type to create ETCDCase.
type GRPCCreateFn ¶
type GRPCCreateFn func() GRPCCase
GRPCCreateFn is function type to create GRPCCase.
type HTTPCreateFn ¶
type HTTPCreateFn func() HTTPCase
HTTPCreateFn is function type to create HTTPCase.