cases

package
v0.0.0-...-1679dbc Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Debug is the flag to print the output of api response for debug.
	Debug bool
)
View Source
var ETCDCaseFnMap = map[string]ETCDCreateFn{
	"Get":    newGetKV(),
	"Put":    newPutKV(),
	"Delete": newDeleteKV(),
	"Txn":    newTxnKV(),
}

ETCDCaseFnMap is the map for all ETCD case creation function.

View Source
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.

View Source
var HTTPCaseFnMap = map[string]HTTPCreateFn{
	"GetRegionStatus":  newRegionStats(),
	"GetMinResolvedTS": newMinResolvedTS(),
}

HTTPCaseFnMap is the map for all HTTP case creation function.

Functions

func InitCluster

func InitCluster(ctx context.Context, cli pd.Client, httpCli pdHttp.Client) error

InitCluster initializes the cluster.

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 Config

type Config struct {
	QPS   int64 `toml:"qps" json:"qps"`
	Burst int64 `toml:"burst" json:"burst"`
}

Config is the configuration for the case.

func (*Config) Clone

func (c *Config) Clone() *Config

Clone returns a cloned configuration.

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 GRPCCase

type GRPCCase interface {
	Case
	Unary(context.Context, pd.Client) error
}

GRPCCase is the interface for all gRPC cases.

type GRPCCreateFn

type GRPCCreateFn func() GRPCCase

GRPCCreateFn is function type to create GRPCCase.

type HTTPCase

type HTTPCase interface {
	Case
	Do(context.Context, pdHttp.Client) error
}

HTTPCase is the interface for all HTTP cases.

type HTTPCreateFn

type HTTPCreateFn func() HTTPCase

HTTPCreateFn is function type to create HTTPCase.

Jump to

Keyboard shortcuts

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