record.pb.go 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. // Code generated by protoc-gen-gogo.
  2. // source: record.proto
  3. // DO NOT EDIT!
  4. /*
  5. Package walpb is a generated protocol buffer package.
  6. It is generated from these files:
  7. record.proto
  8. It has these top-level messages:
  9. Record
  10. Snapshot
  11. */
  12. package walpb
  13. import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
  14. import math "math"
  15. // discarding unused import gogoproto "github.com/coreos/etcd/Godeps/_workspace/src/gogoproto"
  16. import io "io"
  17. import fmt "fmt"
  18. // Reference imports to suppress errors if they are not otherwise used.
  19. var _ = proto.Marshal
  20. var _ = math.Inf
  21. type Record struct {
  22. Type int64 `protobuf:"varint,1,opt,name=type" json:"type"`
  23. Crc uint32 `protobuf:"varint,2,opt,name=crc" json:"crc"`
  24. Data []byte `protobuf:"bytes,3,opt,name=data" json:"data,omitempty"`
  25. XXX_unrecognized []byte `json:"-"`
  26. }
  27. func (m *Record) Reset() { *m = Record{} }
  28. func (m *Record) String() string { return proto.CompactTextString(m) }
  29. func (*Record) ProtoMessage() {}
  30. type Snapshot struct {
  31. Index uint64 `protobuf:"varint,1,opt,name=index" json:"index"`
  32. Term uint64 `protobuf:"varint,2,opt,name=term" json:"term"`
  33. XXX_unrecognized []byte `json:"-"`
  34. }
  35. func (m *Snapshot) Reset() { *m = Snapshot{} }
  36. func (m *Snapshot) String() string { return proto.CompactTextString(m) }
  37. func (*Snapshot) ProtoMessage() {}
  38. func (m *Record) Marshal() (data []byte, err error) {
  39. size := m.Size()
  40. data = make([]byte, size)
  41. n, err := m.MarshalTo(data)
  42. if err != nil {
  43. return nil, err
  44. }
  45. return data[:n], nil
  46. }
  47. func (m *Record) MarshalTo(data []byte) (int, error) {
  48. var i int
  49. _ = i
  50. var l int
  51. _ = l
  52. data[i] = 0x8
  53. i++
  54. i = encodeVarintRecord(data, i, uint64(m.Type))
  55. data[i] = 0x10
  56. i++
  57. i = encodeVarintRecord(data, i, uint64(m.Crc))
  58. if m.Data != nil {
  59. data[i] = 0x1a
  60. i++
  61. i = encodeVarintRecord(data, i, uint64(len(m.Data)))
  62. i += copy(data[i:], m.Data)
  63. }
  64. if m.XXX_unrecognized != nil {
  65. i += copy(data[i:], m.XXX_unrecognized)
  66. }
  67. return i, nil
  68. }
  69. func (m *Snapshot) Marshal() (data []byte, err error) {
  70. size := m.Size()
  71. data = make([]byte, size)
  72. n, err := m.MarshalTo(data)
  73. if err != nil {
  74. return nil, err
  75. }
  76. return data[:n], nil
  77. }
  78. func (m *Snapshot) MarshalTo(data []byte) (int, error) {
  79. var i int
  80. _ = i
  81. var l int
  82. _ = l
  83. data[i] = 0x8
  84. i++
  85. i = encodeVarintRecord(data, i, uint64(m.Index))
  86. data[i] = 0x10
  87. i++
  88. i = encodeVarintRecord(data, i, uint64(m.Term))
  89. if m.XXX_unrecognized != nil {
  90. i += copy(data[i:], m.XXX_unrecognized)
  91. }
  92. return i, nil
  93. }
  94. func encodeFixed64Record(data []byte, offset int, v uint64) int {
  95. data[offset] = uint8(v)
  96. data[offset+1] = uint8(v >> 8)
  97. data[offset+2] = uint8(v >> 16)
  98. data[offset+3] = uint8(v >> 24)
  99. data[offset+4] = uint8(v >> 32)
  100. data[offset+5] = uint8(v >> 40)
  101. data[offset+6] = uint8(v >> 48)
  102. data[offset+7] = uint8(v >> 56)
  103. return offset + 8
  104. }
  105. func encodeFixed32Record(data []byte, offset int, v uint32) int {
  106. data[offset] = uint8(v)
  107. data[offset+1] = uint8(v >> 8)
  108. data[offset+2] = uint8(v >> 16)
  109. data[offset+3] = uint8(v >> 24)
  110. return offset + 4
  111. }
  112. func encodeVarintRecord(data []byte, offset int, v uint64) int {
  113. for v >= 1<<7 {
  114. data[offset] = uint8(v&0x7f | 0x80)
  115. v >>= 7
  116. offset++
  117. }
  118. data[offset] = uint8(v)
  119. return offset + 1
  120. }
  121. func (m *Record) Size() (n int) {
  122. var l int
  123. _ = l
  124. n += 1 + sovRecord(uint64(m.Type))
  125. n += 1 + sovRecord(uint64(m.Crc))
  126. if m.Data != nil {
  127. l = len(m.Data)
  128. n += 1 + l + sovRecord(uint64(l))
  129. }
  130. if m.XXX_unrecognized != nil {
  131. n += len(m.XXX_unrecognized)
  132. }
  133. return n
  134. }
  135. func (m *Snapshot) Size() (n int) {
  136. var l int
  137. _ = l
  138. n += 1 + sovRecord(uint64(m.Index))
  139. n += 1 + sovRecord(uint64(m.Term))
  140. if m.XXX_unrecognized != nil {
  141. n += len(m.XXX_unrecognized)
  142. }
  143. return n
  144. }
  145. func sovRecord(x uint64) (n int) {
  146. for {
  147. n++
  148. x >>= 7
  149. if x == 0 {
  150. break
  151. }
  152. }
  153. return n
  154. }
  155. func sozRecord(x uint64) (n int) {
  156. return sovRecord(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  157. }
  158. func (m *Record) Unmarshal(data []byte) error {
  159. l := len(data)
  160. iNdEx := 0
  161. for iNdEx < l {
  162. var wire uint64
  163. for shift := uint(0); ; shift += 7 {
  164. if iNdEx >= l {
  165. return io.ErrUnexpectedEOF
  166. }
  167. b := data[iNdEx]
  168. iNdEx++
  169. wire |= (uint64(b) & 0x7F) << shift
  170. if b < 0x80 {
  171. break
  172. }
  173. }
  174. fieldNum := int32(wire >> 3)
  175. wireType := int(wire & 0x7)
  176. switch fieldNum {
  177. case 1:
  178. if wireType != 0 {
  179. return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
  180. }
  181. m.Type = 0
  182. for shift := uint(0); ; shift += 7 {
  183. if iNdEx >= l {
  184. return io.ErrUnexpectedEOF
  185. }
  186. b := data[iNdEx]
  187. iNdEx++
  188. m.Type |= (int64(b) & 0x7F) << shift
  189. if b < 0x80 {
  190. break
  191. }
  192. }
  193. case 2:
  194. if wireType != 0 {
  195. return fmt.Errorf("proto: wrong wireType = %d for field Crc", wireType)
  196. }
  197. m.Crc = 0
  198. for shift := uint(0); ; shift += 7 {
  199. if iNdEx >= l {
  200. return io.ErrUnexpectedEOF
  201. }
  202. b := data[iNdEx]
  203. iNdEx++
  204. m.Crc |= (uint32(b) & 0x7F) << shift
  205. if b < 0x80 {
  206. break
  207. }
  208. }
  209. case 3:
  210. if wireType != 2 {
  211. return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
  212. }
  213. var byteLen int
  214. for shift := uint(0); ; shift += 7 {
  215. if iNdEx >= l {
  216. return io.ErrUnexpectedEOF
  217. }
  218. b := data[iNdEx]
  219. iNdEx++
  220. byteLen |= (int(b) & 0x7F) << shift
  221. if b < 0x80 {
  222. break
  223. }
  224. }
  225. if byteLen < 0 {
  226. return ErrInvalidLengthRecord
  227. }
  228. postIndex := iNdEx + byteLen
  229. if postIndex > l {
  230. return io.ErrUnexpectedEOF
  231. }
  232. m.Data = append([]byte{}, data[iNdEx:postIndex]...)
  233. iNdEx = postIndex
  234. default:
  235. var sizeOfWire int
  236. for {
  237. sizeOfWire++
  238. wire >>= 7
  239. if wire == 0 {
  240. break
  241. }
  242. }
  243. iNdEx -= sizeOfWire
  244. skippy, err := skipRecord(data[iNdEx:])
  245. if err != nil {
  246. return err
  247. }
  248. if skippy < 0 {
  249. return ErrInvalidLengthRecord
  250. }
  251. if (iNdEx + skippy) > l {
  252. return io.ErrUnexpectedEOF
  253. }
  254. m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...)
  255. iNdEx += skippy
  256. }
  257. }
  258. return nil
  259. }
  260. func (m *Snapshot) Unmarshal(data []byte) error {
  261. l := len(data)
  262. iNdEx := 0
  263. for iNdEx < l {
  264. var wire uint64
  265. for shift := uint(0); ; shift += 7 {
  266. if iNdEx >= l {
  267. return io.ErrUnexpectedEOF
  268. }
  269. b := data[iNdEx]
  270. iNdEx++
  271. wire |= (uint64(b) & 0x7F) << shift
  272. if b < 0x80 {
  273. break
  274. }
  275. }
  276. fieldNum := int32(wire >> 3)
  277. wireType := int(wire & 0x7)
  278. switch fieldNum {
  279. case 1:
  280. if wireType != 0 {
  281. return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
  282. }
  283. m.Index = 0
  284. for shift := uint(0); ; shift += 7 {
  285. if iNdEx >= l {
  286. return io.ErrUnexpectedEOF
  287. }
  288. b := data[iNdEx]
  289. iNdEx++
  290. m.Index |= (uint64(b) & 0x7F) << shift
  291. if b < 0x80 {
  292. break
  293. }
  294. }
  295. case 2:
  296. if wireType != 0 {
  297. return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType)
  298. }
  299. m.Term = 0
  300. for shift := uint(0); ; shift += 7 {
  301. if iNdEx >= l {
  302. return io.ErrUnexpectedEOF
  303. }
  304. b := data[iNdEx]
  305. iNdEx++
  306. m.Term |= (uint64(b) & 0x7F) << shift
  307. if b < 0x80 {
  308. break
  309. }
  310. }
  311. default:
  312. var sizeOfWire int
  313. for {
  314. sizeOfWire++
  315. wire >>= 7
  316. if wire == 0 {
  317. break
  318. }
  319. }
  320. iNdEx -= sizeOfWire
  321. skippy, err := skipRecord(data[iNdEx:])
  322. if err != nil {
  323. return err
  324. }
  325. if skippy < 0 {
  326. return ErrInvalidLengthRecord
  327. }
  328. if (iNdEx + skippy) > l {
  329. return io.ErrUnexpectedEOF
  330. }
  331. m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...)
  332. iNdEx += skippy
  333. }
  334. }
  335. return nil
  336. }
  337. func skipRecord(data []byte) (n int, err error) {
  338. l := len(data)
  339. iNdEx := 0
  340. for iNdEx < l {
  341. var wire uint64
  342. for shift := uint(0); ; shift += 7 {
  343. if iNdEx >= l {
  344. return 0, io.ErrUnexpectedEOF
  345. }
  346. b := data[iNdEx]
  347. iNdEx++
  348. wire |= (uint64(b) & 0x7F) << shift
  349. if b < 0x80 {
  350. break
  351. }
  352. }
  353. wireType := int(wire & 0x7)
  354. switch wireType {
  355. case 0:
  356. for {
  357. if iNdEx >= l {
  358. return 0, io.ErrUnexpectedEOF
  359. }
  360. iNdEx++
  361. if data[iNdEx-1] < 0x80 {
  362. break
  363. }
  364. }
  365. return iNdEx, nil
  366. case 1:
  367. iNdEx += 8
  368. return iNdEx, nil
  369. case 2:
  370. var length int
  371. for shift := uint(0); ; shift += 7 {
  372. if iNdEx >= l {
  373. return 0, io.ErrUnexpectedEOF
  374. }
  375. b := data[iNdEx]
  376. iNdEx++
  377. length |= (int(b) & 0x7F) << shift
  378. if b < 0x80 {
  379. break
  380. }
  381. }
  382. iNdEx += length
  383. if length < 0 {
  384. return 0, ErrInvalidLengthRecord
  385. }
  386. return iNdEx, nil
  387. case 3:
  388. for {
  389. var innerWire uint64
  390. var start int = iNdEx
  391. for shift := uint(0); ; shift += 7 {
  392. if iNdEx >= l {
  393. return 0, io.ErrUnexpectedEOF
  394. }
  395. b := data[iNdEx]
  396. iNdEx++
  397. innerWire |= (uint64(b) & 0x7F) << shift
  398. if b < 0x80 {
  399. break
  400. }
  401. }
  402. innerWireType := int(innerWire & 0x7)
  403. if innerWireType == 4 {
  404. break
  405. }
  406. next, err := skipRecord(data[start:])
  407. if err != nil {
  408. return 0, err
  409. }
  410. iNdEx = start + next
  411. }
  412. return iNdEx, nil
  413. case 4:
  414. return iNdEx, nil
  415. case 5:
  416. iNdEx += 4
  417. return iNdEx, nil
  418. default:
  419. return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
  420. }
  421. }
  422. panic("unreachable")
  423. }
  424. var (
  425. ErrInvalidLengthRecord = fmt.Errorf("proto: negative length found during unmarshaling")
  426. )