Skip to content

Commit

Permalink
fix some coding style issues
Browse files Browse the repository at this point in the history
Signed-off-by: Boyang Lyu <boyangly@gmail.com>
  • Loading branch information
JackL9u committed Aug 8, 2024
1 parent c307b89 commit 637c50c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
2 changes: 1 addition & 1 deletion client/http/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const (
Status = "/pd/api/v1/status"
Version = "/pd/api/v1/version"
operators = "/pd/api/v1/operators"
safepoint = "pd/api/v1/gc/safepoint"
safepoint = "/pd/api/v1/gc/safepoint"
// Micro Service
microServicePrefix = "/pd/api/v2/ms"
// Keyspace
Expand Down
16 changes: 8 additions & 8 deletions client/http/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -1029,28 +1029,28 @@ func (c *client) GetKeyspaceMetaByName(ctx context.Context, keyspaceName string)

// GetGCSafePoint get the gc_safepoint
func (c *client) GetGCSafePoint(ctx context.Context) (ListServiceGCSafepoint, error) {
var gcsafepoint ListServiceGCSafepoint
var gcSafePoint ListServiceGCSafepoint
err := c.request(ctx, newRequestInfo().
WithName(GetGCSafePointName).
WithURI(safepoint).
WithMethod(http.MethodGet).
WithResp(&gcsafepoint))
WithResp(&gcSafePoint))
if err != nil {
return gcsafepoint, err
return gcSafePoint, err
}
return gcsafepoint, nil
return gcSafePoint, nil
}

// DeleteGCSafePoint deletes a gc_safepoint
func (c *client) DeleteGCSafePoint(ctx context.Context, service_id string) (string, error) {
// DeleteGCSafePoint deletes a gc safepoint
func (c *client) DeleteGCSafePoint(ctx context.Context, serviceId string) (string, error) {
var msg string
err := c.request(ctx, newRequestInfo().
WithName(DeleteGCSafePointName).
WithURI(safepoint+"/"+service_id).
WithURI(safepoint+"/"+serviceId).
WithMethod(http.MethodDelete).
WithResp(&msg))
if err != nil {
return msg, err
}
return msg, nil
}
}
9 changes: 1 addition & 8 deletions tools/pd-ctl/pdctl/command/gc_safepoint_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
package command

import (
"encoding/json"
"sort"

"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -52,12 +50,7 @@ func showSSPs(cmd *cobra.Command, _ []string) {
sort.Slice(safepoint.ServiceGCSafepoints, func(i, j int) bool {
return safepoint.ServiceGCSafepoints[i].SafePoint < safepoint.ServiceGCSafepoints[j].SafePoint
})
data, err := json.MarshalIndent(safepoint, "", " ")
if err != nil {
cmd.Printf("Failed to marshal service GC safepoint: %s\n", err)
return
}
jsonPrint(cmd, string(data))
jsonPrint(cmd, safepoint)
}

func deleteSSP(cmd *cobra.Command, args []string) {
Expand Down

0 comments on commit 637c50c

Please sign in to comment.