Skip to content

Commit

Permalink
rename api
Browse files Browse the repository at this point in the history
Signed-off-by: husharp <jinhao.hu@pingcap.com>
  • Loading branch information
HuSharp committed Jan 3, 2024
1 parent fa30740 commit edc498f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions client/http/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ const (
PProfGoroutine = "/pd/api/v1/debug/pprof/goroutine"
// Others
MinResolvedTSPrefix = "/pd/api/v1/min-resolved-ts"
ClusterPrefix = "/pd/api/v1/cluster"
ClusterStatusPrefix = "/pd/api/v1/cluster/status"
Cluster = "/pd/api/v1/cluster"
ClusterStatus = "/pd/api/v1/cluster/status"
Status = "/pd/api/v1/status"
Version = "/pd/api/v1/version"
// Micro Service
Expand Down
10 changes: 5 additions & 5 deletions client/http/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type Client interface {
SetScheduleConfig(context.Context, map[string]interface{}) error
GetClusterVersion(context.Context) (string, error)
GetCluster(context.Context) (*metapb.Cluster, error)
GetClusterStatus(context.Context) (*ClusterStatus, error)
GetClusterStatus(context.Context) (*ClusterState, error)
GetReplicateConfig(context.Context) (map[string]interface{}, error)
/* Scheduler-related interfaces */
GetSchedulers(context.Context) ([]string, error)
Expand Down Expand Up @@ -369,7 +369,7 @@ func (c *client) GetCluster(ctx context.Context) (*metapb.Cluster, error) {
var clusterInfo *metapb.Cluster
err := c.request(ctx, newRequestInfo().
WithName(getClusterName).
WithURI(ClusterPrefix).
WithURI(Cluster).
WithMethod(http.MethodGet).
WithResp(&clusterInfo))
if err != nil {
Expand All @@ -379,11 +379,11 @@ func (c *client) GetCluster(ctx context.Context) (*metapb.Cluster, error) {
}

// GetClusterStatus gets the cluster status.
func (c *client) GetClusterStatus(ctx context.Context) (*ClusterStatus, error) {
var clusterStatus *ClusterStatus
func (c *client) GetClusterStatus(ctx context.Context) (*ClusterState, error) {
var clusterStatus *ClusterState
err := c.request(ctx, newRequestInfo().
WithName(getClusterName).
WithURI(ClusterStatusPrefix).
WithURI(ClusterStatus).
WithMethod(http.MethodGet).
WithResp(&clusterStatus))
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions client/http/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import (
"github.com/pingcap/kvproto/pkg/pdpb"
)

// ClusterStatus saves some cluster state information.
// ClusterState saves some cluster state information.
// NOTE: This type sync with https://github.com/tikv/pd/blob/5eae459c01a797cbd0c416054c6f0cad16b8740a/server/cluster/cluster.go#L173
type ClusterStatus struct {
type ClusterState struct {
RaftBootstrapTime time.Time `json:"raft_bootstrap_time,omitempty"`
IsInitialized bool `json:"is_initialized"`
ReplicationStatus string `json:"replication_status"`
Expand Down
4 changes: 2 additions & 2 deletions tools/pd-ctl/pdctl/command/cluster_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func NewClusterStatusCommand() *cobra.Command {
return r
}

func showClusterCommandFunc(cmd *cobra.Command, args []string) {
func showClusterCommandFunc(cmd *cobra.Command, _ []string) {
info, err := PDCli.GetCluster(context.Background())
if err != nil {
cmd.Printf("Failed to get the cluster information: %s\n", err)
Expand All @@ -50,7 +50,7 @@ func showClusterCommandFunc(cmd *cobra.Command, args []string) {
jsonPrint(cmd, info)
}

func showClusterStatusCommandFunc(cmd *cobra.Command, args []string) {
func showClusterStatusCommandFunc(cmd *cobra.Command, _ []string) {
status, err := PDCli.GetClusterStatus(context.Background())
if err != nil {
cmd.Printf("Failed to get the cluster status: %s\n", err)
Expand Down

0 comments on commit edc498f

Please sign in to comment.