*: remove IsLeader field in Member API server side

This commit is contained in:
Gyu-Ho Lee 2016-04-13 16:19:12 -07:00
parent a553ea8ba7
commit b78886239e
3 changed files with 14 additions and 50 deletions

View File

@ -62,7 +62,7 @@ func (cs *ClusterServer) MemberAdd(ctx context.Context, r *pb.MemberAddRequest)
return &pb.MemberAddResponse{
Header: cs.header(),
Member: &pb.Member{ID: uint64(m.ID), IsLeader: m.ID == cs.server.Leader(), PeerURLs: m.PeerURLs},
Member: &pb.Member{ID: uint64(m.ID), PeerURLs: m.PeerURLs},
}, nil
}
@ -106,7 +106,6 @@ func (cs *ClusterServer) MemberList(ctx context.Context, r *pb.MemberListRequest
protoMembs[i] = &pb.Member{
Name: membs[i].Name,
ID: uint64(membs[i].ID),
IsLeader: membs[i].ID == cs.server.Leader(),
PeerURLs: membs[i].PeerURLs,
ClientURLs: membs[i].ClientURLs,
}

View File

@ -8,20 +8,21 @@ import (
"fmt"
proto "github.com/gogo/protobuf/proto"
math "math"
authpb "github.com/coreos/etcd/auth/authpb"
io "io"
)
import math "math"
import storagepb "github.com/coreos/etcd/storage/storagepb"
import authpb "github.com/coreos/etcd/auth/authpb"
import (
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
)
import io "io"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
@ -1094,11 +1095,10 @@ type Member struct {
ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
// If the member is not started, name will be an empty string.
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
IsLeader bool `protobuf:"varint,3,opt,name=IsLeader,proto3" json:"IsLeader,omitempty"`
PeerURLs []string `protobuf:"bytes,4,rep,name=peerURLs" json:"peerURLs,omitempty"`
PeerURLs []string `protobuf:"bytes,3,rep,name=peerURLs" json:"peerURLs,omitempty"`
// If the member is not started, client_URLs will be an zero length
// string array.
ClientURLs []string `protobuf:"bytes,5,rep,name=clientURLs" json:"clientURLs,omitempty"`
ClientURLs []string `protobuf:"bytes,4,rep,name=clientURLs" json:"clientURLs,omitempty"`
}
func (m *Member) Reset() { *m = Member{} }
@ -4138,19 +4138,9 @@ func (m *Member) MarshalTo(data []byte) (int, error) {
i = encodeVarintRpc(data, i, uint64(len(m.Name)))
i += copy(data[i:], m.Name)
}
if m.IsLeader {
data[i] = 0x18
i++
if m.IsLeader {
data[i] = 1
} else {
data[i] = 0
}
i++
}
if len(m.PeerURLs) > 0 {
for _, s := range m.PeerURLs {
data[i] = 0x22
data[i] = 0x1a
i++
l = len(s)
for l >= 1<<7 {
@ -4165,7 +4155,7 @@ func (m *Member) MarshalTo(data []byte) (int, error) {
}
if len(m.ClientURLs) > 0 {
for _, s := range m.ClientURLs {
data[i] = 0x2a
data[i] = 0x22
i++
l = len(s)
for l >= 1<<7 {
@ -5916,9 +5906,6 @@ func (m *Member) Size() (n int) {
if l > 0 {
n += 1 + l + sovRpc(uint64(l))
}
if m.IsLeader {
n += 2
}
if len(m.PeerURLs) > 0 {
for _, s := range m.PeerURLs {
l = len(s)
@ -9759,26 +9746,6 @@ func (m *Member) Unmarshal(data []byte) error {
m.Name = string(data[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field IsLeader", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowRpc
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
v |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.IsLeader = bool(v != 0)
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field PeerURLs", wireType)
}
@ -9807,7 +9774,7 @@ func (m *Member) Unmarshal(data []byte) error {
}
m.PeerURLs = append(m.PeerURLs, string(data[iNdEx:postIndex]))
iNdEx = postIndex
case 5:
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ClientURLs", wireType)
}

View File

@ -417,11 +417,10 @@ message Member {
uint64 ID = 1;
// If the member is not started, name will be an empty string.
string name = 2;
bool IsLeader = 3;
repeated string peerURLs = 4;
repeated string peerURLs = 3;
// If the member is not started, client_URLs will be an zero length
// string array.
repeated string clientURLs = 5;
repeated string clientURLs = 4;
}
message MemberAddRequest {
@ -459,7 +458,6 @@ message MemberListResponse {
}
message DefragmentRequest {
}
message DefragmentResponse {