mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: Config.Id -> Config.ID
This commit is contained in:
@@ -52,10 +52,10 @@ func (m *Request) String() string { return proto.CompactTextString(m) }
|
||||
func (*Request) ProtoMessage() {}
|
||||
|
||||
type Config struct {
|
||||
Id int64 `protobuf:"varint,1,req,name=id" json:"id"`
|
||||
Type int64 `protobuf:"varint,2,req,name=type" json:"type"`
|
||||
NodeID int64 `protobuf:"varint,3,req,name=nodeID" json:"nodeID"`
|
||||
Context []byte `protobuf:"bytes,4,opt,name=context" json:"context"`
|
||||
ID int64 `protobuf:"varint,1,req" json:"ID"`
|
||||
Type int64 `protobuf:"varint,2,req" json:"Type"`
|
||||
NodeID int64 `protobuf:"varint,3,req" json:"NodeID"`
|
||||
Context []byte `protobuf:"bytes,4,opt" json:"Context"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ func (m *Config) Unmarshal(data []byte) error {
|
||||
}
|
||||
b := data[index]
|
||||
index++
|
||||
m.Id |= (int64(b) & 0x7F) << shift
|
||||
m.ID |= (int64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
@@ -514,7 +514,7 @@ func (m *Request) Size() (n int) {
|
||||
func (m *Config) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
n += 1 + sovEtcdserver(uint64(m.Id))
|
||||
n += 1 + sovEtcdserver(uint64(m.ID))
|
||||
n += 1 + sovEtcdserver(uint64(m.Type))
|
||||
n += 1 + sovEtcdserver(uint64(m.NodeID))
|
||||
l = len(m.Context)
|
||||
@@ -656,7 +656,7 @@ func (m *Config) MarshalTo(data []byte) (n int, err error) {
|
||||
_ = l
|
||||
data[i] = 0x8
|
||||
i++
|
||||
i = encodeVarintEtcdserver(data, i, uint64(m.Id))
|
||||
i = encodeVarintEtcdserver(data, i, uint64(m.ID))
|
||||
data[i] = 0x10
|
||||
i++
|
||||
i = encodeVarintEtcdserver(data, i, uint64(m.Type))
|
||||
|
||||
@@ -26,8 +26,8 @@ message Request {
|
||||
}
|
||||
|
||||
message Config {
|
||||
required int64 id = 1 [(gogoproto.nullable) = false];
|
||||
required int64 type = 2 [(gogoproto.nullable) = false];
|
||||
required int64 nodeID = 3 [(gogoproto.nullable) = false];
|
||||
optional bytes context = 4 [(gogoproto.nullable) = false];
|
||||
required int64 ID = 1 [(gogoproto.nullable) = false];
|
||||
required int64 Type = 2 [(gogoproto.nullable) = false];
|
||||
required int64 NodeID = 3 [(gogoproto.nullable) = false];
|
||||
optional bytes Context = 4 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ func (s *EtcdServer) run() {
|
||||
panic("TODO: this is bad, what do we do about it?")
|
||||
}
|
||||
s.applyConfig(c)
|
||||
s.w.Trigger(c.Id, nil)
|
||||
s.w.Trigger(c.ID, nil)
|
||||
default:
|
||||
panic("unsupported entry type")
|
||||
}
|
||||
@@ -237,7 +237,7 @@ func (s *EtcdServer) Do(ctx context.Context, r pb.Request) (Response, error) {
|
||||
|
||||
func (s *EtcdServer) AddNode(ctx context.Context, id int64, context []byte) error {
|
||||
req := pb.Config{
|
||||
Id: GenID(),
|
||||
ID: GenID(),
|
||||
Type: configAddNode,
|
||||
NodeID: id,
|
||||
Context: context,
|
||||
@@ -247,7 +247,7 @@ func (s *EtcdServer) AddNode(ctx context.Context, id int64, context []byte) erro
|
||||
|
||||
func (s *EtcdServer) RemoveNode(ctx context.Context, id int64) error {
|
||||
req := pb.Config{
|
||||
Id: GenID(),
|
||||
ID: GenID(),
|
||||
Type: configRemoveNode,
|
||||
NodeID: id,
|
||||
}
|
||||
@@ -262,13 +262,13 @@ func (s *EtcdServer) configure(ctx context.Context, r pb.Config) error {
|
||||
log.Printf("marshal request %#v error: %v", r, err)
|
||||
return err
|
||||
}
|
||||
ch := s.w.Register(r.Id)
|
||||
ch := s.w.Register(r.ID)
|
||||
s.Node.Configure(ctx, data)
|
||||
select {
|
||||
case <-ch:
|
||||
return nil
|
||||
case <-ctx.Done():
|
||||
s.w.Trigger(r.Id, nil) // GC wait
|
||||
s.w.Trigger(r.ID, nil) // GC wait
|
||||
return ctx.Err()
|
||||
case <-s.done:
|
||||
return ErrStopped
|
||||
|
||||
Reference in New Issue
Block a user