Skip to content

Commit

Permalink
*: fix compilation after API change
Browse files Browse the repository at this point in the history
Fixed compilation erros after API change for learner.
  • Loading branch information
jingyih committed Mar 15, 2019
1 parent 4775929 commit a626ff5
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
20 changes: 15 additions & 5 deletions clientv3/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ import (
pb "go.etcd.io/etcd/etcdserver/etcdserverpb"
"go.etcd.io/etcd/pkg/types"

"errors"
"google.golang.org/grpc"
)

type (
Member pb.Member
MemberListResponse pb.MemberListResponse
MemberAddResponse pb.MemberAddResponse
MemberRemoveResponse pb.MemberRemoveResponse
MemberUpdateResponse pb.MemberUpdateResponse
Member pb.Member
MemberListResponse pb.MemberListResponse
MemberAddResponse pb.MemberAddResponse
MemberRemoveResponse pb.MemberRemoveResponse
MemberUpdateResponse pb.MemberUpdateResponse
MemberPromoteResponse pb.MemberPromoteResponse
)

type Cluster interface {
Expand All @@ -43,6 +45,9 @@ type Cluster interface {

// MemberUpdate updates the peer addresses of the member.
MemberUpdate(ctx context.Context, id uint64, peerAddrs []string) (*MemberUpdateResponse, error)

// MemberPromote promotes a member from raft learner (non-voting) to raft voting member.
MemberPromote(ctx context.Context, id uint64) (*MemberPromoteResponse, error)
}

type cluster struct {
Expand Down Expand Up @@ -112,3 +117,8 @@ func (c *cluster) MemberList(ctx context.Context) (*MemberListResponse, error) {
}
return nil, toErr(ctx, err)
}

func (c *cluster) MemberPromote(ctx context.Context, id uint64) (*MemberPromoteResponse, error) {
// TODO: implement
return nil, errors.New("not implemented")
}
4 changes: 4 additions & 0 deletions clientv3/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ func (rcc *retryClusterClient) MemberUpdate(ctx context.Context, in *pb.MemberUp
return rcc.cc.MemberUpdate(ctx, in, opts...)
}

func (rcc *retryClusterClient) MemberPromote(ctx context.Context, in *pb.MemberPromoteRequest, opts ...grpc.CallOption) (resp *pb.MemberPromoteResponse, err error) {
return rcc.cc.MemberPromote(ctx, in, opts...)
}

type retryMaintenanceClient struct {
mc pb.MaintenanceClient
}
Expand Down
6 changes: 6 additions & 0 deletions etcdserver/api/v3rpc/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"time"

"errors"
"go.etcd.io/etcd/etcdserver"
"go.etcd.io/etcd/etcdserver/api"
"go.etcd.io/etcd/etcdserver/api/membership"
Expand Down Expand Up @@ -83,6 +84,11 @@ func (cs *ClusterServer) MemberList(ctx context.Context, r *pb.MemberListRequest
return &pb.MemberListResponse{Header: cs.header(), Members: membs}, nil
}

func (cs *ClusterServer) MemberPromote(ctx context.Context, r *pb.MemberPromoteRequest) (*pb.MemberPromoteResponse, error) {
// TODO: implement
return nil, errors.New("not implemented")
}

func (cs *ClusterServer) header() *pb.ResponseHeader {
return &pb.ResponseHeader{ClusterId: uint64(cs.cluster.ID()), MemberId: uint64(cs.server.ID()), RaftTerm: cs.server.Term()}
}
Expand Down
4 changes: 4 additions & 0 deletions proxy/grpcproxy/adapter/cluster_client_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ func (s *cls2clc) MemberUpdate(ctx context.Context, r *pb.MemberUpdateRequest, o
func (s *cls2clc) MemberRemove(ctx context.Context, r *pb.MemberRemoveRequest, opts ...grpc.CallOption) (*pb.MemberRemoveResponse, error) {
return s.cls.MemberRemove(ctx, r)
}

func (s *cls2clc) MemberPromote(ctx context.Context, r *pb.MemberPromoteRequest, opts ...grpc.CallOption) (*pb.MemberPromoteResponse, error) {
return s.cls.MemberPromote(ctx, r)
}
6 changes: 6 additions & 0 deletions proxy/grpcproxy/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"go.etcd.io/etcd/etcdserver/api/v3rpc/rpctypes"
pb "go.etcd.io/etcd/etcdserver/etcdserverpb"

"errors"
"golang.org/x/time/rate"
gnaming "google.golang.org/grpc/naming"
)
Expand Down Expand Up @@ -175,3 +176,8 @@ func (cp *clusterProxy) MemberList(ctx context.Context, r *pb.MemberListRequest)
resp := (pb.MemberListResponse)(*mresp)
return &resp, err
}

func (cp *clusterProxy) MemberPromote(ctx context.Context, r *pb.MemberPromoteRequest) (*pb.MemberPromoteResponse, error) {
// TODO: implement
return nil, errors.New("not implemented")
}

0 comments on commit a626ff5

Please sign in to comment.