record.pb.go 10 KB

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