|
@@ -19,7 +19,7 @@ package etcdserverpb
|
|
|
import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
|
|
import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
|
|
|
import math "math"
|
|
import math "math"
|
|
|
|
|
|
|
|
-// discarding unused import gogoproto "github.com/coreos/etcd/Godeps/_workspace/src/gogoproto/gogo.pb"
|
|
|
|
|
|
|
+// discarding unused import gogoproto "github.com/coreos/etcd/Godeps/_workspace/src/gogoproto"
|
|
|
|
|
|
|
|
import io "io"
|
|
import io "io"
|
|
|
import fmt "fmt"
|
|
import fmt "fmt"
|
|
@@ -62,7 +62,226 @@ func (m *Metadata) Reset() { *m = Metadata{} }
|
|
|
func (m *Metadata) String() string { return proto.CompactTextString(m) }
|
|
func (m *Metadata) String() string { return proto.CompactTextString(m) }
|
|
|
func (*Metadata) ProtoMessage() {}
|
|
func (*Metadata) ProtoMessage() {}
|
|
|
|
|
|
|
|
-func init() {
|
|
|
|
|
|
|
+func (m *Request) Marshal() (data []byte, err error) {
|
|
|
|
|
+ size := m.Size()
|
|
|
|
|
+ data = make([]byte, size)
|
|
|
|
|
+ n, err := m.MarshalTo(data)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return nil, err
|
|
|
|
|
+ }
|
|
|
|
|
+ return data[:n], nil
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (m *Request) MarshalTo(data []byte) (int, error) {
|
|
|
|
|
+ var i int
|
|
|
|
|
+ _ = 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
|
|
|
|
|
+ }
|
|
|
|
|
+ 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.XXX_unrecognized != nil {
|
|
|
|
|
+ i += copy(data[i:], m.XXX_unrecognized)
|
|
|
|
|
+ }
|
|
|
|
|
+ return i, nil
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (m *Metadata) Marshal() (data []byte, err error) {
|
|
|
|
|
+ size := m.Size()
|
|
|
|
|
+ data = make([]byte, size)
|
|
|
|
|
+ n, err := m.MarshalTo(data)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return nil, err
|
|
|
|
|
+ }
|
|
|
|
|
+ return data[:n], nil
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (m *Metadata) MarshalTo(data []byte) (int, error) {
|
|
|
|
|
+ var i int
|
|
|
|
|
+ _ = 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)
|
|
|
|
|
+ }
|
|
|
|
|
+ return i, nil
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func encodeFixed64Etcdserver(data []byte, offset int, v uint64) int {
|
|
|
|
|
+ data[offset] = uint8(v)
|
|
|
|
|
+ data[offset+1] = uint8(v >> 8)
|
|
|
|
|
+ data[offset+2] = uint8(v >> 16)
|
|
|
|
|
+ data[offset+3] = uint8(v >> 24)
|
|
|
|
|
+ data[offset+4] = uint8(v >> 32)
|
|
|
|
|
+ data[offset+5] = uint8(v >> 40)
|
|
|
|
|
+ data[offset+6] = uint8(v >> 48)
|
|
|
|
|
+ data[offset+7] = uint8(v >> 56)
|
|
|
|
|
+ return offset + 8
|
|
|
|
|
+}
|
|
|
|
|
+func encodeFixed32Etcdserver(data []byte, offset int, v uint32) int {
|
|
|
|
|
+ data[offset] = uint8(v)
|
|
|
|
|
+ data[offset+1] = uint8(v >> 8)
|
|
|
|
|
+ data[offset+2] = uint8(v >> 16)
|
|
|
|
|
+ data[offset+3] = uint8(v >> 24)
|
|
|
|
|
+ return offset + 4
|
|
|
|
|
+}
|
|
|
|
|
+func encodeVarintEtcdserver(data []byte, offset int, v uint64) int {
|
|
|
|
|
+ for v >= 1<<7 {
|
|
|
|
|
+ data[offset] = uint8(v&0x7f | 0x80)
|
|
|
|
|
+ v >>= 7
|
|
|
|
|
+ offset++
|
|
|
|
|
+ }
|
|
|
|
|
+ data[offset] = uint8(v)
|
|
|
|
|
+ return offset + 1
|
|
|
|
|
+}
|
|
|
|
|
+func (m *Request) Size() (n int) {
|
|
|
|
|
+ var l int
|
|
|
|
|
+ _ = l
|
|
|
|
|
+ n += 1 + sovEtcdserver(uint64(m.ID))
|
|
|
|
|
+ l = len(m.Method)
|
|
|
|
|
+ n += 1 + l + sovEtcdserver(uint64(l))
|
|
|
|
|
+ l = len(m.Path)
|
|
|
|
|
+ n += 1 + l + sovEtcdserver(uint64(l))
|
|
|
|
|
+ l = len(m.Val)
|
|
|
|
|
+ n += 1 + l + sovEtcdserver(uint64(l))
|
|
|
|
|
+ n += 2
|
|
|
|
|
+ l = len(m.PrevValue)
|
|
|
|
|
+ n += 1 + l + sovEtcdserver(uint64(l))
|
|
|
|
|
+ n += 1 + sovEtcdserver(uint64(m.PrevIndex))
|
|
|
|
|
+ if m.PrevExist != nil {
|
|
|
|
|
+ n += 2
|
|
|
|
|
+ }
|
|
|
|
|
+ n += 1 + sovEtcdserver(uint64(m.Expiration))
|
|
|
|
|
+ n += 2
|
|
|
|
|
+ n += 1 + sovEtcdserver(uint64(m.Since))
|
|
|
|
|
+ n += 2
|
|
|
|
|
+ n += 2
|
|
|
|
|
+ n += 2
|
|
|
|
|
+ n += 1 + sovEtcdserver(uint64(m.Time))
|
|
|
|
|
+ n += 3
|
|
|
|
|
+ if m.XXX_unrecognized != nil {
|
|
|
|
|
+ n += len(m.XXX_unrecognized)
|
|
|
|
|
+ }
|
|
|
|
|
+ return n
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (m *Metadata) Size() (n int) {
|
|
|
|
|
+ var l int
|
|
|
|
|
+ _ = l
|
|
|
|
|
+ n += 1 + sovEtcdserver(uint64(m.NodeID))
|
|
|
|
|
+ n += 1 + sovEtcdserver(uint64(m.ClusterID))
|
|
|
|
|
+ if m.XXX_unrecognized != nil {
|
|
|
|
|
+ n += len(m.XXX_unrecognized)
|
|
|
|
|
+ }
|
|
|
|
|
+ return n
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func sovEtcdserver(x uint64) (n int) {
|
|
|
|
|
+ for {
|
|
|
|
|
+ n++
|
|
|
|
|
+ x >>= 7
|
|
|
|
|
+ if x == 0 {
|
|
|
|
|
+ break
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return n
|
|
|
|
|
+}
|
|
|
|
|
+func sozEtcdserver(x uint64) (n int) {
|
|
|
|
|
+ return sovEtcdserver(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
|
|
}
|
|
}
|
|
|
func (m *Request) Unmarshal(data []byte) error {
|
|
func (m *Request) Unmarshal(data []byte) error {
|
|
|
l := len(data)
|
|
l := len(data)
|
|
@@ -87,6 +306,7 @@ func (m *Request) Unmarshal(data []byte) error {
|
|
|
if wireType != 0 {
|
|
if wireType != 0 {
|
|
|
return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
|
|
return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
|
|
|
}
|
|
}
|
|
|
|
|
+ m.ID = 0
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
if iNdEx >= l {
|
|
if iNdEx >= l {
|
|
|
return io.ErrUnexpectedEOF
|
|
return io.ErrUnexpectedEOF
|
|
@@ -114,7 +334,11 @@ func (m *Request) Unmarshal(data []byte) error {
|
|
|
break
|
|
break
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- postIndex := iNdEx + int(stringLen)
|
|
|
|
|
|
|
+ intStringLen := int(stringLen)
|
|
|
|
|
+ if intStringLen < 0 {
|
|
|
|
|
+ return ErrInvalidLengthEtcdserver
|
|
|
|
|
+ }
|
|
|
|
|
+ postIndex := iNdEx + intStringLen
|
|
|
if postIndex > l {
|
|
if postIndex > l {
|
|
|
return io.ErrUnexpectedEOF
|
|
return io.ErrUnexpectedEOF
|
|
|
}
|
|
}
|
|
@@ -136,7 +360,11 @@ func (m *Request) Unmarshal(data []byte) error {
|
|
|
break
|
|
break
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- postIndex := iNdEx + int(stringLen)
|
|
|
|
|
|
|
+ intStringLen := int(stringLen)
|
|
|
|
|
+ if intStringLen < 0 {
|
|
|
|
|
+ return ErrInvalidLengthEtcdserver
|
|
|
|
|
+ }
|
|
|
|
|
+ postIndex := iNdEx + intStringLen
|
|
|
if postIndex > l {
|
|
if postIndex > l {
|
|
|
return io.ErrUnexpectedEOF
|
|
return io.ErrUnexpectedEOF
|
|
|
}
|
|
}
|
|
@@ -158,7 +386,11 @@ func (m *Request) Unmarshal(data []byte) error {
|
|
|
break
|
|
break
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- postIndex := iNdEx + int(stringLen)
|
|
|
|
|
|
|
+ intStringLen := int(stringLen)
|
|
|
|
|
+ if intStringLen < 0 {
|
|
|
|
|
+ return ErrInvalidLengthEtcdserver
|
|
|
|
|
+ }
|
|
|
|
|
+ postIndex := iNdEx + intStringLen
|
|
|
if postIndex > l {
|
|
if postIndex > l {
|
|
|
return io.ErrUnexpectedEOF
|
|
return io.ErrUnexpectedEOF
|
|
|
}
|
|
}
|
|
@@ -197,7 +429,11 @@ func (m *Request) Unmarshal(data []byte) error {
|
|
|
break
|
|
break
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- postIndex := iNdEx + int(stringLen)
|
|
|
|
|
|
|
+ intStringLen := int(stringLen)
|
|
|
|
|
+ if intStringLen < 0 {
|
|
|
|
|
+ return ErrInvalidLengthEtcdserver
|
|
|
|
|
+ }
|
|
|
|
|
+ postIndex := iNdEx + intStringLen
|
|
|
if postIndex > l {
|
|
if postIndex > l {
|
|
|
return io.ErrUnexpectedEOF
|
|
return io.ErrUnexpectedEOF
|
|
|
}
|
|
}
|
|
@@ -207,6 +443,7 @@ func (m *Request) Unmarshal(data []byte) error {
|
|
|
if wireType != 0 {
|
|
if wireType != 0 {
|
|
|
return fmt.Errorf("proto: wrong wireType = %d for field PrevIndex", wireType)
|
|
return fmt.Errorf("proto: wrong wireType = %d for field PrevIndex", wireType)
|
|
|
}
|
|
}
|
|
|
|
|
+ m.PrevIndex = 0
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
if iNdEx >= l {
|
|
if iNdEx >= l {
|
|
|
return io.ErrUnexpectedEOF
|
|
return io.ErrUnexpectedEOF
|
|
@@ -240,6 +477,7 @@ func (m *Request) Unmarshal(data []byte) error {
|
|
|
if wireType != 0 {
|
|
if wireType != 0 {
|
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Expiration", wireType)
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Expiration", wireType)
|
|
|
}
|
|
}
|
|
|
|
|
+ m.Expiration = 0
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
if iNdEx >= l {
|
|
if iNdEx >= l {
|
|
|
return io.ErrUnexpectedEOF
|
|
return io.ErrUnexpectedEOF
|
|
@@ -272,6 +510,7 @@ func (m *Request) Unmarshal(data []byte) error {
|
|
|
if wireType != 0 {
|
|
if wireType != 0 {
|
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Since", wireType)
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Since", wireType)
|
|
|
}
|
|
}
|
|
|
|
|
+ m.Since = 0
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
if iNdEx >= l {
|
|
if iNdEx >= l {
|
|
|
return io.ErrUnexpectedEOF
|
|
return io.ErrUnexpectedEOF
|
|
@@ -338,6 +577,7 @@ func (m *Request) Unmarshal(data []byte) error {
|
|
|
if wireType != 0 {
|
|
if wireType != 0 {
|
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType)
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType)
|
|
|
}
|
|
}
|
|
|
|
|
+ m.Time = 0
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
if iNdEx >= l {
|
|
if iNdEx >= l {
|
|
|
return io.ErrUnexpectedEOF
|
|
return io.ErrUnexpectedEOF
|
|
@@ -380,6 +620,9 @@ func (m *Request) Unmarshal(data []byte) error {
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return err
|
|
return err
|
|
|
}
|
|
}
|
|
|
|
|
+ if skippy < 0 {
|
|
|
|
|
+ return ErrInvalidLengthEtcdserver
|
|
|
|
|
+ }
|
|
|
if (iNdEx + skippy) > l {
|
|
if (iNdEx + skippy) > l {
|
|
|
return io.ErrUnexpectedEOF
|
|
return io.ErrUnexpectedEOF
|
|
|
}
|
|
}
|
|
@@ -413,6 +656,7 @@ func (m *Metadata) Unmarshal(data []byte) error {
|
|
|
if wireType != 0 {
|
|
if wireType != 0 {
|
|
|
return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType)
|
|
return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType)
|
|
|
}
|
|
}
|
|
|
|
|
+ m.NodeID = 0
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
if iNdEx >= l {
|
|
if iNdEx >= l {
|
|
|
return io.ErrUnexpectedEOF
|
|
return io.ErrUnexpectedEOF
|
|
@@ -428,6 +672,7 @@ func (m *Metadata) Unmarshal(data []byte) error {
|
|
|
if wireType != 0 {
|
|
if wireType != 0 {
|
|
|
return fmt.Errorf("proto: wrong wireType = %d for field ClusterID", wireType)
|
|
return fmt.Errorf("proto: wrong wireType = %d for field ClusterID", wireType)
|
|
|
}
|
|
}
|
|
|
|
|
+ m.ClusterID = 0
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
if iNdEx >= l {
|
|
if iNdEx >= l {
|
|
|
return io.ErrUnexpectedEOF
|
|
return io.ErrUnexpectedEOF
|
|
@@ -453,6 +698,9 @@ func (m *Metadata) Unmarshal(data []byte) error {
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return err
|
|
return err
|
|
|
}
|
|
}
|
|
|
|
|
+ if skippy < 0 {
|
|
|
|
|
+ return ErrInvalidLengthEtcdserver
|
|
|
|
|
+ }
|
|
|
if (iNdEx + skippy) > l {
|
|
if (iNdEx + skippy) > l {
|
|
|
return io.ErrUnexpectedEOF
|
|
return io.ErrUnexpectedEOF
|
|
|
}
|
|
}
|
|
@@ -509,6 +757,9 @@ func skipEtcdserver(data []byte) (n int, err error) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
iNdEx += length
|
|
iNdEx += length
|
|
|
|
|
+ if length < 0 {
|
|
|
|
|
+ return 0, ErrInvalidLengthEtcdserver
|
|
|
|
|
+ }
|
|
|
return iNdEx, nil
|
|
return iNdEx, nil
|
|
|
case 3:
|
|
case 3:
|
|
|
for {
|
|
for {
|
|
@@ -547,224 +798,7 @@ func skipEtcdserver(data []byte) (n int, err error) {
|
|
|
}
|
|
}
|
|
|
panic("unreachable")
|
|
panic("unreachable")
|
|
|
}
|
|
}
|
|
|
-func (m *Request) Size() (n int) {
|
|
|
|
|
- var l int
|
|
|
|
|
- _ = l
|
|
|
|
|
- n += 1 + sovEtcdserver(uint64(m.ID))
|
|
|
|
|
- l = len(m.Method)
|
|
|
|
|
- n += 1 + l + sovEtcdserver(uint64(l))
|
|
|
|
|
- l = len(m.Path)
|
|
|
|
|
- n += 1 + l + sovEtcdserver(uint64(l))
|
|
|
|
|
- l = len(m.Val)
|
|
|
|
|
- n += 1 + l + sovEtcdserver(uint64(l))
|
|
|
|
|
- n += 2
|
|
|
|
|
- l = len(m.PrevValue)
|
|
|
|
|
- n += 1 + l + sovEtcdserver(uint64(l))
|
|
|
|
|
- n += 1 + sovEtcdserver(uint64(m.PrevIndex))
|
|
|
|
|
- if m.PrevExist != nil {
|
|
|
|
|
- n += 2
|
|
|
|
|
- }
|
|
|
|
|
- n += 1 + sovEtcdserver(uint64(m.Expiration))
|
|
|
|
|
- n += 2
|
|
|
|
|
- n += 1 + sovEtcdserver(uint64(m.Since))
|
|
|
|
|
- n += 2
|
|
|
|
|
- n += 2
|
|
|
|
|
- n += 2
|
|
|
|
|
- n += 1 + sovEtcdserver(uint64(m.Time))
|
|
|
|
|
- n += 3
|
|
|
|
|
- if m.XXX_unrecognized != nil {
|
|
|
|
|
- n += len(m.XXX_unrecognized)
|
|
|
|
|
- }
|
|
|
|
|
- return n
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-func (m *Metadata) Size() (n int) {
|
|
|
|
|
- var l int
|
|
|
|
|
- _ = l
|
|
|
|
|
- n += 1 + sovEtcdserver(uint64(m.NodeID))
|
|
|
|
|
- n += 1 + sovEtcdserver(uint64(m.ClusterID))
|
|
|
|
|
- if m.XXX_unrecognized != nil {
|
|
|
|
|
- n += len(m.XXX_unrecognized)
|
|
|
|
|
- }
|
|
|
|
|
- return n
|
|
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
-func sovEtcdserver(x uint64) (n int) {
|
|
|
|
|
- for {
|
|
|
|
|
- n++
|
|
|
|
|
- x >>= 7
|
|
|
|
|
- if x == 0 {
|
|
|
|
|
- break
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return n
|
|
|
|
|
-}
|
|
|
|
|
-func sozEtcdserver(x uint64) (n int) {
|
|
|
|
|
- return sovEtcdserver(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
|
|
|
|
-}
|
|
|
|
|
-func (m *Request) Marshal() (data []byte, err error) {
|
|
|
|
|
- size := m.Size()
|
|
|
|
|
- data = make([]byte, size)
|
|
|
|
|
- n, err := m.MarshalTo(data)
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- return nil, err
|
|
|
|
|
- }
|
|
|
|
|
- return data[:n], nil
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-func (m *Request) MarshalTo(data []byte) (n int, err error) {
|
|
|
|
|
- var i int
|
|
|
|
|
- _ = 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
|
|
|
|
|
- }
|
|
|
|
|
- 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.XXX_unrecognized != nil {
|
|
|
|
|
- i += copy(data[i:], m.XXX_unrecognized)
|
|
|
|
|
- }
|
|
|
|
|
- return i, nil
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-func (m *Metadata) Marshal() (data []byte, err error) {
|
|
|
|
|
- size := m.Size()
|
|
|
|
|
- data = make([]byte, size)
|
|
|
|
|
- n, err := m.MarshalTo(data)
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- return nil, err
|
|
|
|
|
- }
|
|
|
|
|
- return data[:n], nil
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-func (m *Metadata) MarshalTo(data []byte) (n int, err error) {
|
|
|
|
|
- var i int
|
|
|
|
|
- _ = 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)
|
|
|
|
|
- }
|
|
|
|
|
- return i, nil
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-func encodeFixed64Etcdserver(data []byte, offset int, v uint64) int {
|
|
|
|
|
- data[offset] = uint8(v)
|
|
|
|
|
- data[offset+1] = uint8(v >> 8)
|
|
|
|
|
- data[offset+2] = uint8(v >> 16)
|
|
|
|
|
- data[offset+3] = uint8(v >> 24)
|
|
|
|
|
- data[offset+4] = uint8(v >> 32)
|
|
|
|
|
- data[offset+5] = uint8(v >> 40)
|
|
|
|
|
- data[offset+6] = uint8(v >> 48)
|
|
|
|
|
- data[offset+7] = uint8(v >> 56)
|
|
|
|
|
- return offset + 8
|
|
|
|
|
-}
|
|
|
|
|
-func encodeFixed32Etcdserver(data []byte, offset int, v uint32) int {
|
|
|
|
|
- data[offset] = uint8(v)
|
|
|
|
|
- data[offset+1] = uint8(v >> 8)
|
|
|
|
|
- data[offset+2] = uint8(v >> 16)
|
|
|
|
|
- data[offset+3] = uint8(v >> 24)
|
|
|
|
|
- return offset + 4
|
|
|
|
|
-}
|
|
|
|
|
-func encodeVarintEtcdserver(data []byte, offset int, v uint64) int {
|
|
|
|
|
- for v >= 1<<7 {
|
|
|
|
|
- data[offset] = uint8(v&0x7f | 0x80)
|
|
|
|
|
- v >>= 7
|
|
|
|
|
- offset++
|
|
|
|
|
- }
|
|
|
|
|
- data[offset] = uint8(v)
|
|
|
|
|
- return offset + 1
|
|
|
|
|
-}
|
|
|
|
|
|
|
+var (
|
|
|
|
|
+ ErrInvalidLengthEtcdserver = fmt.Errorf("proto: negative length found during unmarshaling")
|
|
|
|
|
+)
|