Update github.com/coreos/etcd to v3.3.15

Change-Id: I1b16ca712238219d082427c75dd6bc404794abbf
This commit is contained in:
Davanum Srinivas
2019-08-20 08:14:17 -04:00
parent 3d6ae5ef12
commit 108ccea448
101 changed files with 16439 additions and 6014 deletions

View File

@@ -11,8 +11,10 @@ go_library(
"//vendor/github.com/coreos/etcd/mvcc/mvccpb:go_default_library",
"//vendor/github.com/gogo/protobuf/gogoproto:go_default_library",
"//vendor/github.com/golang/protobuf/proto:go_default_library",
"//vendor/golang.org/x/net/context:go_default_library",
"//vendor/google.golang.org/genproto/googleapis/api/annotations:go_default_library",
"//vendor/google.golang.org/grpc:go_default_library",
"//vendor/google.golang.org/grpc/codes:go_default_library",
"//vendor/google.golang.org/grpc/status:go_default_library",
],
)

File diff suppressed because it is too large Load Diff

View File

@@ -10,8 +10,10 @@ go_library(
"//vendor/github.com/coreos/etcd/etcdserver/etcdserverpb:go_default_library",
"//vendor/github.com/gogo/protobuf/gogoproto:go_default_library",
"//vendor/github.com/golang/protobuf/proto:go_default_library",
"//vendor/golang.org/x/net/context:go_default_library",
"//vendor/google.golang.org/genproto/googleapis/api/annotations:go_default_library",
"//vendor/google.golang.org/grpc:go_default_library",
"//vendor/google.golang.org/grpc/codes:go_default_library",
"//vendor/google.golang.org/grpc/status:go_default_library",
],
)

View File

