Skip to content

Commit

Permalink
Merge branch 'master' into fix-rule-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
rleungx authored Dec 14, 2023
2 parents 520fbcb + f51f913 commit 4087916
Show file tree
Hide file tree
Showing 47 changed files with 1,169 additions and 427 deletions.
2 changes: 1 addition & 1 deletion client/errs/errno.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var (
ErrClientGetMultiResponse = errors.Normalize("get invalid value response %v, must only one", errors.RFCCodeText("PD:client:ErrClientGetMultiResponse"))
ErrClientGetServingEndpoint = errors.Normalize("get serving endpoint failed", errors.RFCCodeText("PD:client:ErrClientGetServingEndpoint"))
ErrClientFindGroupByKeyspaceID = errors.Normalize("can't find keyspace group by keyspace id", errors.RFCCodeText("PD:client:ErrClientFindGroupByKeyspaceID"))
ErrClientWatchGCSafePointV2Stream = errors.Normalize("watch gc safe point v2 stream failed, %s", errors.RFCCodeText("PD:client:ErrClientWatchGCSafePointV2Stream"))
ErrClientWatchGCSafePointV2Stream = errors.Normalize("watch gc safe point v2 stream failed", errors.RFCCodeText("PD:client:ErrClientWatchGCSafePointV2Stream"))
)

// grpcutil errors
Expand Down
2 changes: 1 addition & 1 deletion client/errs/errs.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func ZapError(err error, causeError ...error) zap.Field {
}
if e, ok := err.(*errors.Error); ok {
if len(causeError) >= 1 {
err = e.Wrap(causeError[0]).FastGenWithCause()
err = e.Wrap(causeError[0])
} else {
err = e.FastGenByArgs()
}
Expand Down
13 changes: 13 additions & 0 deletions client/http/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ const (
store = "/pd/api/v1/store"
Stores = "/pd/api/v1/stores"
StatsRegion = "/pd/api/v1/stats/region"
membersPrefix = "/pd/api/v1/members"
leaderPrefix = "/pd/api/v1/leader"
transferLeader = "/pd/api/v1/leader/transfer"
// Config
Config = "/pd/api/v1/config"
ClusterVersion = "/pd/api/v1/config/cluster-version"
Expand Down Expand Up @@ -124,6 +127,16 @@ func StoreLabelByID(id uint64) string {
return fmt.Sprintf("%s/%d/label", store, id)
}

// LabelByStoreID returns the path of PD HTTP API to set store label.
func LabelByStoreID(storeID int64) string {
return fmt.Sprintf("%s/%d/label", store, storeID)
}

// TransferLeaderByID returns the path of PD HTTP API to transfer leader by ID.
func TransferLeaderByID(leaderID string) string {
return fmt.Sprintf("%s/%s", transferLeader, leaderID)
}

// ConfigWithTTLSeconds returns the config API with the TTL seconds parameter.
func ConfigWithTTLSeconds(ttlSeconds float64) string {
return fmt.Sprintf("%s?ttlSecond=%.0f", Config, ttlSeconds)
Expand Down
Loading

0 comments on commit 4087916

Please sign in to comment.