kv.pb.go 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830
  1. // Code generated by protoc-gen-gogo. DO NOT EDIT.
  2. // source: kv.proto
  3. package mvccpb
  4. import (
  5. fmt "fmt"
  6. io "io"
  7. math "math"
  8. math_bits "math/bits"
  9. _ "github.com/gogo/protobuf/gogoproto"
  10. proto "github.com/golang/protobuf/proto"
  11. )
  12. // Reference imports to suppress errors if they are not otherwise used.
  13. var _ = proto.Marshal
  14. var _ = fmt.Errorf
  15. var _ = math.Inf
  16. // This is a compile-time assertion to ensure that this generated file
  17. // is compatible with the proto package it is being compiled against.
  18. // A compilation error at this line likely means your copy of the
  19. // proto package needs to be updated.
  20. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
  21. type Event_EventType int32
  22. const (
  23. PUT Event_EventType = 0
  24. DELETE Event_EventType = 1
  25. )
  26. var Event_EventType_name = map[int32]string{
  27. 0: "PUT",
  28. 1: "DELETE",
  29. }
  30. var Event_EventType_value = map[string]int32{
  31. "PUT": 0,
  32. "DELETE": 1,
  33. }
  34. func (x Event_EventType) String() string {
  35. return proto.EnumName(Event_EventType_name, int32(x))
  36. }
  37. func (Event_EventType) EnumDescriptor() ([]byte, []int) {
  38. return fileDescriptor_2216fe83c9c12408, []int{1, 0}
  39. }
  40. type KeyValue struct {
  41. // key is the key in bytes. An empty key is not allowed.
  42. Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
  43. // create_revision is the revision of last creation on this key.
  44. CreateRevision int64 `protobuf:"varint,2,opt,name=create_revision,json=createRevision,proto3" json:"create_revision,omitempty"`
  45. // mod_revision is the revision of last modification on this key.
  46. ModRevision int64 `protobuf:"varint,3,opt,name=mod_revision,json=modRevision,proto3" json:"mod_revision,omitempty"`
  47. // version is the version of the key. A deletion resets
  48. // the version to zero and any modification of the key
  49. // increases its version.
  50. Version int64 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"`
  51. // value is the value held by the key, in bytes.
  52. Value []byte `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"`
  53. // lease is the ID of the lease that attached to key.
  54. // When the attached lease expires, the key will be deleted.
  55. // If lease is 0, then no lease is attached to the key.
  56. Lease int64 `protobuf:"varint,6,opt,name=lease,proto3" json:"lease,omitempty"`
  57. XXX_NoUnkeyedLiteral struct{} `json:"-"`
  58. XXX_unrecognized []byte `json:"-"`
  59. XXX_sizecache int32 `json:"-"`
  60. }
  61. func (m *KeyValue) Reset() { *m = KeyValue{} }
  62. func (m *KeyValue) String() string { return proto.CompactTextString(m) }
  63. func (*KeyValue) ProtoMessage() {}
  64. func (*KeyValue) Descriptor() ([]byte, []int) {
  65. return fileDescriptor_2216fe83c9c12408, []int{0}
  66. }
  67. func (m *KeyValue) XXX_Unmarshal(b []byte) error {
  68. return m.Unmarshal(b)
  69. }
  70. func (m *KeyValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
  71. if deterministic {
  72. return xxx_messageInfo_KeyValue.Marshal(b, m, deterministic)
  73. } else {
  74. b = b[:cap(b)]
  75. n, err := m.MarshalToSizedBuffer(b)
  76. if err != nil {
  77. return nil, err
  78. }
  79. return b[:n], nil
  80. }
  81. }
  82. func (m *KeyValue) XXX_Merge(src proto.Message) {
  83. xxx_messageInfo_KeyValue.Merge(m, src)
  84. }
  85. func (m *KeyValue) XXX_Size() int {
  86. return m.Size()
  87. }
  88. func (m *KeyValue) XXX_DiscardUnknown() {
  89. xxx_messageInfo_KeyValue.DiscardUnknown(m)
  90. }
  91. var xxx_messageInfo_KeyValue proto.InternalMessageInfo
  92. type Event struct {
  93. // type is the kind of event. If type is a PUT, it indicates
  94. // new data has been stored to the key. If type is a DELETE,
  95. // it indicates the key was deleted.
  96. Type Event_EventType `protobuf:"varint,1,opt,name=type,proto3,enum=mvccpb.Event_EventType" json:"type,omitempty"`
  97. // kv holds the KeyValue for the event.
  98. // A PUT event contains current kv pair.
  99. // A PUT event with kv.Version=1 indicates the creation of a key.
  100. // A DELETE/EXPIRE event contains the deleted key with
  101. // its modification revision set to the revision of deletion.
  102. Kv *KeyValue `protobuf:"bytes,2,opt,name=kv,proto3" json:"kv,omitempty"`
  103. // prev_kv holds the key-value pair before the event happens.
  104. PrevKv *KeyValue `protobuf:"bytes,3,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"`
  105. XXX_NoUnkeyedLiteral struct{} `json:"-"`
  106. XXX_unrecognized []byte `json:"-"`
  107. XXX_sizecache int32 `json:"-"`
  108. }
  109. func (m *Event) Reset() { *m = Event{} }
  110. func (m *Event) String() string { return proto.CompactTextString(m) }
  111. func (*Event) ProtoMessage() {}
  112. func (*Event) Descriptor() ([]byte, []int) {
  113. return fileDescriptor_2216fe83c9c12408, []int{1}
  114. }
  115. func (m *Event) XXX_Unmarshal(b []byte) error {
  116. return m.Unmarshal(b)
  117. }
  118. func (m *Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
  119. if deterministic {
  120. return xxx_messageInfo_Event.Marshal(b, m, deterministic)
  121. } else {
  122. b = b[:cap(b)]
  123. n, err := m.MarshalToSizedBuffer(b)
  124. if err != nil {
  125. return nil, err
  126. }
  127. return b[:n], nil
  128. }
  129. }
  130. func (m *Event) XXX_Merge(src proto.Message) {
  131. xxx_messageInfo_Event.Merge(m, src)
  132. }
  133. func (m *Event) XXX_Size() int {
  134. return m.Size()
  135. }
  136. func (m *Event) XXX_DiscardUnknown() {
  137. xxx_messageInfo_Event.DiscardUnknown(m)
  138. }
  139. var xxx_messageInfo_Event proto.InternalMessageInfo
  140. func init() {
  141. proto.RegisterEnum("mvccpb.Event_EventType", Event_EventType_name, Event_EventType_value)
  142. proto.RegisterType((*KeyValue)(nil), "mvccpb.KeyValue")
  143. proto.RegisterType((*Event)(nil), "mvccpb.Event")
  144. }
  145. func init() { proto.RegisterFile("kv.proto", fileDescriptor_2216fe83c9c12408) }
  146. var fileDescriptor_2216fe83c9c12408 = []byte{
  147. // 303 bytes of a gzipped FileDescriptorProto
  148. 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x41, 0x4e, 0xc2, 0x40,
  149. 0x14, 0x86, 0x3b, 0x14, 0x0a, 0x3e, 0x08, 0x36, 0x13, 0x12, 0x27, 0x2e, 0x26, 0x95, 0x8d, 0x18,
  150. 0x13, 0x4c, 0xf0, 0x06, 0xc6, 0xae, 0x70, 0x61, 0x1a, 0x74, 0x4b, 0x4a, 0x79, 0x21, 0xa4, 0x94,
  151. 0x69, 0x4a, 0x9d, 0xa4, 0x37, 0x71, 0xef, 0xde, 0x73, 0xb0, 0xe4, 0x08, 0x52, 0x2f, 0x62, 0xfa,
  152. 0xc6, 0xe2, 0xc6, 0xcd, 0xe4, 0xfd, 0xff, 0xff, 0x65, 0xe6, 0x7f, 0x03, 0x9d, 0x58, 0x8f, 0xd3,
  153. 0x4c, 0xe5, 0x8a, 0x3b, 0x89, 0x8e, 0xa2, 0x74, 0x71, 0x39, 0x58, 0xa9, 0x95, 0x22, 0xeb, 0xae,
  154. 0x9a, 0x4c, 0x3a, 0xfc, 0x64, 0xd0, 0x99, 0x62, 0xf1, 0x1a, 0x6e, 0xde, 0x90, 0xbb, 0x60, 0xc7,
  155. 0x58, 0x08, 0xe6, 0xb1, 0x51, 0x2f, 0xa8, 0x46, 0x7e, 0x0d, 0xe7, 0x51, 0x86, 0x61, 0x8e, 0xf3,
  156. 0x0c, 0xf5, 0x7a, 0xb7, 0x56, 0x5b, 0xd1, 0xf0, 0xd8, 0xc8, 0x0e, 0xfa, 0xc6, 0x0e, 0x7e, 0x5d,
  157. 0x7e, 0x05, 0xbd, 0x44, 0x2d, 0xff, 0x28, 0x9b, 0xa8, 0x6e, 0xa2, 0x96, 0x27, 0x44, 0x40, 0x5b,
  158. 0x63, 0x46, 0x69, 0x93, 0xd2, 0x5a, 0xf2, 0x01, 0xb4, 0x74, 0x55, 0x40, 0xb4, 0xe8, 0x65, 0x23,
  159. 0x2a, 0x77, 0x83, 0xe1, 0x0e, 0x85, 0x43, 0xb4, 0x11, 0xc3, 0x0f, 0x06, 0x2d, 0x5f, 0xe3, 0x36,
  160. 0xe7, 0xb7, 0xd0, 0xcc, 0x8b, 0x14, 0xa9, 0x6e, 0x7f, 0x72, 0x31, 0x36, 0x7b, 0x8e, 0x29, 0x34,
  161. 0xe7, 0xac, 0x48, 0x31, 0x20, 0x88, 0x7b, 0xd0, 0x88, 0x35, 0x75, 0xef, 0x4e, 0xdc, 0x1a, 0xad,
  162. 0x17, 0x0f, 0x1a, 0xb1, 0xe6, 0x37, 0xd0, 0x4e, 0x33, 0xd4, 0xf3, 0x58, 0x53, 0xf9, 0xff, 0x30,
  163. 0xa7, 0x02, 0xa6, 0x7a, 0xe8, 0xc1, 0xd9, 0xe9, 0x7e, 0xde, 0x06, 0xfb, 0xf9, 0x65, 0xe6, 0x5a,
  164. 0x1c, 0xc0, 0x79, 0xf4, 0x9f, 0xfc, 0x99, 0xef, 0xb2, 0x07, 0xb1, 0x3f, 0x4a, 0xeb, 0x70, 0x94,
  165. 0xd6, 0xbe, 0x94, 0xec, 0x50, 0x4a, 0xf6, 0x55, 0x4a, 0xf6, 0xfe, 0x2d, 0xad, 0x85, 0x43, 0xff,
  166. 0x7e, 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0xb5, 0x45, 0x92, 0x5d, 0xa1, 0x01, 0x00, 0x00,
  167. }
  168. func (m *KeyValue) Marshal() (dAtA []byte, err error) {
  169. size := m.Size()
  170. dAtA = make([]byte, size)
  171. n, err := m.MarshalToSizedBuffer(dAtA[:size])
  172. if err != nil {
  173. return nil, err
  174. }
  175. return dAtA[:n], nil
  176. }
  177. func (m *KeyValue) MarshalTo(dAtA []byte) (int, error) {
  178. size := m.Size()
  179. return m.MarshalToSizedBuffer(dAtA[:size])
  180. }
  181. func (m *KeyValue) MarshalToSizedBuffer(dAtA []byte) (int, error) {
  182. i := len(dAtA)
  183. _ = i
  184. var l int
  185. _ = l
  186. if m.XXX_unrecognized != nil {
  187. i -= len(m.XXX_unrecognized)
  188. copy(dAtA[i:], m.XXX_unrecognized)
  189. }
  190. if m.Lease != 0 {
  191. i = encodeVarintKv(dAtA, i, uint64(m.Lease))
  192. i--
  193. dAtA[i] = 0x30
  194. }
  195. if len(m.Value) > 0 {
  196. i -= len(m.Value)
  197. copy(dAtA[i:], m.Value)
  198. i = encodeVarintKv(dAtA, i, uint64(len(m.Value)))
  199. i--
  200. dAtA[i] = 0x2a
  201. }
  202. if m.Version != 0 {
  203. i = encodeVarintKv(dAtA, i, uint64(m.Version))
  204. i--
  205. dAtA[i] = 0x20
  206. }
  207. if m.ModRevision != 0 {
  208. i = encodeVarintKv(dAtA, i, uint64(m.ModRevision))
  209. i--
  210. dAtA[i] = 0x18
  211. }
  212. if m.CreateRevision != 0 {
  213. i = encodeVarintKv(dAtA, i, uint64(m.CreateRevision))
  214. i--
  215. dAtA[i] = 0x10
  216. }
  217. if len(m.Key) > 0 {
  218. i -= len(m.Key)
  219. copy(dAtA[i:], m.Key)
  220. i = encodeVarintKv(dAtA, i, uint64(len(m.Key)))
  221. i--
  222. dAtA[i] = 0xa
  223. }
  224. return len(dAtA) - i, nil
  225. }
  226. func (m *Event) Marshal() (dAtA []byte, err error) {
  227. size := m.Size()
  228. dAtA = make([]byte, size)
  229. n, err := m.MarshalToSizedBuffer(dAtA[:size])
  230. if err != nil {
  231. return nil, err
  232. }
  233. return dAtA[:n], nil
  234. }
  235. func (m *Event) MarshalTo(dAtA []byte) (int, error) {
  236. size := m.Size()
  237. return m.MarshalToSizedBuffer(dAtA[:size])
  238. }
  239. func (m *Event) MarshalToSizedBuffer(dAtA []byte) (int, error) {
  240. i := len(dAtA)
  241. _ = i
  242. var l int
  243. _ = l
  244. if m.XXX_unrecognized != nil {
  245. i -= len(m.XXX_unrecognized)
  246. copy(dAtA[i:], m.XXX_unrecognized)
  247. }
  248. if m.PrevKv != nil {
  249. {
  250. size, err := m.PrevKv.MarshalToSizedBuffer(dAtA[:i])
  251. if err != nil {
  252. return 0, err
  253. }
  254. i -= size
  255. i = encodeVarintKv(dAtA, i, uint64(size))
  256. }
  257. i--
  258. dAtA[i] = 0x1a
  259. }
  260. if m.Kv != nil {
  261. {
  262. size, err := m.Kv.MarshalToSizedBuffer(dAtA[:i])
  263. if err != nil {
  264. return 0, err
  265. }
  266. i -= size
  267. i = encodeVarintKv(dAtA, i, uint64(size))
  268. }
  269. i--
  270. dAtA[i] = 0x12
  271. }
  272. if m.Type != 0 {
  273. i = encodeVarintKv(dAtA, i, uint64(m.Type))
  274. i--
  275. dAtA[i] = 0x8
  276. }
  277. return len(dAtA) - i, nil
  278. }
  279. func encodeVarintKv(dAtA []byte, offset int, v uint64) int {
  280. offset -= sovKv(v)
  281. base := offset
  282. for v >= 1<<7 {
  283. dAtA[offset] = uint8(v&0x7f | 0x80)
  284. v >>= 7
  285. offset++
  286. }
  287. dAtA[offset] = uint8(v)
  288. return base
  289. }
  290. func (m *KeyValue) Size() (n int) {
  291. if m == nil {
  292. return 0
  293. }
  294. var l int
  295. _ = l
  296. l = len(m.Key)
  297. if l > 0 {
  298. n += 1 + l + sovKv(uint64(l))
  299. }
  300. if m.CreateRevision != 0 {
  301. n += 1 + sovKv(uint64(m.CreateRevision))
  302. }
  303. if m.ModRevision != 0 {
  304. n += 1 + sovKv(uint64(m.ModRevision))
  305. }
  306. if m.Version != 0 {
  307. n += 1 + sovKv(uint64(m.Version))
  308. }
  309. l = len(m.Value)
  310. if l > 0 {
  311. n += 1 + l + sovKv(uint64(l))
  312. }
  313. if m.Lease != 0 {
  314. n += 1 + sovKv(uint64(m.Lease))
  315. }
  316. if m.XXX_unrecognized != nil {
  317. n += len(m.XXX_unrecognized)
  318. }
  319. return n
  320. }
  321. func (m *Event) Size() (n int) {
  322. if m == nil {
  323. return 0
  324. }
  325. var l int
  326. _ = l
  327. if m.Type != 0 {
  328. n += 1 + sovKv(uint64(m.Type))
  329. }
  330. if m.Kv != nil {
  331. l = m.Kv.Size()
  332. n += 1 + l + sovKv(uint64(l))
  333. }
  334. if m.PrevKv != nil {
  335. l = m.PrevKv.Size()
  336. n += 1 + l + sovKv(uint64(l))
  337. }
  338. if m.XXX_unrecognized != nil {
  339. n += len(m.XXX_unrecognized)
  340. }
  341. return n
  342. }
  343. func sovKv(x uint64) (n int) {
  344. return (math_bits.Len64(x|1) + 6) / 7
  345. }
  346. func sozKv(x uint64) (n int) {
  347. return sovKv(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  348. }
  349. func (m *KeyValue) Unmarshal(dAtA []byte) error {
  350. l := len(dAtA)
  351. iNdEx := 0
  352. for iNdEx < l {
  353. preIndex := iNdEx
  354. var wire uint64
  355. for shift := uint(0); ; shift += 7 {
  356. if shift >= 64 {
  357. return ErrIntOverflowKv
  358. }
  359. if iNdEx >= l {
  360. return io.ErrUnexpectedEOF
  361. }
  362. b := dAtA[iNdEx]
  363. iNdEx++
  364. wire |= uint64(b&0x7F) << shift
  365. if b < 0x80 {
  366. break
  367. }
  368. }
  369. fieldNum := int32(wire >> 3)
  370. wireType := int(wire & 0x7)
  371. if wireType == 4 {
  372. return fmt.Errorf("proto: KeyValue: wiretype end group for non-group")
  373. }
  374. if fieldNum <= 0 {
  375. return fmt.Errorf("proto: KeyValue: illegal tag %d (wire type %d)", fieldNum, wire)
  376. }
  377. switch fieldNum {
  378. case 1:
  379. if wireType != 2 {
  380. return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
  381. }
  382. var byteLen int
  383. for shift := uint(0); ; shift += 7 {
  384. if shift >= 64 {
  385. return ErrIntOverflowKv
  386. }
  387. if iNdEx >= l {
  388. return io.ErrUnexpectedEOF
  389. }
  390. b := dAtA[iNdEx]
  391. iNdEx++
  392. byteLen |= int(b&0x7F) << shift
  393. if b < 0x80 {
  394. break
  395. }
  396. }
  397. if byteLen < 0 {
  398. return ErrInvalidLengthKv
  399. }
  400. postIndex := iNdEx + byteLen
  401. if postIndex < 0 {
  402. return ErrInvalidLengthKv
  403. }
  404. if postIndex > l {
  405. return io.ErrUnexpectedEOF
  406. }
  407. m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...)
  408. if m.Key == nil {
  409. m.Key = []byte{}
  410. }
  411. iNdEx = postIndex
  412. case 2:
  413. if wireType != 0 {
  414. return fmt.Errorf("proto: wrong wireType = %d for field CreateRevision", wireType)
  415. }
  416. m.CreateRevision = 0
  417. for shift := uint(0); ; shift += 7 {
  418. if shift >= 64 {
  419. return ErrIntOverflowKv
  420. }
  421. if iNdEx >= l {
  422. return io.ErrUnexpectedEOF
  423. }
  424. b := dAtA[iNdEx]
  425. iNdEx++
  426. m.CreateRevision |= int64(b&0x7F) << shift
  427. if b < 0x80 {
  428. break
  429. }
  430. }
  431. case 3:
  432. if wireType != 0 {
  433. return fmt.Errorf("proto: wrong wireType = %d for field ModRevision", wireType)
  434. }
  435. m.ModRevision = 0
  436. for shift := uint(0); ; shift += 7 {
  437. if shift >= 64 {
  438. return ErrIntOverflowKv
  439. }
  440. if iNdEx >= l {
  441. return io.ErrUnexpectedEOF
  442. }
  443. b := dAtA[iNdEx]
  444. iNdEx++
  445. m.ModRevision |= int64(b&0x7F) << shift
  446. if b < 0x80 {
  447. break
  448. }
  449. }
  450. case 4:
  451. if wireType != 0 {
  452. return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType)
  453. }
  454. m.Version = 0
  455. for shift := uint(0); ; shift += 7 {
  456. if shift >= 64 {
  457. return ErrIntOverflowKv
  458. }
  459. if iNdEx >= l {
  460. return io.ErrUnexpectedEOF
  461. }
  462. b := dAtA[iNdEx]
  463. iNdEx++
  464. m.Version |= int64(b&0x7F) << shift
  465. if b < 0x80 {
  466. break
  467. }
  468. }
  469. case 5:
  470. if wireType != 2 {
  471. return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
  472. }
  473. var byteLen int
  474. for shift := uint(0); ; shift += 7 {
  475. if shift >= 64 {
  476. return ErrIntOverflowKv
  477. }
  478. if iNdEx >= l {
  479. return io.ErrUnexpectedEOF
  480. }
  481. b := dAtA[iNdEx]
  482. iNdEx++
  483. byteLen |= int(b&0x7F) << shift
  484. if b < 0x80 {
  485. break
  486. }
  487. }
  488. if byteLen < 0 {
  489. return ErrInvalidLengthKv
  490. }
  491. postIndex := iNdEx + byteLen
  492. if postIndex < 0 {
  493. return ErrInvalidLengthKv
  494. }
  495. if postIndex > l {
  496. return io.ErrUnexpectedEOF
  497. }
  498. m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...)
  499. if m.Value == nil {
  500. m.Value = []byte{}
  501. }
  502. iNdEx = postIndex
  503. case 6:
  504. if wireType != 0 {
  505. return fmt.Errorf("proto: wrong wireType = %d for field Lease", wireType)
  506. }
  507. m.Lease = 0
  508. for shift := uint(0); ; shift += 7 {
  509. if shift >= 64 {
  510. return ErrIntOverflowKv
  511. }
  512. if iNdEx >= l {
  513. return io.ErrUnexpectedEOF
  514. }
  515. b := dAtA[iNdEx]
  516. iNdEx++
  517. m.Lease |= int64(b&0x7F) << shift
  518. if b < 0x80 {
  519. break
  520. }
  521. }
  522. default:
  523. iNdEx = preIndex
  524. skippy, err := skipKv(dAtA[iNdEx:])
  525. if err != nil {
  526. return err
  527. }
  528. if skippy < 0 {
  529. return ErrInvalidLengthKv
  530. }
  531. if (iNdEx + skippy) < 0 {
  532. return ErrInvalidLengthKv
  533. }
  534. if (iNdEx + skippy) > l {
  535. return io.ErrUnexpectedEOF
  536. }
  537. m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
  538. iNdEx += skippy
  539. }
  540. }
  541. if iNdEx > l {
  542. return io.ErrUnexpectedEOF
  543. }
  544. return nil
  545. }
  546. func (m *Event) Unmarshal(dAtA []byte) error {
  547. l := len(dAtA)
  548. iNdEx := 0
  549. for iNdEx < l {
  550. preIndex := iNdEx
  551. var wire uint64
  552. for shift := uint(0); ; shift += 7 {
  553. if shift >= 64 {
  554. return ErrIntOverflowKv
  555. }
  556. if iNdEx >= l {
  557. return io.ErrUnexpectedEOF
  558. }
  559. b := dAtA[iNdEx]
  560. iNdEx++
  561. wire |= uint64(b&0x7F) << shift
  562. if b < 0x80 {
  563. break
  564. }
  565. }
  566. fieldNum := int32(wire >> 3)
  567. wireType := int(wire & 0x7)
  568. if wireType == 4 {
  569. return fmt.Errorf("proto: Event: wiretype end group for non-group")
  570. }
  571. if fieldNum <= 0 {
  572. return fmt.Errorf("proto: Event: illegal tag %d (wire type %d)", fieldNum, wire)
  573. }
  574. switch fieldNum {
  575. case 1:
  576. if wireType != 0 {
  577. return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
  578. }
  579. m.Type = 0
  580. for shift := uint(0); ; shift += 7 {
  581. if shift >= 64 {
  582. return ErrIntOverflowKv
  583. }
  584. if iNdEx >= l {
  585. return io.ErrUnexpectedEOF
  586. }
  587. b := dAtA[iNdEx]
  588. iNdEx++
  589. m.Type |= Event_EventType(b&0x7F) << shift
  590. if b < 0x80 {
  591. break
  592. }
  593. }
  594. case 2:
  595. if wireType != 2 {
  596. return fmt.Errorf("proto: wrong wireType = %d for field Kv", wireType)
  597. }
  598. var msglen int
  599. for shift := uint(0); ; shift += 7 {
  600. if shift >= 64 {
  601. return ErrIntOverflowKv
  602. }
  603. if iNdEx >= l {
  604. return io.ErrUnexpectedEOF
  605. }
  606. b := dAtA[iNdEx]
  607. iNdEx++
  608. msglen |= int(b&0x7F) << shift
  609. if b < 0x80 {
  610. break
  611. }
  612. }
  613. if msglen < 0 {
  614. return ErrInvalidLengthKv
  615. }
  616. postIndex := iNdEx + msglen
  617. if postIndex < 0 {
  618. return ErrInvalidLengthKv
  619. }
  620. if postIndex > l {
  621. return io.ErrUnexpectedEOF
  622. }
  623. if m.Kv == nil {
  624. m.Kv = &KeyValue{}
  625. }
  626. if err := m.Kv.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  627. return err
  628. }
  629. iNdEx = postIndex
  630. case 3:
  631. if wireType != 2 {
  632. return fmt.Errorf("proto: wrong wireType = %d for field PrevKv", wireType)
  633. }
  634. var msglen int
  635. for shift := uint(0); ; shift += 7 {
  636. if shift >= 64 {
  637. return ErrIntOverflowKv
  638. }
  639. if iNdEx >= l {
  640. return io.ErrUnexpectedEOF
  641. }
  642. b := dAtA[iNdEx]
  643. iNdEx++
  644. msglen |= int(b&0x7F) << shift
  645. if b < 0x80 {
  646. break
  647. }
  648. }
  649. if msglen < 0 {
  650. return ErrInvalidLengthKv
  651. }
  652. postIndex := iNdEx + msglen
  653. if postIndex < 0 {
  654. return ErrInvalidLengthKv
  655. }
  656. if postIndex > l {
  657. return io.ErrUnexpectedEOF
  658. }
  659. if m.PrevKv == nil {
  660. m.PrevKv = &KeyValue{}
  661. }
  662. if err := m.PrevKv.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  663. return err
  664. }
  665. iNdEx = postIndex
  666. default:
  667. iNdEx = preIndex
  668. skippy, err := skipKv(dAtA[iNdEx:])
  669. if err != nil {
  670. return err
  671. }
  672. if skippy < 0 {
  673. return ErrInvalidLengthKv
  674. }
  675. if (iNdEx + skippy) < 0 {
  676. return ErrInvalidLengthKv
  677. }
  678. if (iNdEx + skippy) > l {
  679. return io.ErrUnexpectedEOF
  680. }
  681. m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
  682. iNdEx += skippy
  683. }
  684. }
  685. if iNdEx > l {
  686. return io.ErrUnexpectedEOF
  687. }
  688. return nil
  689. }
  690. func skipKv(dAtA []byte) (n int, err error) {
  691. l := len(dAtA)
  692. iNdEx := 0
  693. for iNdEx < l {
  694. var wire uint64
  695. for shift := uint(0); ; shift += 7 {
  696. if shift >= 64 {
  697. return 0, ErrIntOverflowKv
  698. }
  699. if iNdEx >= l {
  700. return 0, io.ErrUnexpectedEOF
  701. }
  702. b := dAtA[iNdEx]
  703. iNdEx++
  704. wire |= (uint64(b) & 0x7F) << shift
  705. if b < 0x80 {
  706. break
  707. }
  708. }
  709. wireType := int(wire & 0x7)
  710. switch wireType {
  711. case 0:
  712. for shift := uint(0); ; shift += 7 {
  713. if shift >= 64 {
  714. return 0, ErrIntOverflowKv
  715. }
  716. if iNdEx >= l {
  717. return 0, io.ErrUnexpectedEOF
  718. }
  719. iNdEx++
  720. if dAtA[iNdEx-1] < 0x80 {
  721. break
  722. }
  723. }
  724. return iNdEx, nil
  725. case 1:
  726. iNdEx += 8
  727. return iNdEx, nil
  728. case 2:
  729. var length int
  730. for shift := uint(0); ; shift += 7 {
  731. if shift >= 64 {
  732. return 0, ErrIntOverflowKv
  733. }
  734. if iNdEx >= l {
  735. return 0, io.ErrUnexpectedEOF
  736. }
  737. b := dAtA[iNdEx]
  738. iNdEx++
  739. length |= (int(b) & 0x7F) << shift
  740. if b < 0x80 {
  741. break
  742. }
  743. }
  744. if length < 0 {
  745. return 0, ErrInvalidLengthKv
  746. }
  747. iNdEx += length
  748. if iNdEx < 0 {
  749. return 0, ErrInvalidLengthKv
  750. }
  751. return iNdEx, nil
  752. case 3:
  753. for {
  754. var innerWire uint64
  755. var start int = iNdEx
  756. for shift := uint(0); ; shift += 7 {
  757. if shift >= 64 {
  758. return 0, ErrIntOverflowKv
  759. }
  760. if iNdEx >= l {
  761. return 0, io.ErrUnexpectedEOF
  762. }
  763. b := dAtA[iNdEx]
  764. iNdEx++
  765. innerWire |= (uint64(b) & 0x7F) << shift
  766. if b < 0x80 {
  767. break
  768. }
  769. }
  770. innerWireType := int(innerWire & 0x7)
  771. if innerWireType == 4 {
  772. break
  773. }
  774. next, err := skipKv(dAtA[start:])
  775. if err != nil {
  776. return 0, err
  777. }
  778. iNdEx = start + next
  779. if iNdEx < 0 {
  780. return 0, ErrInvalidLengthKv
  781. }
  782. }
  783. return iNdEx, nil
  784. case 4:
  785. return iNdEx, nil
  786. case 5:
  787. iNdEx += 4
  788. return iNdEx, nil
  789. default:
  790. return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
  791. }
  792. }
  793. panic("unreachable")
  794. }
  795. var (
  796. ErrInvalidLengthKv = fmt.Errorf("proto: negative length found during unmarshaling")
  797. ErrIntOverflowKv = fmt.Errorf("proto: integer overflow")
  798. )