etcdctlv3: consolidate dial code; use clientv3

This commit is contained in:
Anthony Romano
2016-01-27 10:25:04 -08:00
parent 5ccf7f5151
commit 9a5a3ebc79
9 changed files with 36 additions and 163 deletions

View File

@ -20,7 +20,6 @@ import (
"github.com/coreos/etcd/Godeps/_workspace/src/github.com/spf13/cobra"
"github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context"
"github.com/coreos/etcd/Godeps/_workspace/src/google.golang.org/grpc"
pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
)
@ -44,17 +43,6 @@ func compactionCommandFunc(cmd *cobra.Command, args []string) {
ExitWithError(ExitError, err)
}
endpoint, err := cmd.Flags().GetString("endpoint")
if err != nil {
ExitWithError(ExitError, err)
}
// TODO: enable grpc.WithTransportCredentials(creds)
conn, err := grpc.Dial(endpoint, grpc.WithInsecure())
if err != nil {
ExitWithError(ExitBadConnection, err)
}
kv := pb.NewKVClient(conn)
req := &pb.CompactionRequest{Revision: rev}
kv.Compact(context.Background(), req)
mustClient(cmd).KV.Compact(context.Background(), req)
}