Skip to content

Commit

Permalink
Address the comments
Browse files Browse the repository at this point in the history
Signed-off-by: JmPotato <[email protected]>
  • Loading branch information
JmPotato committed Nov 30, 2023
1 parent a7f5fb6 commit a98d738
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
2 changes: 2 additions & 0 deletions client/http/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ func (c *client) GetRegionsByStoreID(ctx context.Context, storeID uint64) (*Regi
}

// GetRegionsReplicatedStateByKeyRange gets the regions replicated state info by key range.
// The keys in the key range should be encoded in the hex bytes format (without encoding to the UTF-8 bytes).
func (c *client) GetRegionsReplicatedStateByKeyRange(ctx context.Context, keyRange *KeyRange) (string, error) {
var state string
err := c.requestWithRetry(ctx,
Expand Down Expand Up @@ -411,6 +412,7 @@ func (c *client) GetHistoryHotRegions(ctx context.Context, req *HistoryHotRegion
}

// GetRegionStatusByKeyRange gets the region status by key range.
// If the `onlyCount` flag is true, the result will only include the count of regions.
// The keys in the key range should be encoded in the UTF-8 bytes format.
func (c *client) GetRegionStatusByKeyRange(ctx context.Context, keyRange *KeyRange, onlyCount bool) (*RegionStats, error) {
var regionStats RegionStats
Expand Down
2 changes: 1 addition & 1 deletion client/http/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func decodeBytes(b []byte) ([]byte, error) {
return buf, nil
}

// keyToKeyHexStr converts a raw key to a hex string after encoding.
// rawKeyToKeyHexStr converts a raw key to a hex string after encoding.
func rawKeyToKeyHexStr(key []byte) string {
if len(key) == 0 {
return ""
Expand Down
5 changes: 3 additions & 2 deletions server/api/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ func newStatsHandler(svr *server.Server, rd *render.Render) *statsHandler {

// @Tags stats
// @Summary Get region statistics of a specified range.
// @Param start_key query string true "Start key"
// @Param end_key query string true "End key"
// @Param start_key query string true "Start key"
// @Param end_key query string true "End key"
// @Param count query bool false "Whether only count the number of regions"
// @Produce json
// @Success 200 {object} statistics.RegionStats
// @Router /stats/region [get]
Expand Down
16 changes: 8 additions & 8 deletions server/api/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ func newStoreHandler(handler *server.Handler, rd *render.Render) *storeHandler {
}
}

// @Tags store
// @Tags store
// @Summary Get a store's information.
// @Param id path integer true "Store Id"
// @Produce json
// @Produce json
// @Success 200 {object} StoreInfo
// @Failure 400 {string} string "The input is invalid."
// @Failure 404 {string} string "The store does not exist."
// @Failure 500 {string} string "PD server failed to proceed the request."
// @Failure 500 {string} string "PD server failed to proceed the request."
// @Router /store/{id} [get]
func (h *storeHandler) GetStore(w http.ResponseWriter, r *http.Request) {
rc := getCluster(r)
Expand Down Expand Up @@ -735,13 +735,13 @@ func (h *storesHandler) GetStoresProgress(w http.ResponseWriter, r *http.Request
}

// @Tags store
// @Summary Get all stores in the cluster.
// @Param state query array true "Specify accepted store states."
// @Summary Get all stores in the cluster.
// @Param state query array true "Specify accepted store states."
// @Produce json
// @Success 200 {object} StoresInfo
// @Success 200 {object} StoresInfo
// @Failure 500 {string} string "PD server failed to proceed the request."
// @Router /stores [get]
// @Deprecated Better to use /stores/check instead.
// @Router /stores [get]
// @Deprecated Better to use /stores/check instead.
func (h *storesHandler) GetAllStores(w http.ResponseWriter, r *http.Request) {
rc := getCluster(r)
stores := rc.GetMetaStores()
Expand Down

0 comments on commit a98d738

Please sign in to comment.