2014-08-26 05:39:02 +04:00
|
|
|
// Code generated by protoc-gen-gogo.
|
2014-08-28 06:03:41 +04:00
|
|
|
// source: etcdserver.proto
|
2014-08-26 05:39:02 +04:00
|
|
|
// DO NOT EDIT!
|
|
|
|
|
|
|
|
/*
|
2014-08-28 06:03:41 +04:00
|
|
|
Package etcdserverpb is a generated protocol buffer package.
|
2014-08-26 05:39:02 +04:00
|
|
|
|
|
|
|
It is generated from these files:
|
2014-08-28 06:03:41 +04:00
|
|
|
etcdserver.proto
|
2014-08-26 05:39:02 +04:00
|
|
|
|
|
|
|
It has these top-level messages:
|
|
|
|
Request
|
2014-10-11 16:41:00 +04:00
|
|
|
Metadata
|
2014-08-26 05:39:02 +04:00
|
|
|
*/
|
2014-08-28 06:03:41 +04:00
|
|
|
package etcdserverpb
|
2014-08-26 05:39:02 +04:00
|
|
|
|
2014-10-14 11:35:28 +04:00
|
|
|
import proto "github.com/coreos/etcd/Godeps/_workspace/src/code.google.com/p/gogoprotobuf/proto"
|
2014-08-26 05:39:02 +04:00
|
|
|
import json "encoding/json"
|
|
|
|
import math "math"
|
|
|
|
|
|
|
|
// discarding unused import gogoproto "code.google.com/p/gogoprotobuf/gogoproto/gogo.pb"
|
|
|
|
|
|
|
|
import io "io"
|
2014-10-14 11:35:28 +04:00
|
|
|
import code_google_com_p_gogoprotobuf_proto "github.com/coreos/etcd/Godeps/_workspace/src/code.google.com/p/gogoprotobuf/proto"
|
2014-08-26 05:39:02 +04:00
|
|
|
|
|
|
|
// Reference proto, json, and math imports to suppress error if they are not otherwise used.
|
|
|
|
var _ = proto.Marshal
|
|
|
|
var _ = &json.SyntaxError{}
|
|
|
|
var _ = math.Inf
|
|
|
|
|
|
|
|
type Request struct {
|
2014-10-12 04:35:58 +04:00
|
|
|
ID uint64 `protobuf:"varint,1,req" json:"ID"`
|
2014-09-23 21:17:53 +04:00
|
|
|
Method string `protobuf:"bytes,2,req" json:"Method"`
|
|
|
|
Path string `protobuf:"bytes,3,req" json:"Path"`
|
|
|
|
Val string `protobuf:"bytes,4,req" json:"Val"`
|
|
|
|
Dir bool `protobuf:"varint,5,req" json:"Dir"`
|
|
|
|
PrevValue string `protobuf:"bytes,6,req" json:"PrevValue"`
|
|
|
|
PrevIndex uint64 `protobuf:"varint,7,req" json:"PrevIndex"`
|
|
|
|
PrevExist *bool `protobuf:"varint,8,req" json:"PrevExist,omitempty"`
|
|
|
|
Expiration int64 `protobuf:"varint,9,req" json:"Expiration"`
|
|
|
|
Wait bool `protobuf:"varint,10,req" json:"Wait"`
|
|
|
|
Since uint64 `protobuf:"varint,11,req" json:"Since"`
|
|
|
|
Recursive bool `protobuf:"varint,12,req" json:"Recursive"`
|
|
|
|
Sorted bool `protobuf:"varint,13,req" json:"Sorted"`
|
|
|
|
Quorum bool `protobuf:"varint,14,req" json:"Quorum"`
|
|
|
|
Time int64 `protobuf:"varint,15,req" json:"Time"`
|
|
|
|
Stream bool `protobuf:"varint,16,req" json:"Stream"`
|
2014-08-26 05:39:02 +04:00
|
|
|
XXX_unrecognized []byte `json:"-"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Request) Reset() { *m = Request{} }
|
|
|
|
func (m *Request) String() string { return proto.CompactTextString(m) }
|
|
|
|
func (*Request) ProtoMessage() {}
|
|
|
|
|
2014-10-11 16:41:00 +04:00
|
|
|
type Metadata struct {
|
|
|
|
NodeID uint64 `protobuf:"varint,1,req" json:"NodeID"`
|
2014-10-11 15:20:14 +04:00
|
|
|
ClusterID uint64 `protobuf:"varint,2,req" json:"ClusterID"`
|
2014-10-03 04:06:35 +04:00
|
|
|
XXX_unrecognized []byte `json:"-"`
|
|
|
|
}
|
|
|
|
|
2014-10-11 16:41:00 +04:00
|
|
|
func (m *Metadata) Reset() { *m = Metadata{} }
|
|
|
|
func (m *Metadata) String() string { return proto.CompactTextString(m) }
|
|
|
|
func (*Metadata) ProtoMessage() {}
|
2014-10-03 04:06:35 +04:00
|
|
|
|
2014-08-26 05:39:02 +04:00
|
|
|
func init() {
|
|
|
|
}
|
|
|
|
func (m *Request) Unmarshal(data []byte) error {
|
|
|
|
l := len(data)
|
|
|
|
index := 0
|
|
|
|
for index < l {
|
|
|
|
var wire uint64
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if index >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := data[index]
|
|
|
|
index++
|
|
|
|
wire |= (uint64(b) & 0x7F) << shift
|
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fieldNum := int32(wire >> 3)
|
|
|
|
wireType := int(wire & 0x7)
|
|
|
|
switch fieldNum {
|
|
|
|
case 1:
|
|
|
|
if wireType != 0 {
|
|
|
|
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
|
|
|
|
}
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if index >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := data[index]
|
|
|
|
index++
|
2014-10-12 04:35:58 +04:00
|
|
|
m.ID |= (uint64(b) & 0x7F) << shift
|
2014-08-26 05:39:02 +04:00
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case 2:
|
|
|
|
if wireType != 2 {
|
|
|
|
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
|
|
|
|
}
|
|
|
|
var stringLen uint64
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if index >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := data[index]
|
|
|
|
index++
|
|
|
|
stringLen |= (uint64(b) & 0x7F) << shift
|
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
postIndex := index + int(stringLen)
|
|
|
|
if postIndex > l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
m.Method = string(data[index:postIndex])
|
|
|
|
index = postIndex
|
|
|
|
case 3:
|
|
|
|
if wireType != 2 {
|
|
|
|
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
|
|
|
|
}
|
|
|
|
var stringLen uint64
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if index >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := data[index]
|
|
|
|
index++
|
|
|
|
stringLen |= (uint64(b) & 0x7F) << shift
|
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
postIndex := index + int(stringLen)
|
|
|
|
if postIndex > l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
2014-08-27 02:28:21 +04:00
|
|
|
m.Path = string(data[index:postIndex])
|
2014-08-26 05:39:02 +04:00
|
|
|
index = postIndex
|
|
|
|
case 4:
|
|
|
|
if wireType != 2 {
|
|
|
|
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
|
|
|
|
}
|
|
|
|
var stringLen uint64
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if index >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := data[index]
|
|
|
|
index++
|
|
|
|
stringLen |= (uint64(b) & 0x7F) << shift
|
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
postIndex := index + int(stringLen)
|
|
|
|
if postIndex > l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
m.Val = string(data[index:postIndex])
|
|
|
|
index = postIndex
|
|
|
|
case 5:
|
|
|
|
if wireType != 0 {
|
|
|
|
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
|
|
|
|
}
|
|
|
|
var v int
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if index >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := data[index]
|
|
|
|
index++
|
|
|
|
v |= (int(b) & 0x7F) << shift
|
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m.Dir = bool(v != 0)
|
|
|
|
case 6:
|
|
|
|
if wireType != 2 {
|
|
|
|
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
|
|
|
|
}
|
|
|
|
var stringLen uint64
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if index >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := data[index]
|
|
|
|
index++
|
|
|
|
stringLen |= (uint64(b) & 0x7F) << shift
|
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
postIndex := index + int(stringLen)
|
|
|
|
if postIndex > l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
m.PrevValue = string(data[index:postIndex])
|
|
|
|
index = postIndex
|
|
|
|
case 7:
|
|
|
|
if wireType != 0 {
|
|
|
|
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
|
|
|
|
}
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if index >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := data[index]
|
|
|
|
index++
|
2014-08-27 03:39:26 +04:00
|
|
|
m.PrevIndex |= (uint64(b) & 0x7F) << shift
|
2014-08-26 05:39:02 +04:00
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case 8:
|
|
|
|
if wireType != 0 {
|
|
|
|
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
|
|
|
|
}
|
|
|
|
var v int
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if index >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := data[index]
|
|
|
|
index++
|
|
|
|
v |= (int(b) & 0x7F) << shift
|
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
2014-08-27 22:54:29 +04:00
|
|
|
b := bool(v != 0)
|
2014-09-19 08:22:10 +04:00
|
|
|
m.PrevExist = &b
|
2014-08-26 05:39:02 +04:00
|
|
|
case 9:
|
|
|
|
if wireType != 0 {
|
|
|
|
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
|
|
|
|
}
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if index >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := data[index]
|
|
|
|
index++
|
|
|
|
m.Expiration |= (int64(b) & 0x7F) << shift
|
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
2014-08-27 02:28:21 +04:00
|
|
|
case 10:
|
|
|
|
if wireType != 0 {
|
|
|
|
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
|
|
|
|
}
|
|
|
|
var v int
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if index >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := data[index]
|
|
|
|
index++
|
|
|
|
v |= (int(b) & 0x7F) << shift
|
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m.Wait = bool(v != 0)
|
|
|
|
case 11:
|
|
|
|
if wireType != 0 {
|
|
|
|
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
|
|
|
|
}
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if index >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := data[index]
|
|
|
|
index++
|
|
|
|
m.Since |= (uint64(b) & 0x7F) << shift
|
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case 12:
|
|
|
|
if wireType != 0 {
|
|
|
|
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
|
|
|
|
}
|
|
|
|
var v int
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if index >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := data[index]
|
|
|
|
index++
|
|
|
|
v |= (int(b) & 0x7F) << shift
|
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m.Recursive = bool(v != 0)
|
|
|
|
case 13:
|
|
|
|
if wireType != 0 {
|
|
|
|
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
|
|
|
|
}
|
|
|
|
var v int
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if index >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := data[index]
|
|
|
|
index++
|
|
|
|
v |= (int(b) & 0x7F) << shift
|
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m.Sorted = bool(v != 0)
|
2014-08-31 01:35:27 +04:00
|
|
|
case 14:
|
|
|
|
if wireType != 0 {
|
|
|
|
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
|
|
|
|
}
|
|
|
|
var v int
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if index >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := data[index]
|
|
|
|
index++
|
|
|
|
v |= (int(b) & 0x7F) << shift
|
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m.Quorum = bool(v != 0)
|
2014-09-16 04:35:02 +04:00
|
|
|
case 15:
|
|
|
|
if wireType != 0 {
|
|
|
|
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
|
|
|
|
}
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if index >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := data[index]
|
|
|
|
index++
|
|
|
|
m.Time |= (int64(b) & 0x7F) << shift
|
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
2014-09-24 01:08:18 +04:00
|
|
|
case 16:
|
|
|
|
if wireType != 0 {
|
|
|
|
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
|
|
|
|
}
|
|
|
|
var v int
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if index >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := data[index]
|
|
|
|
index++
|
|
|
|
v |= (int(b) & 0x7F) << shift
|
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m.Stream = bool(v != 0)
|
2014-08-26 05:39:02 +04:00
|
|
|
default:
|
|
|
|
var sizeOfWire int
|
|
|
|
for {
|
|
|
|
sizeOfWire++
|
|
|
|
wire >>= 7
|
|
|
|
if wire == 0 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
index -= sizeOfWire
|
|
|
|
skippy, err := code_google_com_p_gogoprotobuf_proto.Skip(data[index:])
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if (index + skippy) > l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
|
|
|
|
index += skippy
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
2014-10-11 16:41:00 +04:00
|
|
|
func (m *Metadata) Unmarshal(data []byte) error {
|
2014-10-03 04:06:35 +04:00
|
|
|
l := len(data)
|
|
|
|
index := 0
|
|
|
|
for index < l {
|
|
|
|
var wire uint64
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if index >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := data[index]
|
|
|
|
index++
|
|
|
|
wire |= (uint64(b) & 0x7F) << shift
|
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fieldNum := int32(wire >> 3)
|
|
|
|
wireType := int(wire & 0x7)
|
|
|
|
switch fieldNum {
|
|
|
|
case 1:
|
|
|
|
if wireType != 0 {
|
|
|
|
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
|
|
|
|
}
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if index >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := data[index]
|
|
|
|
index++
|
2014-10-11 16:41:00 +04:00
|
|
|
m.NodeID |= (uint64(b) & 0x7F) << shift
|
2014-10-03 04:06:35 +04:00
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
2014-10-11 15:20:14 +04:00
|
|
|
case 2:
|
|
|
|
if wireType != 0 {
|
|
|
|
return code_google_com_p_gogoprotobuf_proto.ErrWrongType
|
|
|
|
}
|
|
|
|
for shift := uint(0); ; shift += 7 {
|
|
|
|
if index >= l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
b := data[index]
|
|
|
|
index++
|
|
|
|
m.ClusterID |= (uint64(b) & 0x7F) << shift
|
|
|
|
if b < 0x80 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
2014-10-03 04:06:35 +04:00
|
|
|
default:
|
|
|
|
var sizeOfWire int
|
|
|
|
for {
|
|
|
|
sizeOfWire++
|
|
|
|
wire >>= 7
|
|
|
|
if wire == 0 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
index -= sizeOfWire
|
|
|
|
skippy, err := code_google_com_p_gogoprotobuf_proto.Skip(data[index:])
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if (index + skippy) > l {
|
|
|
|
return io.ErrUnexpectedEOF
|
|
|
|
}
|
|
|
|
m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
|
|
|
|
index += skippy
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
2014-08-26 05:39:02 +04:00
|
|
|
func (m *Request) Size() (n int) {
|
|
|
|
var l int
|
|
|
|
_ = l
|
2014-09-23 21:17:53 +04:00
|
|
|
n += 1 + sovEtcdserver(uint64(m.ID))
|
2014-08-26 05:39:02 +04:00
|
|
|
l = len(m.Method)
|
2014-08-28 06:03:41 +04:00
|
|
|
n += 1 + l + sovEtcdserver(uint64(l))
|
2014-08-27 02:28:21 +04:00
|
|
|
l = len(m.Path)
|
2014-08-28 06:03:41 +04:00
|
|
|
n += 1 + l + sovEtcdserver(uint64(l))
|
2014-08-26 05:39:02 +04:00
|
|
|
l = len(m.Val)
|
2014-08-28 06:03:41 +04:00
|
|
|
n += 1 + l + sovEtcdserver(uint64(l))
|
2014-08-26 05:39:02 +04:00
|
|
|
n += 2
|
|
|
|
l = len(m.PrevValue)
|
2014-08-28 06:03:41 +04:00
|
|
|
n += 1 + l + sovEtcdserver(uint64(l))
|
|
|
|
n += 1 + sovEtcdserver(uint64(m.PrevIndex))
|
2014-09-19 08:22:10 +04:00
|
|
|
if m.PrevExist != nil {
|
2014-08-27 22:54:29 +04:00
|
|
|
n += 2
|
|
|
|
}
|
2014-08-28 06:03:41 +04:00
|
|
|
n += 1 + sovEtcdserver(uint64(m.Expiration))
|
2014-08-27 02:28:21 +04:00
|
|
|
n += 2
|
2014-08-28 06:03:41 +04:00
|
|
|
n += 1 + sovEtcdserver(uint64(m.Since))
|
2014-08-27 02:28:21 +04:00
|
|
|
n += 2
|
|
|
|
n += 2
|
2014-08-31 01:35:27 +04:00
|
|
|
n += 2
|
2014-09-16 04:35:02 +04:00
|
|
|
n += 1 + sovEtcdserver(uint64(m.Time))
|
2014-09-24 01:08:18 +04:00
|
|
|
n += 3
|
2014-08-26 05:39:02 +04:00
|
|
|
if m.XXX_unrecognized != nil {
|
|
|
|
n += len(m.XXX_unrecognized)
|
|
|
|
}
|
|
|
|
return n
|
|
|
|
}
|
2014-10-11 16:41:00 +04:00
|
|
|
func (m *Metadata) Size() (n int) {
|
2014-10-03 04:06:35 +04:00
|
|
|
var l int
|
|
|
|
_ = l
|
2014-10-11 16:41:00 +04:00
|
|
|
n += 1 + sovEtcdserver(uint64(m.NodeID))
|
2014-10-11 15:20:14 +04:00
|
|
|
n += 1 + sovEtcdserver(uint64(m.ClusterID))
|
2014-10-03 04:06:35 +04:00
|
|
|
if m.XXX_unrecognized != nil {
|
|
|
|
n += len(m.XXX_unrecognized)
|
|
|
|
}
|
|
|
|
return n
|
|
|
|
}
|
2014-08-26 05:39:02 +04:00
|
|
|
|
2014-08-28 06:03:41 +04:00
|
|
|
func sovEtcdserver(x uint64) (n int) {
|
2014-08-26 05:39:02 +04:00
|
|
|
for {
|
|
|
|
n++
|
|
|
|
x >>= 7
|
|
|
|
if x == 0 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return n
|
|
|
|
}
|
2014-08-28 06:03:41 +04:00
|
|
|
func sozEtcdserver(x uint64) (n int) {
|
|
|
|
return sovEtcdserver(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
2014-08-26 05:39:02 +04:00
|
|
|
}
|
|
|
|
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++
|
2014-09-23 21:17:53 +04:00
|
|
|
i = encodeVarintEtcdserver(data, i, uint64(m.ID))
|
2014-08-26 05:39:02 +04:00
|
|
|
data[i] = 0x12
|
|
|
|
i++
|
2014-08-28 06:03:41 +04:00
|
|
|
i = encodeVarintEtcdserver(data, i, uint64(len(m.Method)))
|
2014-08-26 05:39:02 +04:00
|
|
|
i += copy(data[i:], m.Method)
|
|
|
|
data[i] = 0x1a
|
|
|
|
i++
|
2014-08-28 06:03:41 +04:00
|
|
|
i = encodeVarintEtcdserver(data, i, uint64(len(m.Path)))
|
2014-08-27 02:28:21 +04:00
|
|
|
i += copy(data[i:], m.Path)
|
2014-08-26 05:39:02 +04:00
|
|
|
data[i] = 0x22
|
|
|
|
i++
|
2014-08-28 06:03:41 +04:00
|
|
|
i = encodeVarintEtcdserver(data, i, uint64(len(m.Val)))
|
2014-08-26 05:39:02 +04:00
|
|
|
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++
|
2014-08-28 06:03:41 +04:00
|
|
|
i = encodeVarintEtcdserver(data, i, uint64(len(m.PrevValue)))
|
2014-08-26 05:39:02 +04:00
|
|
|
i += copy(data[i:], m.PrevValue)
|
|
|
|
data[i] = 0x38
|
|
|
|
i++
|
2014-08-28 06:03:41 +04:00
|
|
|
i = encodeVarintEtcdserver(data, i, uint64(m.PrevIndex))
|
2014-09-19 08:22:10 +04:00
|
|
|
if m.PrevExist != nil {
|
2014-08-27 22:54:29 +04:00
|
|
|
data[i] = 0x40
|
|
|
|
i++
|
2014-09-19 08:22:10 +04:00
|
|
|
if *m.PrevExist {
|
2014-08-27 22:54:29 +04:00
|
|
|
data[i] = 1
|
|
|
|
} else {
|
|
|
|
data[i] = 0
|
|
|
|
}
|
|
|
|
i++
|
2014-08-26 05:39:02 +04:00
|
|
|
}
|
|
|
|
data[i] = 0x48
|
|
|
|
i++
|
2014-08-28 06:03:41 +04:00
|
|
|
i = encodeVarintEtcdserver(data, i, uint64(m.Expiration))
|
2014-08-27 02:28:21 +04:00
|
|
|
data[i] = 0x50
|
|
|
|
i++
|
|
|
|
if m.Wait {
|
|
|
|
data[i] = 1
|
|
|
|
} else {
|
|
|
|
data[i] = 0
|
|
|
|
}
|
|
|
|
i++
|
|
|
|
data[i] = 0x58
|
|
|
|
i++
|
2014-08-28 06:03:41 +04:00
|
|
|
i = encodeVarintEtcdserver(data, i, uint64(m.Since))
|
2014-08-27 02:28:21 +04:00
|
|
|
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++
|
2014-08-31 01:35:27 +04:00
|
|
|
data[i] = 0x70
|
|
|
|
i++
|
|
|
|
if m.Quorum {
|
|
|
|
data[i] = 1
|
|
|
|
} else {
|
|
|
|
data[i] = 0
|
|
|
|
}
|
|
|
|
i++
|
2014-09-16 04:35:02 +04:00
|
|
|
data[i] = 0x78
|
|
|
|
i++
|
|
|
|
i = encodeVarintEtcdserver(data, i, uint64(m.Time))
|
2014-09-24 01:08:18 +04:00
|
|
|
data[i] = 0x80
|
|
|
|
i++
|
|
|
|
data[i] = 0x1
|
|
|
|
i++
|
|
|
|
if m.Stream {
|
|
|
|
data[i] = 1
|
|
|
|
} else {
|
|
|
|
data[i] = 0
|
|
|
|
}
|
|
|
|
i++
|
2014-08-26 05:39:02 +04:00
|
|
|
if m.XXX_unrecognized != nil {
|
|
|
|
i += copy(data[i:], m.XXX_unrecognized)
|
|
|
|
}
|
|
|
|
return i, nil
|
|
|
|
}
|
2014-10-11 16:41:00 +04:00
|
|
|
func (m *Metadata) Marshal() (data []byte, err error) {
|
2014-10-03 04:06:35 +04:00
|
|
|
size := m.Size()
|
|
|
|
data = make([]byte, size)
|
|
|
|
n, err := m.MarshalTo(data)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return data[:n], nil
|
|
|
|
}
|
|
|
|
|
2014-10-11 16:41:00 +04:00
|
|
|
func (m *Metadata) MarshalTo(data []byte) (n int, err error) {
|
2014-10-03 04:06:35 +04:00
|
|
|
var i int
|
|
|
|
_ = i
|
|
|
|
var l int
|
|
|
|
_ = l
|
|
|
|
data[i] = 0x8
|
|
|
|
i++
|
2014-10-11 16:41:00 +04:00
|
|
|
i = encodeVarintEtcdserver(data, i, uint64(m.NodeID))
|
2014-10-11 15:20:14 +04:00
|
|
|
data[i] = 0x10
|
|
|
|
i++
|
|
|
|
i = encodeVarintEtcdserver(data, i, uint64(m.ClusterID))
|
2014-10-03 04:06:35 +04:00
|
|
|
if m.XXX_unrecognized != nil {
|
|
|
|
i += copy(data[i:], m.XXX_unrecognized)
|
|
|
|
}
|
|
|
|
return i, nil
|
|
|
|
}
|
2014-08-28 06:03:41 +04:00
|
|
|
func encodeFixed64Etcdserver(data []byte, offset int, v uint64) int {
|
2014-08-26 05:39:02 +04:00
|
|
|
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
|
|
|
|
}
|
2014-08-28 06:03:41 +04:00
|
|
|
func encodeFixed32Etcdserver(data []byte, offset int, v uint32) int {
|
2014-08-26 05:39:02 +04:00
|
|
|
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
|
|
|
|
}
|
2014-08-28 06:03:41 +04:00
|
|
|
func encodeVarintEtcdserver(data []byte, offset int, v uint64) int {
|
2014-08-26 05:39:02 +04:00
|
|
|
for v >= 1<<7 {
|
|
|
|
data[offset] = uint8(v&0x7f | 0x80)
|
|
|
|
v >>= 7
|
|
|
|
offset++
|
|
|
|
}
|
|
|
|
data[offset] = uint8(v)
|
|
|
|
return offset + 1
|
|
|
|
}
|