Skip to content

Commit

Permalink
upgrade kvproto to the latest master
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <rleungx@gmail.com>
  • Loading branch information
rleungx committed Jan 13, 2023
1 parent 4f80965 commit 639c7dc
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ type Client interface {
// GetOperator gets the status of operator of the specified region.
GetOperator(ctx context.Context, regionID uint64) (*pdpb.GetOperatorResponse, error)

// LoadGlobalConfig gets the global config from etcd
LoadGlobalConfig(ctx context.Context, configPath string) ([]GlobalConfigItem, error)
// TODO: add LoadGlobalConfig back with new implementation

// StoreGlobalConfig set the config from etcd
StoreGlobalConfig(ctx context.Context, items []GlobalConfigItem) error
// WatchGlobalConfig returns an stream with all global config and updates
Expand Down Expand Up @@ -347,8 +347,6 @@ var (
errClosing = errors.New("[pd] closing")
// errTSOLength is returned when the number of response timestamps is inconsistent with request.
errTSOLength = errors.New("[pd] tso length in rpc response is incorrect")
// errGlobalConfigNotFound is returned when etcd does not contain the globalConfig item
errGlobalConfigNotFound = errors.New("[pd] global config not found")
)

// ClientOption configures client.
Expand Down Expand Up @@ -1822,29 +1820,6 @@ func trimHTTPPrefix(str string) string {
return str
}

// TODO: complete this function with new implementation.
func (c *client) LoadGlobalConfig(ctx context.Context, configPath string) ([]GlobalConfigItem, error) {
resp, err := c.getClient().LoadGlobalConfig(ctx, &pdpb.LoadGlobalConfigRequest{ConfigPath: configPath})
if err != nil {
return nil, err
}
res := make([]GlobalConfigItem, len(resp.GetItems()))
for i, item := range resp.GetItems() {
cfg := GlobalConfigItem{Name: item.GetName()}
if item.Error != nil {
if item.Error.Type == pdpb.ErrorType_GLOBAL_CONFIG_NOT_FOUND {
cfg.Error = errGlobalConfigNotFound
} else {
cfg.Error = errors.New("[pd]" + item.Error.Message)
}
} else {
cfg.Value = item.GetValue()
}
res[i] = cfg
}
return res, nil
}

func (c *client) StoreGlobalConfig(ctx context.Context, items []GlobalConfigItem) error {
resArr := make([]*pdpb.GlobalConfigItem, len(items))
for i, it := range items {
Expand Down

0 comments on commit 639c7dc

Please sign in to comment.