record.pb.go 8.8 KB

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