@@ -1,36 +1,22 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: v3lock.proto
/*
Package v3lockpb is a generated protocol buffer package.
It is generated from these files:
v3lock.proto
It has these top-level messages:
LockRequest
LockResponse
UnlockRequest
UnlockResponse
*/
package v3lockpb
import (
"fmt"
proto "github.com/golang/protobuf/proto"
context "context"
fmt "fmt"
io "io"
math "math"
_ "github.com/gogo/protobuf/gogoproto"
math_bits "math/bits"
etcdserverpb "github.com/coreos/etcd/etcdserver/etcdserverpb"
context "golang.org/x/net/context"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/golang/protobuf/proto"
_ "google.golang.org/genproto/googleapis/api/annotations"
grpc "google.golang.org/grpc"
io "io"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// Reference imports to suppress errors if they are not otherwise used.
@@ -52,13 +38,44 @@ type LockRequest struct {
// the lock is automatically released. Calls to Lock with the same lease will
// be treated as a single acquistion; locking twice with the same lease is a
// no-op.
Lease int64 `protobuf:"varint,2,opt,name=lease,proto3" json:"lease,omitempty"`
Lease int64 `protobuf:"varint,2,opt,name=lease,proto3" json:"lease,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *LockRequest) Reset() { *m = LockRequest{} }
func (m *LockRequest) String() string { return proto.CompactTextString(m) }
func (*LockRequest) ProtoMessage() {}
func (*LockRequest) Descriptor() ([]byte, []int) { return fileDescriptorV3Lock, []int{0} }
func (m *LockRequest) Reset() { *m = LockRequest{} }
func (m *LockRequest) String() string { return proto.CompactTextString(m) }
func (*LockRequest) ProtoMessage() {}
func (*LockRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_52389b3e2f253201, []int{0}
}
func (m *LockRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *LockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_LockRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *LockRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_LockRequest.Merge(m, src)
}
func (m *LockRequest) XXX_Size() int {
return m.Size()
}
func (m *LockRequest) XXX_DiscardUnknown() {
xxx_messageInfo_LockRequest.DiscardUnknown(m)
}
var xxx_messageInfo_LockRequest proto.InternalMessageInfo
func (m *LockRequest) GetName() []byte {
if m != nil {
@@ -75,17 +92,48 @@ func (m *LockRequest) GetLease() int64 {
}
type LockResponse struct {
Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
// key is a key that will exist on etcd for the duration that the Lock caller
// owns the lock. Users should not modify this key or the lock may exhibit
// undefined behavior.
Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *LockResponse) Reset() { *m = LockResponse{} }
func (m *LockResponse) String() string { return proto.CompactTextString(m) }
func (*LockResponse) ProtoMessage() {}
func (*LockResponse) Descriptor() ([]byte, []int) { return fileDescriptorV3Lock, []int{1} }
func (m *LockResponse) Reset() { *m = LockResponse{} }
func (m *LockResponse) String() string { return proto.CompactTextString(m) }
func (*LockResponse) ProtoMessage() {}
func (*LockResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_52389b3e2f253201, []int{1}
}
func (m *LockResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *LockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_LockResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *LockResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_LockResponse.Merge(m, src)
}
func (m *LockResponse) XXX_Size() int {
return m.Size()
}
func (m *LockResponse) XXX_DiscardUnknown() {
xxx_messageInfo_LockResponse.DiscardUnknown(m)
}
var xxx_messageInfo_LockResponse proto.InternalMessageInfo
func (m *LockResponse) GetHeader() *etcdserverpb.ResponseHeader {
if m != nil {
@@ -103,13 +151,44 @@ func (m *LockResponse) GetKey() []byte {
type UnlockRequest struct {
// key is the lock ownership key granted by Lock.
Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UnlockRequest) Reset() { *m = UnlockRequest{} }
func (m *UnlockRequest) String() string { return proto.CompactTextString(m) }
func (*UnlockRequest) ProtoMessage() {}
func (*UnlockRequest) Descriptor() ([]byte, []int) { return fileDescriptorV3Lock, []int{2} }
func (m *UnlockRequest) Reset() { *m = UnlockRequest{} }
func (m *UnlockRequest) String() string { return proto.CompactTextString(m) }
func (*UnlockRequest) ProtoMessage() {}
func (*UnlockRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_52389b3e2f253201, []int{2}
}
func (m *UnlockRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *UnlockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_UnlockRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *UnlockRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_UnlockRequest.Merge(m, src)
}
func (m *UnlockRequest) XXX_Size() int {
return m.Size()
}
func (m *UnlockRequest) XXX_DiscardUnknown() {
xxx_messageInfo_UnlockRequest.DiscardUnknown(m)
}
var xxx_messageInfo_UnlockRequest proto.InternalMessageInfo
func (m *UnlockRequest) GetKey() []byte {
if m != nil {
@@ -119,13 +198,44 @@ func (m *UnlockRequest) GetKey() []byte {
}
type UnlockResponse struct {
Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UnlockResponse) Reset() { *m = UnlockResponse{} }
func (m *UnlockResponse) String() string { return proto.CompactTextString(m) }
func (*UnlockResponse) ProtoMessage() {}
func (*UnlockResponse) Descriptor() ([]byte, []int) { return fileDescriptorV3Lock, []int{3} }
func (m *UnlockResponse) Reset() { *m = UnlockResponse{} }
func (m *UnlockResponse) String() string { return proto.CompactTextString(m) }
func (*UnlockResponse) ProtoMessage() {}
func (*UnlockResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_52389b3e2f253201, []int{3}
}
func (m *UnlockResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *UnlockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_UnlockResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *UnlockResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_UnlockResponse.Merge(m, src)
}
func (m *UnlockResponse) XXX_Size() int {
return m.Size()
}
func (m *UnlockResponse) XXX_DiscardUnknown() {
xxx_messageInfo_UnlockResponse.DiscardUnknown(m)
}
var xxx_messageInfo_UnlockResponse proto.InternalMessageInfo
func (m *UnlockResponse) GetHeader() *etcdserverpb.ResponseHeader {
if m != nil {
@@ -141,6 +251,33 @@ func init() {
proto.RegisterType((*UnlockResponse)(nil), "v3lockpb.UnlockResponse")
}
func init() { proto.RegisterFile("v3lock.proto", fileDescriptor_52389b3e2f253201) }
var fileDescriptor_52389b3e2f253201 = []byte{
// 335 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x33, 0xce, 0xc9,
0x4f, 0xce, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x80, 0xf0, 0x0a, 0x92, 0xa4, 0x44,
0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x82, 0xfa, 0x20, 0x16, 0x44, 0x5e, 0x4a, 0x2d, 0xb5, 0x24, 0x39,
0x45, 0x1f, 0x44, 0x14, 0xa7, 0x16, 0x95, 0xa5, 0x16, 0x21, 0x31, 0x0b, 0x92, 0xf4, 0x8b, 0x0a,
0x92, 0xa1, 0xea, 0x64, 0xd2, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, 0xf5, 0x13,
0xf3, 0xf2, 0xf2, 0x4b, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0x21, 0xb2, 0x4a, 0xe6, 0x5c, 0xdc,
0x3e, 0xf9, 0xc9, 0xd9, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x42, 0x42, 0x5c, 0x2c, 0x79,
0x89, 0xb9, 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x3c, 0x41, 0x60, 0xb6, 0x90, 0x08, 0x17, 0x6b,
0x4e, 0x6a, 0x62, 0x71, 0xaa, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x73, 0x10, 0x84, 0xa3, 0x14, 0xc6,
0xc5, 0x03, 0xd1, 0x58, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0x2a, 0x64, 0xc2, 0xc5, 0x96, 0x91, 0x9a,
0x98, 0x92, 0x5a, 0x04, 0xd6, 0xcb, 0x6d, 0x24, 0xa3, 0x87, 0xec, 0x1e, 0x3d, 0x98, 0x3a, 0x0f,
0xb0, 0x9a, 0x20, 0xa8, 0x5a, 0x21, 0x01, 0x2e, 0xe6, 0xec, 0xd4, 0x4a, 0xb0, 0xc9, 0x3c, 0x41,
0x20, 0xa6, 0x92, 0x22, 0x17, 0x6f, 0x68, 0x5e, 0x0e, 0x92, 0x93, 0xa0, 0x4a, 0x18, 0x11, 0x4a,
0xdc, 0xb8, 0xf8, 0x60, 0x4a, 0x28, 0xb1, 0xdc, 0x68, 0x07, 0x23, 0x17, 0x0b, 0xc8, 0x0f, 0x42,
0xc1, 0x50, 0x5a, 0x54, 0x0f, 0x16, 0xe6, 0x7a, 0x48, 0x81, 0x22, 0x25, 0x86, 0x2e, 0x0c, 0x31,
0x4d, 0x49, 0xa6, 0xe9, 0xf2, 0x93, 0xc9, 0x4c, 0x62, 0x4a, 0x82, 0xfa, 0x65, 0xc6, 0x49, 0xa9,
0x25, 0x89, 0xfa, 0x20, 0x45, 0x60, 0xc2, 0x8a, 0x51, 0x4b, 0x28, 0x9a, 0x8b, 0x0d, 0xe2, 0x4a,
0x21, 0x71, 0x84, 0x7e, 0x14, 0xaf, 0x49, 0x49, 0x60, 0x4a, 0x40, 0x8d, 0x96, 0x03, 0x1b, 0x2d,
0xa1, 0x24, 0x8c, 0x62, 0x74, 0x69, 0x1e, 0xd4, 0x70, 0x27, 0x81, 0x13, 0x8f, 0xe4, 0x18, 0x2f,
0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc6, 0x63, 0x39, 0x86, 0x24, 0x36, 0x70, 0x7c,
0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x10, 0x82, 0x89, 0xf0, 0x45, 0x02, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
@@ -149,8 +286,9 @@ var _ grpc.ClientConn
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// Client API for Lock service
// LockClient is the client API for Lock service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type LockClient interface {
// Lock acquires a distributed shared lock on a given named lock.
// On success, it will return a unique key that exists so long as the
@@ -175,7 +313,7 @@ func NewLockClient(cc *grpc.ClientConn) LockClient {
func (c *lockClient) Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (*LockResponse, error) {
out := new(LockResponse)
err := grpc.Invoke(ctx, "/v3lockpb.Lock/Lock", in, out, c.cc, opts...)
err := c.cc.Invoke(ctx, "/v3lockpb.Lock/Lock", in, out, opts...)
if err != nil {
return nil, err
}
@@ -184,15 +322,14 @@ func (c *lockClient) Lock(ctx context.Context, in *LockRequest, opts ...grpc.Cal
func (c *lockClient) Unlock(ctx context.Context, in *UnlockRequest, opts ...grpc.CallOption) (*UnlockResponse, error) {
out := new(UnlockResponse)
err := grpc.Invoke(ctx, "/v3lockpb.Lock/Unlock", in, out, c.cc, opts...)
err := c.cc.Invoke(ctx, "/v3lockpb.Lock/Unlock", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Lock service
// LockServer is the server API for Lock service.
type LockServer interface {
// Lock acquires a distributed shared lock on a given named lock.
// On success, it will return a unique key that exists so long as the
@@ -207,6 +344,17 @@ type LockServer interface {
Unlock(context.Context, *UnlockRequest) (*UnlockResponse, error)
}
// UnimplementedLockServer can be embedded to have forward compatible implementations.
type UnimplementedLockServer struct {
}
func (*UnimplementedLockServer) Lock(ctx context.Context, req *LockRequest) (*LockResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Lock not implemented")
}
func (*UnimplementedLockServer) Unlock(ctx context.Context, req *UnlockRequest) (*UnlockResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Unlock not implemented")
}
func RegisterLockServer(s *grpc.Server, srv LockServer) {
s.RegisterService(&_Lock_serviceDesc, srv)
}
@@ -267,7 +415,7 @@ var _Lock_serviceDesc = grpc.ServiceDesc{
func (m *LockRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
@@ -275,28 +423,38 @@ func (m *LockRequest) Marshal() (dAtA []byte, err error) {
}
func (m *LockRequest) MarshalTo(dAtA []byte) (int, error) {
var i int
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *LockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Name) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintV3Lock(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if m.Lease != 0 {
dAtA[i] = 0x10
i++
i = encodeVarintV3Lock(dAtA, i, uint64(m.Lease))
i--
dAtA[i] = 0x10
}
return i, nil
if len(m.Name) > 0 {
i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintV3Lock(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *LockResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
@@ -304,33 +462,45 @@ func (m *LockResponse) Marshal() (dAtA []byte, err error) {
}
func (m *LockResponse) MarshalTo(dAtA []byte) (int, error) {
var i int
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *LockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Header != nil {
dAtA[i] = 0xa
i++
i = encodeVarintV3Lock(dAtA, i, uint64(m.Header.Size()))
n1, err := m.Header.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n1
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Key) > 0 {
dAtA[i] = 0x12
i++
i -= len(m.Key)
copy(dAtA[i:], m.Key)
i = encodeVarintV3Lock(dAtA, i, uint64(len(m.Key)))
i += copy(dAtA[i:], m.Key)
i--
dAtA[i] = 0x12
}
return i, nil
if m.Header != nil {
{
size, err := m.Header.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintV3Lock(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *UnlockRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
@@ -338,23 +508,33 @@ func (m *UnlockRequest) Marshal() (dAtA []byte, err error) {
}
func (m *UnlockRequest) MarshalTo(dAtA []byte) (int, error) {
var i int
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *UnlockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Key) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintV3Lock(dAtA, i, uint64(len(m.Key)))
i += copy(dAtA[i:], m.Key)
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
if len(m.Key) > 0 {
i -= len(m.Key)
copy(dAtA[i:], m.Key)
i = encodeVarintV3Lock(dAtA, i, uint64(len(m.Key)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *UnlockResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
@@ -362,33 +542,49 @@ func (m *UnlockResponse) Marshal() (dAtA []byte, err error) {
}
func (m *UnlockResponse) MarshalTo(dAtA []byte) (int, error) {
var i int
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *UnlockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Header != nil {
dAtA[i] = 0xa
i++
i = encodeVarintV3Lock(dAtA, i, uint64(m.Header.Size()))
n2, err := m.Header.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n2
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
if m.Header != nil {
{
size, err := m.Header.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintV3Lock(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintV3Lock(dAtA []byte, offset int, v uint64) int {
offset -= sovV3Lock(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return offset + 1
return base
}
func (m *LockRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Name)
@@ -398,10 +594,16 @@ func (m *LockRequest) Size() (n int) {
if m.Lease != 0 {
n += 1 + sovV3Lock(uint64(m.Lease))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func (m *LockResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Header != nil {
@@ -412,38 +614,46 @@ func (m *LockResponse) Size() (n int) {
if l > 0 {
n += 1 + l + sovV3Lock(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func (m *UnlockRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Key)
if l > 0 {
n += 1 + l + sovV3Lock(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func (m *UnlockResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Header != nil {
l = m.Header.Size()
n += 1 + l + sovV3Lock(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func sovV3Lock(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
return (math_bits.Len64(x|1) + 6) / 7
}
func sozV3Lock(x uint64) (n int) {
return sovV3Lock(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@@ -463,7 +673,7 @@ func (m *LockRequest) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -491,7 +701,7 @@ func (m *LockRequest) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= (int(b) & 0x7F) << shift
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -500,6 +710,9 @@ func (m *LockRequest) Unmarshal(dAtA []byte) error {
return ErrInvalidLengthV3Lock
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthV3Lock
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
@@ -522,7 +735,7 @@ func (m *LockRequest) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.Lease |= (int64(b) & 0x7F) << shift
m.Lease |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -536,9 +749,13 @@ func (m *LockRequest) Unmarshal(dAtA []byte) error {
if skippy < 0 {
return ErrInvalidLengthV3Lock
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthV3Lock
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
@@ -563,7 +780,7 @@ func (m *LockResponse) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -591,7 +808,7 @@ func (m *LockResponse) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -600,6 +817,9 @@ func (m *LockResponse) Unmarshal(dAtA []byte) error {
return ErrInvalidLengthV3Lock
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthV3Lock
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
@@ -624,7 +844,7 @@ func (m *LockResponse) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= (int(b) & 0x7F) << shift
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -633,6 +853,9 @@ func (m *LockResponse) Unmarshal(dAtA []byte) error {
return ErrInvalidLengthV3Lock
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthV3Lock
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
@@ -650,9 +873,13 @@ func (m *LockResponse) Unmarshal(dAtA []byte) error {
if skippy < 0 {
return ErrInvalidLengthV3Lock
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthV3Lock
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
@@ -677,7 +904,7 @@ func (m *UnlockRequest) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -705,7 +932,7 @@ func (m *UnlockRequest) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= (int(b) & 0x7F) << shift
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -714,6 +941,9 @@ func (m *UnlockRequest) Unmarshal(dAtA []byte) error {
return ErrInvalidLengthV3Lock
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthV3Lock
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
@@ -731,9 +961,13 @@ func (m *UnlockRequest) Unmarshal(dAtA []byte) error {
if skippy < 0 {
return ErrInvalidLengthV3Lock
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthV3Lock
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
@@ -758,7 +992,7 @@ func (m *UnlockResponse) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -786,7 +1020,7 @@ func (m *UnlockResponse) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -795,6 +1029,9 @@ func (m *UnlockResponse) Unmarshal(dAtA []byte) error {
return ErrInvalidLengthV3Lock
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthV3Lock
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
@@ -814,9 +1051,13 @@ func (m *UnlockResponse) Unmarshal(dAtA []byte) error {
if skippy < 0 {
return ErrInvalidLengthV3Lock
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthV3Lock
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
@@ -880,10 +1121,13 @@ func skipV3Lock(dAtA []byte) (n int, err error) {
break
}
}
iNdEx += length
if length < 0 {
return 0, ErrInvalidLengthV3Lock
}
iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthV3Lock
}
return iNdEx, nil
case 3:
for {
@@ -912,6 +1156,9 @@ func skipV3Lock(dAtA []byte) (n int, err error) {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthV3Lock
}
}
return iNdEx, nil
case 4:
@@ -930,30 +1177,3 @@ var (
ErrInvalidLengthV3Lock = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowV3Lock = fmt.Errorf("proto: integer overflow")
)
func init() { proto.RegisterFile("v3lock.proto", fileDescriptorV3Lock) }
var fileDescriptorV3Lock = []byte{
// 335 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x33, 0xce, 0xc9,
0x4f, 0xce, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x80, 0xf0, 0x0a, 0x92, 0xa4, 0x44,
0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x82, 0xfa, 0x20, 0x16, 0x44, 0x5e, 0x4a, 0x2d, 0xb5, 0x24, 0x39,
0x45, 0x1f, 0x44, 0x14, 0xa7, 0x16, 0x95, 0xa5, 0x16, 0x21, 0x31, 0x0b, 0x92, 0xf4, 0x8b, 0x0a,
0x92, 0xa1, 0xea, 0x64, 0xd2, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, 0xf5, 0x13,
0xf3, 0xf2, 0xf2, 0x4b, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0x21, 0xb2, 0x4a, 0xe6, 0x5c, 0xdc,
0x3e, 0xf9, 0xc9, 0xd9, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x42, 0x42, 0x5c, 0x2c, 0x79,
0x89, 0xb9, 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x3c, 0x41, 0x60, 0xb6, 0x90, 0x08, 0x17, 0x6b,
0x4e, 0x6a, 0x62, 0x71, 0xaa, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x73, 0x10, 0x84, 0xa3, 0x14, 0xc6,
0xc5, 0x03, 0xd1, 0x58, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0x2a, 0x64, 0xc2, 0xc5, 0x96, 0x91, 0x9a,
0x98, 0x92, 0x5a, 0x04, 0xd6, 0xcb, 0x6d, 0x24, 0xa3, 0x87, 0xec, 0x1e, 0x3d, 0x98, 0x3a, 0x0f,
0xb0, 0x9a, 0x20, 0xa8, 0x5a, 0x21, 0x01, 0x2e, 0xe6, 0xec, 0xd4, 0x4a, 0xb0, 0xc9, 0x3c, 0x41,
0x20, 0xa6, 0x92, 0x22, 0x17, 0x6f, 0x68, 0x5e, 0x0e, 0x92, 0x93, 0xa0, 0x4a, 0x18, 0x11, 0x4a,
0xdc, 0xb8, 0xf8, 0x60, 0x4a, 0x28, 0xb1, 0xdc, 0x68, 0x07, 0x23, 0x17, 0x0b, 0xc8, 0x0f, 0x42,
0xc1, 0x50, 0x5a, 0x54, 0x0f, 0x16, 0xe6, 0x7a, 0x48, 0x81, 0x22, 0x25, 0x86, 0x2e, 0x0c, 0x31,
0x4d, 0x49, 0xa6, 0xe9, 0xf2, 0x93, 0xc9, 0x4c, 0x62, 0x4a, 0x82, 0xfa, 0x65, 0xc6, 0x49, 0xa9,
0x25, 0x89, 0xfa, 0x20, 0x45, 0x60, 0xc2, 0x8a, 0x51, 0x4b, 0x28, 0x9a, 0x8b, 0x0d, 0xe2, 0x4a,
0x21, 0x71, 0x84, 0x7e, 0x14, 0xaf, 0x49, 0x49, 0x60, 0x4a, 0x40, 0x8d, 0x96, 0x03, 0x1b, 0x2d,
0xa1, 0x24, 0x8c, 0x62, 0x74, 0x69, 0x1e, 0xd4, 0x70, 0x27, 0x81, 0x13, 0x8f, 0xe4, 0x18, 0x2f,
0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc6, 0x63, 0x39, 0x86, 0x24, 0x36, 0x70, 0x7c,
0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x10, 0x82, 0x89, 0xf0, 0x45, 0x02, 0x00, 0x00,
}

View File

@@ -179,7 +179,7 @@ func checkTxnRequest(r *pb.TxnRequest, maxTxnOps int) error {
// there is an overlap, returns an error. If no overlap, return put and delete
// sets for recursive evaluation.
func checkIntervals(reqs []*pb.RequestOp) (map[string]struct{}, adt.IntervalTree, error) {
var dels adt.IntervalTree
dels := adt.NewIntervalTree()
// collect deletes from this level; build first to check lower level overlapped puts
for _, req := range reqs {

View File

@@ -6,6 +6,7 @@ go_library(
"doc.go",
"error.go",
"md.go",
"metadatafields.go",
],
importmap = "k8s.io/kubernetes/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes",
importpath = "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes",

View File

@@ -61,6 +61,7 @@ var (
ErrGRPCNoLeader = status.New(codes.Unavailable, "etcdserver: no leader").Err()
ErrGRPCNotLeader = status.New(codes.FailedPrecondition, "etcdserver: not leader").Err()
ErrGRPCLeaderChanged = status.New(codes.Unavailable, "etcdserver: leader changed").Err()
ErrGRPCNotCapable = status.New(codes.Unavailable, "etcdserver: not capable").Err()
ErrGRPCStopped = status.New(codes.Unavailable, "etcdserver: server stopped").Err()
ErrGRPCTimeout = status.New(codes.Unavailable, "etcdserver: request timed out").Err()
@@ -163,6 +164,7 @@ var (
ErrNoLeader = Error(ErrGRPCNoLeader)
ErrNotLeader = Error(ErrGRPCNotLeader)
ErrLeaderChanged = Error(ErrGRPCLeaderChanged)
ErrNotCapable = Error(ErrGRPCNotCapable)
ErrStopped = Error(ErrGRPCStopped)
ErrTimeout = Error(ErrGRPCTimeout)

View File

@@ -0,0 +1,20 @@
// Copyright 2018 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package rpctypes
var (
TokenFieldNameGRPC = "token"
TokenFieldNameSwagger = "authorization"
)

View File

@@ -44,6 +44,7 @@ var toGRPCErrorMap = map[error]error{
etcdserver.ErrNoLeader: rpctypes.ErrGRPCNoLeader,
etcdserver.ErrNotLeader: rpctypes.ErrGRPCNotLeader,
etcdserver.ErrLeaderChanged: rpctypes.ErrGRPCLeaderChanged,
etcdserver.ErrStopped: rpctypes.ErrGRPCStopped,
etcdserver.ErrTimeout: rpctypes.ErrGRPCTimeout,
etcdserver.ErrTimeoutDueToLeaderFail: rpctypes.ErrGRPCTimeoutDueToLeaderFail,

View File

@@ -31,6 +31,9 @@ import (
type watchServer struct {
clusterID int64
memberID int64
maxRequestBytes int
raftTimer etcdserver.RaftTimer
watchable mvcc.WatchableKV
@@ -39,11 +42,12 @@ type watchServer struct {
func NewWatchServer(s *etcdserver.EtcdServer) pb.WatchServer {
return &watchServer{
clusterID: int64(s.Cluster().ID()),
memberID: int64(s.ID()),
raftTimer: s,
watchable: s.Watchable(),
ag: s,
clusterID: int64(s.Cluster().ID()),
memberID: int64(s.ID()),
maxRequestBytes: int(s.Cfg.MaxRequestBytes + grpcOverheadBytes),
raftTimer: s,
watchable: s.Watchable(),
ag: s,
}
}
@@ -83,6 +87,9 @@ const (
type serverWatchStream struct {
clusterID int64
memberID int64
maxRequestBytes int
raftTimer etcdserver.RaftTimer
watchable mvcc.WatchableKV
@@ -92,12 +99,14 @@ type serverWatchStream struct {
ctrlStream chan *pb.WatchResponse
// mu protects progress, prevKV
mu sync.Mutex
mu sync.RWMutex
// progress tracks the watchID that stream might need to send
// progress to.
// TODO: combine progress and prevKV into a single struct?
progress map[mvcc.WatchID]bool
prevKV map[mvcc.WatchID]bool
// records fragmented watch IDs
fragment map[mvcc.WatchID]bool
// closec indicates the stream is closed.
closec chan struct{}
@@ -112,6 +121,9 @@ func (ws *watchServer) Watch(stream pb.Watch_WatchServer) (err error) {
sws := serverWatchStream{
clusterID: ws.clusterID,
memberID: ws.memberID,
maxRequestBytes: ws.maxRequestBytes,
raftTimer: ws.raftTimer,
watchable: ws.watchable,
@@ -122,6 +134,7 @@ func (ws *watchServer) Watch(stream pb.Watch_WatchServer) (err error) {
ctrlStream: make(chan *pb.WatchResponse, ctrlStreamBufLen),
progress: make(map[mvcc.WatchID]bool),
prevKV: make(map[mvcc.WatchID]bool),
fragment: make(map[mvcc.WatchID]bool),
closec: make(chan struct{}),
ag: ws.ag,
@@ -238,6 +251,9 @@ func (sws *serverWatchStream) recvLoop() error {
if creq.PrevKv {
sws.prevKV[id] = true
}
if creq.Fragment {
sws.fragment[id] = true
}
sws.mu.Unlock()
}
wr := &pb.WatchResponse{
@@ -264,9 +280,17 @@ func (sws *serverWatchStream) recvLoop() error {
sws.mu.Lock()
delete(sws.progress, mvcc.WatchID(id))
delete(sws.prevKV, mvcc.WatchID(id))
delete(sws.fragment, mvcc.WatchID(id))
sws.mu.Unlock()
}
}
case *pb.WatchRequest_ProgressRequest:
if uv.ProgressRequest != nil {
sws.ctrlStream <- &pb.WatchResponse{
Header: sws.newResponseHeader(sws.watchStream.Rev()),
WatchId: -1, // response is not associated with any WatchId and will be broadcast to all watch channels
}
}
default:
// we probably should not shutdown the entire stream when
// receive an valid command.
@@ -310,9 +334,9 @@ func (sws *serverWatchStream) sendLoop() {
// or define protocol buffer with []mvccpb.Event.
evs := wresp.Events
events := make([]*mvccpb.Event, len(evs))
sws.mu.Lock()
sws.mu.RLock()
needPrevKV := sws.prevKV[wresp.WatchID]
sws.mu.Unlock()
sws.mu.RUnlock()
for i := range evs {
events[i] = &evs[i]
@@ -342,11 +366,23 @@ func (sws *serverWatchStream) sendLoop() {
}
mvcc.ReportEventReceived(len(evs))
if err := sws.gRPCStream.Send(wr); err != nil {
if isClientCtxErr(sws.gRPCStream.Context().Err(), err) {
plog.Debugf("failed to send watch response to gRPC stream (%q)", err.Error())
sws.mu.RLock()
fragmented, ok := sws.fragment[wresp.WatchID]
sws.mu.RUnlock()
var serr error
if !fragmented && !ok {
serr = sws.gRPCStream.Send(wr)
} else {
serr = sendFragments(wr, sws.maxRequestBytes, sws.gRPCStream.Send)
}
if serr != nil {
if isClientCtxErr(sws.gRPCStream.Context().Err(), serr) {
plog.Debugf("failed to send watch response to gRPC stream (%q)", serr.Error())
} else {
plog.Warningf("failed to send watch response to gRPC stream (%q)", err.Error())
plog.Warningf("failed to send watch response to gRPC stream (%q)", serr.Error())
}
return
}
@@ -409,6 +445,45 @@ func (sws *serverWatchStream) sendLoop() {
}
}
func sendFragments(
wr *pb.WatchResponse,
maxRequestBytes int,
sendFunc func(*pb.WatchResponse) error) error {
// no need to fragment if total request size is smaller
// than max request limit or response contains only one event
if wr.Size() < maxRequestBytes || len(wr.Events) < 2 {
return sendFunc(wr)
}
ow := *wr
ow.Events = make([]*mvccpb.Event, 0)
ow.Fragment = true
var idx int
for {
cur := ow
for _, ev := range wr.Events[idx:] {
cur.Events = append(cur.Events, ev)
if len(cur.Events) > 1 && cur.Size() >= maxRequestBytes {
cur.Events = cur.Events[:len(cur.Events)-1]
break
}
idx++
}
if idx == len(wr.Events) {
// last response has no more fragment
cur.Fragment = false
}
if err := sendFunc(&cur); err != nil {
return err
}
if !cur.Fragment {
break
}
}
return nil
}
func (sws *serverWatchStream) close() {
sws.watchStream.Close()
close(sws.closec)

View File

@@ -27,6 +27,7 @@ var (
ErrTimeoutDueToLeaderFail = errors.New("etcdserver: request timed out, possibly due to previous leader failure")
ErrTimeoutDueToConnectionLost = errors.New("etcdserver: request timed out, possibly due to connection lost")
ErrTimeoutLeaderTransfer = errors.New("etcdserver: request timed out, leader transfer took too long")
ErrLeaderChanged = errors.New("etcdserver: leader changed")
ErrNotEnoughStartedMembers = errors.New("etcdserver: re-configuration failed due to not enough started members")
ErrNoLeader = errors.New("etcdserver: no leader")
ErrNotLeader = errors.New("etcdserver: not leader")

View File

@@ -16,8 +16,10 @@ go_library(
"//vendor/github.com/coreos/etcd/mvcc/mvccpb:go_default_library",
"//vendor/github.com/gogo/protobuf/gogoproto:go_default_library",
"//vendor/github.com/golang/protobuf/proto:go_default_library",
"//vendor/golang.org/x/net/context:go_default_library",
"//vendor/google.golang.org/genproto/googleapis/api/annotations:go_default_library",
"//vendor/google.golang.org/grpc:go_default_library",
"//vendor/google.golang.org/grpc/codes:go_default_library",
"//vendor/google.golang.org/grpc/status:go_default_library",
],
)

View File

@@ -1,119 +1,16 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: etcdserver.proto
/*
Package etcdserverpb is a generated protocol buffer package.
It is generated from these files:
etcdserver.proto
raft_internal.proto
rpc.proto
It has these top-level messages:
Request
Metadata
RequestHeader
InternalRaftRequest
EmptyResponse
InternalAuthenticateRequest
ResponseHeader
RangeRequest
RangeResponse
PutRequest
PutResponse
DeleteRangeRequest
DeleteRangeResponse
RequestOp
ResponseOp
Compare
TxnRequest
TxnResponse
CompactionRequest
CompactionResponse
HashRequest
HashKVRequest
HashKVResponse
HashResponse
SnapshotRequest
SnapshotResponse
WatchRequest
WatchCreateRequest
WatchCancelRequest
WatchResponse
LeaseGrantRequest
LeaseGrantResponse
LeaseRevokeRequest
LeaseRevokeResponse
LeaseKeepAliveRequest
LeaseKeepAliveResponse
LeaseTimeToLiveRequest
LeaseTimeToLiveResponse
LeaseLeasesRequest
LeaseStatus
LeaseLeasesResponse
Member
MemberAddRequest
MemberAddResponse
MemberRemoveRequest
MemberRemoveResponse
MemberUpdateRequest
MemberUpdateResponse
MemberListRequest
MemberListResponse
DefragmentRequest
DefragmentResponse
MoveLeaderRequest
MoveLeaderResponse
AlarmRequest
AlarmMember
AlarmResponse
StatusRequest
StatusResponse
AuthEnableRequest
AuthDisableRequest
AuthenticateRequest
AuthUserAddRequest
AuthUserGetRequest
AuthUserDeleteRequest
AuthUserChangePasswordRequest
AuthUserGrantRoleRequest
AuthUserRevokeRoleRequest
AuthRoleAddRequest
AuthRoleGetRequest
AuthUserListRequest
AuthRoleListRequest
AuthRoleDeleteRequest
AuthRoleGrantPermissionRequest
AuthRoleRevokePermissionRequest
AuthEnableResponse
AuthDisableResponse
AuthenticateResponse
AuthUserAddResponse
AuthUserGetResponse
AuthUserDeleteResponse
AuthUserChangePasswordResponse
AuthUserGrantRoleResponse
AuthUserRevokeRoleResponse
AuthRoleAddResponse
AuthRoleGetResponse
AuthRoleListResponse
AuthUserListResponse
AuthRoleDeleteResponse
AuthRoleGrantPermissionResponse
AuthRoleRevokePermissionResponse
*/
package etcdserverpb
import (
"fmt"
proto "github.com/golang/protobuf/proto"
fmt "fmt"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/gogo/protobuf/gogoproto"
io "io"
proto "github.com/golang/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
@@ -128,50 +25,141 @@ var _ = math.Inf
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type Request struct {
ID uint64 `protobuf:"varint,1,opt,name=ID" json:"ID"`
Method string `protobuf:"bytes,2,opt,name=Method" json:"Method"`
Path string `protobuf:"bytes,3,opt,name=Path" json:"Path"`
Val string `protobuf:"bytes,4,opt,name=Val" json:"Val"`
Dir bool `protobuf:"varint,5,opt,name=Dir" json:"Dir"`
PrevValue string `protobuf:"bytes,6,opt,name=PrevValue" json:"PrevValue"`
PrevIndex uint64 `protobuf:"varint,7,opt,name=PrevIndex" json:"PrevIndex"`
PrevExist *bool `protobuf:"varint,8,opt,name=PrevExist" json:"PrevExist,omitempty"`
Expiration int64 `protobuf:"varint,9,opt,name=Expiration" json:"Expiration"`
Wait bool `protobuf:"varint,10,opt,name=Wait" json:"Wait"`
Since uint64 `protobuf:"varint,11,opt,name=Since" json:"Since"`
Recursive bool `protobuf:"varint,12,opt,name=Recursive" json:"Recursive"`
Sorted bool `protobuf:"varint,13,opt,name=Sorted" json:"Sorted"`
Quorum bool `protobuf:"varint,14,opt,name=Quorum" json:"Quorum"`
Time int64 `protobuf:"varint,15,opt,name=Time" json:"Time"`
Stream bool `protobuf:"varint,16,opt,name=Stream" json:"Stream"`
Refresh *bool `protobuf:"varint,17,opt,name=Refresh" json:"Refresh,omitempty"`
XXX_unrecognized []byte `json:"-"`
ID uint64 `protobuf:"varint,1,opt,name=ID" json:"ID"`
Method string `protobuf:"bytes,2,opt,name=Method" json:"Method"`
Path string `protobuf:"bytes,3,opt,name=Path" json:"Path"`
Val string `protobuf:"bytes,4,opt,name=Val" json:"Val"`
Dir bool `protobuf:"varint,5,opt,name=Dir" json:"Dir"`
PrevValue string `protobuf:"bytes,6,opt,name=PrevValue" json:"PrevValue"`
PrevIndex uint64 `protobuf:"varint,7,opt,name=PrevIndex" json:"PrevIndex"`
PrevExist *bool `protobuf:"varint,8,opt,name=PrevExist" json:"PrevExist,omitempty"`
Expiration int64 `protobuf:"varint,9,opt,name=Expiration" json:"Expiration"`
Wait bool `protobuf:"varint,10,opt,name=Wait" json:"Wait"`
Since uint64 `protobuf:"varint,11,opt,name=Since" json:"Since"`
Recursive bool `protobuf:"varint,12,opt,name=Recursive" json:"Recursive"`
Sorted bool `protobuf:"varint,13,opt,name=Sorted" json:"Sorted"`
Quorum bool `protobuf:"varint,14,opt,name=Quorum" json:"Quorum"`
Time int64 `protobuf:"varint,15,opt,name=Time" json:"Time"`
Stream bool `protobuf:"varint,16,opt,name=Stream" json:"Stream"`
Refresh *bool `protobuf:"varint,17,opt,name=Refresh" json:"Refresh,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Request) Reset() { *m = Request{} }
func (m *Request) String() string { return proto.CompactTextString(m) }
func (*Request) ProtoMessage() {}
func (*Request) Descriptor() ([]byte, []int) { return fileDescriptorEtcdserver, []int{0} }
func (m *Request) Reset() { *m = Request{} }
func (m *Request) String() string { return proto.CompactTextString(m) }
func (*Request) ProtoMessage() {}
func (*Request) Descriptor() ([]byte, []int) {
return fileDescriptor_09ffbeb3bebbce7e, []int{0}
}
func (m *Request) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Request.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Request) XXX_Merge(src proto.Message) {
xxx_messageInfo_Request.Merge(m, src)
}
func (m *Request) XXX_Size() int {
return m.Size()
}
func (m *Request) XXX_DiscardUnknown() {
xxx_messageInfo_Request.DiscardUnknown(m)
}
var xxx_messageInfo_Request proto.InternalMessageInfo
type Metadata struct {
NodeID uint64 `protobuf:"varint,1,opt,name=NodeID" json:"NodeID"`
ClusterID uint64 `protobuf:"varint,2,opt,name=ClusterID" json:"ClusterID"`
XXX_unrecognized []byte `json:"-"`
NodeID uint64 `protobuf:"varint,1,opt,name=NodeID" json:"NodeID"`
ClusterID uint64 `protobuf:"varint,2,opt,name=ClusterID" json:"ClusterID"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Metadata) Reset() { *m = Metadata{} }
func (m *Metadata) String() string { return proto.CompactTextString(m) }
func (*Metadata) ProtoMessage() {}
func (*Metadata) Descriptor() ([]byte, []int) { return fileDescriptorEtcdserver, []int{1} }
func (m *Metadata) Reset() { *m = Metadata{} }
func (m *Metadata) String() string { return proto.CompactTextString(m) }
func (*Metadata) ProtoMessage() {}
func (*Metadata) Descriptor() ([]byte, []int) {
return fileDescriptor_09ffbeb3bebbce7e, []int{1}
}
func (m *Metadata) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Metadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Metadata.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Metadata) XXX_Merge(src proto.Message) {
xxx_messageInfo_Metadata.Merge(m, src)
}
func (m *Metadata) XXX_Size() int {
return m.Size()
}
func (m *Metadata) XXX_DiscardUnknown() {
xxx_messageInfo_Metadata.DiscardUnknown(m)
}
var xxx_messageInfo_Metadata proto.InternalMessageInfo
func init() {
proto.RegisterType((*Request)(nil), "etcdserverpb.Request")
proto.RegisterType((*Metadata)(nil), "etcdserverpb.Metadata")
}
func init() { proto.RegisterFile("etcdserver.proto", fileDescriptor_09ffbeb3bebbce7e) }
var fileDescriptor_09ffbeb3bebbce7e = []byte{
// 380 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0xd2, 0xdd, 0x6e, 0xda, 0x30,
0x14, 0x07, 0x70, 0x0c, 0xe1, 0xcb, 0x63, 0x1b, 0xb3, 0xd0, 0x74, 0x84, 0xa6, 0x2c, 0x42, 0xbb,
0xc8, 0xd5, 0xf6, 0x0e, 0x2c, 0x5c, 0x44, 0x2a, 0x15, 0x0d, 0x15, 0xbd, 0x76, 0xc9, 0x29, 0x58,
0x02, 0x4c, 0x1d, 0x07, 0xf1, 0x06, 0x7d, 0x85, 0x3e, 0x12, 0x97, 0x7d, 0x82, 0xaa, 0xa5, 0x2f,
0x52, 0x39, 0x24, 0xc4, 0xed, 0x5d, 0xf4, 0xfb, 0x9f, 0x1c, 0x1f, 0x7f, 0xd0, 0x2e, 0xea, 0x79,
0x9c, 0xa0, 0xda, 0xa1, 0xfa, 0xbb, 0x55, 0x52, 0x4b, 0xd6, 0x29, 0x65, 0x7b, 0xdb, 0xef, 0x2d,
0xe4, 0x42, 0x66, 0xc1, 0x3f, 0xf3, 0x75, 0xaa, 0x19, 0x3c, 0x38, 0xb4, 0x19, 0xe1, 0x7d, 0x8a,
0x89, 0x66, 0x3d, 0x5a, 0x0d, 0x03, 0x20, 0x1e, 0xf1, 0x9d, 0xa1, 0x73, 0x78, 0xfe, 0x5d, 0x89,
0xaa, 0x61, 0xc0, 0x7e, 0xd1, 0xc6, 0x18, 0xf5, 0x52, 0xc6, 0x50, 0xf5, 0x88, 0xdf, 0xce, 0x93,
0xdc, 0x18, 0x50, 0x67, 0xc2, 0xf5, 0x12, 0x6a, 0x56, 0x96, 0x09, 0xfb, 0x49, 0x6b, 0x33, 0xbe,
0x02, 0xc7, 0x0a, 0x0c, 0x18, 0x0f, 0x84, 0x82, 0xba, 0x47, 0xfc, 0x56, 0xe1, 0x81, 0x50, 0x6c,
0x40, 0xdb, 0x13, 0x85, 0xbb, 0x19, 0x5f, 0xa5, 0x08, 0x0d, 0xeb, 0xaf, 0x92, 0x8b, 0x9a, 0x70,
0x13, 0xe3, 0x1e, 0x9a, 0xd6, 0xa0, 0x25, 0x17, 0x35, 0xa3, 0xbd, 0x48, 0x34, 0xb4, 0xce, 0xab,
0x90, 0xa8, 0x64, 0xf6, 0x87, 0xd2, 0xd1, 0x7e, 0x2b, 0x14, 0xd7, 0x42, 0x6e, 0xa0, 0xed, 0x11,
0xbf, 0x96, 0x37, 0xb2, 0xdc, 0xec, 0xed, 0x86, 0x0b, 0x0d, 0xd4, 0x1a, 0x35, 0x13, 0xd6, 0xa7,
0xf5, 0xa9, 0xd8, 0xcc, 0x11, 0xbe, 0x58, 0x33, 0x9c, 0xc8, 0xac, 0x1f, 0xe1, 0x3c, 0x55, 0x89,
0xd8, 0x21, 0x74, 0xac, 0x5f, 0x4b, 0x36, 0x67, 0x3a, 0x95, 0x4a, 0x63, 0x0c, 0x5f, 0xad, 0x82,
0xdc, 0x4c, 0x7a, 0x95, 0x4a, 0x95, 0xae, 0xe1, 0x9b, 0x9d, 0x9e, 0xcc, 0x4c, 0x75, 0x2d, 0xd6,
0x08, 0xdf, 0xad, 0xa9, 0x33, 0xc9, 0xba, 0x6a, 0x85, 0x7c, 0x0d, 0xdd, 0x0f, 0x5d, 0x33, 0x63,
0xae, 0xb9, 0xe8, 0x3b, 0x85, 0xc9, 0x12, 0x7e, 0x58, 0xa7, 0x52, 0xe0, 0xe0, 0x82, 0xb6, 0xc6,
0xa8, 0x79, 0xcc, 0x35, 0x37, 0x9d, 0x2e, 0x65, 0x8c, 0x9f, 0x5e, 0x43, 0x6e, 0x66, 0x87, 0xff,
0x57, 0x69, 0xa2, 0x51, 0x85, 0x41, 0xf6, 0x28, 0xce, 0xb7, 0x70, 0xe6, 0x61, 0xef, 0xf0, 0xea,
0x56, 0x0e, 0x47, 0x97, 0x3c, 0x1d, 0x5d, 0xf2, 0x72, 0x74, 0xc9, 0xe3, 0x9b, 0x5b, 0x79, 0x0f,
0x00, 0x00, 0xff, 0xff, 0xee, 0x40, 0xba, 0xd6, 0xa4, 0x02, 0x00, 0x00,
}
func (m *Request) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
@@ -179,123 +167,133 @@ func (m *Request) Marshal() (dAtA []byte, err error) {
}
func (m *Request) MarshalTo(dAtA []byte) (int, error) {
var i int
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
dAtA[i] = 0x8
i++
i = encodeVarintEtcdserver(dAtA, i, uint64(m.ID))
dAtA[i] = 0x12
i++
i = encodeVarintEtcdserver(dAtA, i, uint64(len(m.Method)))
i += copy(dAtA[i:], m.Method)
dAtA[i] = 0x1a
i++
i = encodeVarintEtcdserver(dAtA, i, uint64(len(m.Path)))
i += copy(dAtA[i:], m.Path)
dAtA[i] = 0x22
i++
i = encodeVarintEtcdserver(dAtA, i, uint64(len(m.Val)))
i += copy(dAtA[i:], m.Val)
dAtA[i] = 0x28
i++
if m.Dir {
dAtA[i] = 1
} else {
dAtA[i] = 0
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
i++
dAtA[i] = 0x32
i++
i = encodeVarintEtcdserver(dAtA, i, uint64(len(m.PrevValue)))
i += copy(dAtA[i:], m.PrevValue)
dAtA[i] = 0x38
i++
i = encodeVarintEtcdserver(dAtA, i, uint64(m.PrevIndex))
if m.PrevExist != nil {
dAtA[i] = 0x40
i++
if *m.PrevExist {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
}
dAtA[i] = 0x48
i++
i = encodeVarintEtcdserver(dAtA, i, uint64(m.Expiration))
dAtA[i] = 0x50
i++
if m.Wait {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
dAtA[i] = 0x58
i++
i = encodeVarintEtcdserver(dAtA, i, uint64(m.Since))
dAtA[i] = 0x60
i++
if m.Recursive {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
dAtA[i] = 0x68
i++
if m.Sorted {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
dAtA[i] = 0x70
i++
if m.Quorum {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
dAtA[i] = 0x78
i++
i = encodeVarintEtcdserver(dAtA, i, uint64(m.Time))
dAtA[i] = 0x80
i++
dAtA[i] = 0x1
i++
if m.Stream {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
if m.Refresh != nil {
dAtA[i] = 0x88
i++
dAtA[i] = 0x1
i++
i--
if *m.Refresh {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
i--
dAtA[i] = 0x1
i--
dAtA[i] = 0x88
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
i--
if m.Stream {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
return i, nil
i--
dAtA[i] = 0x1
i--
dAtA[i] = 0x80
i = encodeVarintEtcdserver(dAtA, i, uint64(m.Time))
i--
dAtA[i] = 0x78
i--
if m.Quorum {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x70
i--
if m.Sorted {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x68
i--
if m.Recursive {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x60
i = encodeVarintEtcdserver(dAtA, i, uint64(m.Since))
i--
dAtA[i] = 0x58
i--
if m.Wait {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x50
i = encodeVarintEtcdserver(dAtA, i, uint64(m.Expiration))
i--
dAtA[i] = 0x48
if m.PrevExist != nil {
i--
if *m.PrevExist {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x40
}
i = encodeVarintEtcdserver(dAtA, i, uint64(m.PrevIndex))
i--
dAtA[i] = 0x38
i -= len(m.PrevValue)
copy(dAtA[i:], m.PrevValue)
i = encodeVarintEtcdserver(dAtA, i, uint64(len(m.PrevValue)))
i--
dAtA[i] = 0x32
i--
if m.Dir {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x28
i -= len(m.Val)
copy(dAtA[i:], m.Val)
i = encodeVarintEtcdserver(dAtA, i, uint64(len(m.Val)))
i--
dAtA[i] = 0x22
i -= len(m.Path)
copy(dAtA[i:], m.Path)
i = encodeVarintEtcdserver(dAtA, i, uint64(len(m.Path)))
i--
dAtA[i] = 0x1a
i -= len(m.Method)
copy(dAtA[i:], m.Method)
i = encodeVarintEtcdserver(dAtA, i, uint64(len(m.Method)))
i--
dAtA[i] = 0x12
i = encodeVarintEtcdserver(dAtA, i, uint64(m.ID))
i--
dAtA[i] = 0x8
return len(dAtA) - i, nil
}
func (m *Metadata) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
@@ -303,32 +301,43 @@ func (m *Metadata) Marshal() (dAtA []byte, err error) {
}
func (m *Metadata) MarshalTo(dAtA []byte) (int, error) {
var i int
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Metadata) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
dAtA[i] = 0x8
i++
i = encodeVarintEtcdserver(dAtA, i, uint64(m.NodeID))
dAtA[i] = 0x10
i++
i = encodeVarintEtcdserver(dAtA, i, uint64(m.ClusterID))
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
i = encodeVarintEtcdserver(dAtA, i, uint64(m.ClusterID))
i--
dAtA[i] = 0x10
i = encodeVarintEtcdserver(dAtA, i, uint64(m.NodeID))
i--
dAtA[i] = 0x8
return len(dAtA) - i, nil
}
func encodeVarintEtcdserver(dAtA []byte, offset int, v uint64) int {
offset -= sovEtcdserver(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return offset + 1
return base
}
func (m *Request) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
n += 1 + sovEtcdserver(uint64(m.ID))
@@ -363,6 +372,9 @@ func (m *Request) Size() (n int) {
}
func (m *Metadata) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
n += 1 + sovEtcdserver(uint64(m.NodeID))
@@ -374,14 +386,7 @@ func (m *Metadata) Size() (n int) {
}
func sovEtcdserver(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
return (math_bits.Len64(x|1) + 6) / 7
}
func sozEtcdserver(x uint64) (n int) {
return sovEtcdserver(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@@ -401,7 +406,7 @@ func (m *Request) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -429,7 +434,7 @@ func (m *Request) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ID |= (uint64(b) & 0x7F) << shift
m.ID |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -448,7 +453,7 @@ func (m *Request) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -458,6 +463,9 @@ func (m *Request) Unmarshal(dAtA []byte) error {
return ErrInvalidLengthEtcdserver
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEtcdserver
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
@@ -477,7 +485,7 @@ func (m *Request) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -487,6 +495,9 @@ func (m *Request) Unmarshal(dAtA []byte) error {
return ErrInvalidLengthEtcdserver
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEtcdserver
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
@@ -506,7 +517,7 @@ func (m *Request) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -516,6 +527,9 @@ func (m *Request) Unmarshal(dAtA []byte) error {
return ErrInvalidLengthEtcdserver
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEtcdserver
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
@@ -535,7 +549,7 @@ func (m *Request) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
v |= (int(b) & 0x7F) << shift
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -555,7 +569,7 @@ func (m *Request) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -565,6 +579,9 @@ func (m *Request) Unmarshal(dAtA []byte) error {
return ErrInvalidLengthEtcdserver
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthEtcdserver
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
@@ -584,7 +601,7 @@ func (m *Request) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.PrevIndex |= (uint64(b) & 0x7F) << shift
m.PrevIndex |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -603,7 +620,7 @@ func (m *Request) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
v |= (int(b) & 0x7F) << shift
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -624,7 +641,7 @@ func (m *Request) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.Expiration |= (int64(b) & 0x7F) << shift
m.Expiration |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -643,7 +660,7 @@ func (m *Request) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
v |= (int(b) & 0x7F) << shift
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -663,7 +680,7 @@ func (m *Request) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.Since |= (uint64(b) & 0x7F) << shift
m.Since |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -682,7 +699,7 @@ func (m *Request) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
v |= (int(b) & 0x7F) << shift
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -702,7 +719,7 @@ func (m *Request) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
v |= (int(b) & 0x7F) << shift
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -722,7 +739,7 @@ func (m *Request) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
v |= (int(b) & 0x7F) << shift
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -742,7 +759,7 @@ func (m *Request) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.Time |= (int64(b) & 0x7F) << shift
m.Time |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -761,7 +778,7 @@ func (m *Request) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
v |= (int(b) & 0x7F) << shift
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -781,7 +798,7 @@ func (m *Request) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
v |= (int(b) & 0x7F) << shift
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -797,6 +814,9 @@ func (m *Request) Unmarshal(dAtA []byte) error {
if skippy < 0 {
return ErrInvalidLengthEtcdserver
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthEtcdserver
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
@@ -825,7 +845,7 @@ func (m *Metadata) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -853,7 +873,7 @@ func (m *Metadata) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.NodeID |= (uint64(b) & 0x7F) << shift
m.NodeID |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -872,7 +892,7 @@ func (m *Metadata) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.ClusterID |= (uint64(b) & 0x7F) << shift
m.ClusterID |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -886,6 +906,9 @@ func (m *Metadata) Unmarshal(dAtA []byte) error {
if skippy < 0 {
return ErrInvalidLengthEtcdserver
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthEtcdserver
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
@@ -953,10 +976,13 @@ func skipEtcdserver(dAtA []byte) (n int, err error) {
break
}
}
iNdEx += length
if length < 0 {
return 0, ErrInvalidLengthEtcdserver
}
iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthEtcdserver
}
return iNdEx, nil
case 3:
for {
@@ -985,6 +1011,9 @@ func skipEtcdserver(dAtA []byte) (n int, err error) {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthEtcdserver
}
}
return iNdEx, nil
case 4:
@@ -1003,33 +1032,3 @@ var (
ErrInvalidLengthEtcdserver = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowEtcdserver = fmt.Errorf("proto: integer overflow")
)
func init() { proto.RegisterFile("etcdserver.proto", fileDescriptorEtcdserver) }
var fileDescriptorEtcdserver = []byte{
// 380 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0xd2, 0xdd, 0x6e, 0xda, 0x30,
0x14, 0x07, 0x70, 0x0c, 0xe1, 0xcb, 0x63, 0x1b, 0xb3, 0xd0, 0x74, 0x84, 0xa6, 0x2c, 0x42, 0xbb,
0xc8, 0xd5, 0xf6, 0x0e, 0x2c, 0x5c, 0x44, 0x2a, 0x15, 0x0d, 0x15, 0xbd, 0x76, 0xc9, 0x29, 0x58,
0x02, 0x4c, 0x1d, 0x07, 0xf1, 0x06, 0x7d, 0x85, 0x3e, 0x12, 0x97, 0x7d, 0x82, 0xaa, 0xa5, 0x2f,
0x52, 0x39, 0x24, 0xc4, 0xed, 0x5d, 0xf4, 0xfb, 0x9f, 0x1c, 0x1f, 0x7f, 0xd0, 0x2e, 0xea, 0x79,
0x9c, 0xa0, 0xda, 0xa1, 0xfa, 0xbb, 0x55, 0x52, 0x4b, 0xd6, 0x29, 0x65, 0x7b, 0xdb, 0xef, 0x2d,
0xe4, 0x42, 0x66, 0xc1, 0x3f, 0xf3, 0x75, 0xaa, 0x19, 0x3c, 0x38, 0xb4, 0x19, 0xe1, 0x7d, 0x8a,
0x89, 0x66, 0x3d, 0x5a, 0x0d, 0x03, 0x20, 0x1e, 0xf1, 0x9d, 0xa1, 0x73, 0x78, 0xfe, 0x5d, 0x89,
0xaa, 0x61, 0xc0, 0x7e, 0xd1, 0xc6, 0x18, 0xf5, 0x52, 0xc6, 0x50, 0xf5, 0x88, 0xdf, 0xce, 0x93,
0xdc, 0x18, 0x50, 0x67, 0xc2, 0xf5, 0x12, 0x6a, 0x56, 0x96, 0x09, 0xfb, 0x49, 0x6b, 0x33, 0xbe,
0x02, 0xc7, 0x0a, 0x0c, 0x18, 0x0f, 0x84, 0x82, 0xba, 0x47, 0xfc, 0x56, 0xe1, 0x81, 0x50, 0x6c,
0x40, 0xdb, 0x13, 0x85, 0xbb, 0x19, 0x5f, 0xa5, 0x08, 0x0d, 0xeb, 0xaf, 0x92, 0x8b, 0x9a, 0x70,
0x13, 0xe3, 0x1e, 0x9a, 0xd6, 0xa0, 0x25, 0x17, 0x35, 0xa3, 0xbd, 0x48, 0x34, 0xb4, 0xce, 0xab,
0x90, 0xa8, 0x64, 0xf6, 0x87, 0xd2, 0xd1, 0x7e, 0x2b, 0x14, 0xd7, 0x42, 0x6e, 0xa0, 0xed, 0x11,
0xbf, 0x96, 0x37, 0xb2, 0xdc, 0xec, 0xed, 0x86, 0x0b, 0x0d, 0xd4, 0x1a, 0x35, 0x13, 0xd6, 0xa7,
0xf5, 0xa9, 0xd8, 0xcc, 0x11, 0xbe, 0x58, 0x33, 0x9c, 0xc8, 0xac, 0x1f, 0xe1, 0x3c, 0x55, 0x89,
0xd8, 0x21, 0x74, 0xac, 0x5f, 0x4b, 0x36, 0x67, 0x3a, 0x95, 0x4a, 0x63, 0x0c, 0x5f, 0xad, 0x82,
0xdc, 0x4c, 0x7a, 0x95, 0x4a, 0x95, 0xae, 0xe1, 0x9b, 0x9d, 0x9e, 0xcc, 0x4c, 0x75, 0x2d, 0xd6,
0x08, 0xdf, 0xad, 0xa9, 0x33, 0xc9, 0xba, 0x6a, 0x85, 0x7c, 0x0d, 0xdd, 0x0f, 0x5d, 0x33, 0x63,
0xae, 0xb9, 0xe8, 0x3b, 0x85, 0xc9, 0x12, 0x7e, 0x58, 0xa7, 0x52, 0xe0, 0xe0, 0x82, 0xb6, 0xc6,
0xa8, 0x79, 0xcc, 0x35, 0x37, 0x9d, 0x2e, 0x65, 0x8c, 0x9f, 0x5e, 0x43, 0x6e, 0x66, 0x87, 0xff,
0x57, 0x69, 0xa2, 0x51, 0x85, 0x41, 0xf6, 0x28, 0xce, 0xb7, 0x70, 0xe6, 0x61, 0xef, 0xf0, 0xea,
0x56, 0x0e, 0x47, 0x97, 0x3c, 0x1d, 0x5d, 0xf2, 0x72, 0x74, 0xc9, 0xe3, 0x9b, 0x5b, 0x79, 0x0f,
0x00, 0x00, 0xff, 0xff, 0xee, 0x40, 0xba, 0xd6, 0xa4, 0x02, 0x00, 0x00,
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -351,6 +351,9 @@ message ResponseHeader {
// member_id is the ID of the member which sent the response.
uint64 member_id = 2;
// revision is the key-value store revision when the request was applied.
// For watch progress responses, the header.revision indicates progress. All future events
// recieved in this stream are guaranteed to have a higher revision number than the
// header.revision number.
int64 revision = 3;
// raft_term is the raft term when the request was applied.
uint64 raft_term = 4;
@@ -639,6 +642,7 @@ message WatchRequest {
oneof request_union {
WatchCreateRequest create_request = 1;
WatchCancelRequest cancel_request = 2;
WatchProgressRequest progress_request = 3;
}
}
@@ -671,6 +675,16 @@ message WatchCreateRequest {
// If prev_kv is set, created watcher gets the previous KV before the event happens.
// If the previous KV is already compacted, nothing will be returned.
bool prev_kv = 6;
// If watch_id is provided and non-zero, it will be assigned to this watcher.
// Since creating a watcher in etcd is not a synchronous operation,
// this can be used ensure that ordering is correct when creating multiple
// watchers on the same stream. Creating a watcher with an ID already in
// use on the stream will cause an error to be returned.
int64 watch_id = 7;
// fragment enables splitting large revisions into multiple watch responses.
bool fragment = 8;
}
message WatchCancelRequest {
@@ -678,6 +692,11 @@ message WatchCancelRequest {
int64 watch_id = 1;
}
// Requests the a watch stream progress status be sent in the watch response stream as soon as
// possible.
message WatchProgressRequest {
}
message WatchResponse {
ResponseHeader header = 1;
// watch_id is the ID of the watcher that corresponds to the response.
@@ -703,6 +722,9 @@ message WatchResponse {
// cancel_reason indicates the reason for canceling the watcher.
string cancel_reason = 6;
// framgment is true if large watch response was split over multiple responses.
bool fragment = 7;
repeated mvccpb.Event events = 11;
}

View File

@@ -54,6 +54,12 @@ var (
Name: "slow_apply_total",
Help: "The total number of slow apply requests (likely overloaded from slow disk).",
})
applySnapshotInProgress = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: "etcd",
Subsystem: "server",
Name: "snapshot_apply_in_progress_total",
Help: "1 if the server is applying the incoming snapshot. 0 if none.",
})
proposalsCommitted = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: "etcd",
Subsystem: "server",
@@ -131,6 +137,7 @@ func init() {
prometheus.MustRegister(leaderChanges)
prometheus.MustRegister(heartbeatSendFailures)
prometheus.MustRegister(slowApplies)
prometheus.MustRegister(applySnapshotInProgress)
prometheus.MustRegister(proposalsCommitted)
prometheus.MustRegister(proposalsApplied)
prometheus.MustRegister(proposalsPending)

View File

@@ -198,7 +198,9 @@ type EtcdServer struct {
// stopping is closed by run goroutine on shutdown.
stopping chan struct{}
// done is closed when all goroutines from start() complete.
done chan struct{}
done chan struct{}
leaderChanged chan struct{}
leaderChangedMu sync.RWMutex
errorc chan error
id types.ID
@@ -597,6 +599,7 @@ func (s *EtcdServer) start() {
s.ctx, s.cancel = context.WithCancel(context.Background())
s.readwaitc = make(chan struct{}, 1)
s.readNotifier = newNotifier()
s.leaderChanged = make(chan struct{})
if s.ClusterVersion() != nil {
plog.Infof("starting server... [version: %v, cluster version: %v]", version.Version, version.Cluster(s.ClusterVersion().String()))
} else {
@@ -733,6 +736,17 @@ func (s *EtcdServer) run() {
s.compactor.Resume()
}
}
if newLeader {
select {
case s.leaderChanged <- struct{}{}:
default:
}
s.leaderChangedMu.Lock()
lc := s.leaderChanged
s.leaderChanged = make(chan struct{})
s.leaderChangedMu.Unlock()
close(lc)
}
// TODO: remove the nil checking
// current test utility does not provide the stats
@@ -841,6 +855,12 @@ func (s *EtcdServer) run() {
}
}
func (s *EtcdServer) leaderChangedNotify() <-chan struct{} {
s.leaderChangedMu.RLock()
defer s.leaderChangedMu.RUnlock()
return s.leaderChanged
}
func (s *EtcdServer) applyAll(ep *etcdProgress, apply *apply) {
s.applySnapshot(ep, apply)
s.applyEntries(ep, apply)
@@ -866,9 +886,12 @@ func (s *EtcdServer) applySnapshot(ep *etcdProgress, apply *apply) {
if raft.IsEmptySnap(apply.snapshot) {
return
}
applySnapshotInProgress.Inc()
plog.Infof("applying snapshot at index %d...", ep.snapi)
defer plog.Infof("finished applying incoming snapshot at index %d", ep.snapi)
defer func() {
plog.Infof("finished applying incoming snapshot at index %d", ep.snapi)
applySnapshotInProgress.Dec()
}()
if apply.snapshot.Metadata.Index <= ep.appliedi {
plog.Panicf("snapshot index [%d] should > appliedi[%d] + 1",

View File

@@ -614,7 +614,10 @@ func (s *EtcdServer) linearizableReadLoop() {
id1 := s.reqIDGen.Next()
binary.BigEndian.PutUint64(ctxToSend, id1)
leaderChangedNotifier := s.leaderChangedNotify()
select {
case <-leaderChangedNotifier:
continue
case <-s.readwaitc:
case <-s.stopping:
return
@@ -659,6 +662,12 @@ func (s *EtcdServer) linearizableReadLoop() {
slowReadIndex.Inc()
}
case <-leaderChangedNotifier:
timeout = true
readIndexFailed.Inc()
// return a retryable error.
nr.notify(ErrLeaderChanged)
case <-time.After(s.Cfg.ReqTimeout()):
plog.Warningf("timed out waiting for read index response (local node might have slow network)")
nr.notify(ErrTimeout)