snap.pb.go 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. // Code generated by protoc-gen-gogo.
  2. // source: snap.proto
  3. // DO NOT EDIT!
  4. /*
  5. Package snappb is a generated protocol buffer package.
  6. It is generated from these files:
  7. snap.proto
  8. It has these top-level messages:
  9. Snapshot
  10. */
  11. package snappb
  12. import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
  13. import math "math"
  14. // discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto/gogo.pb"
  15. import io "io"
  16. import fmt "fmt"
  17. // Reference imports to suppress errors if they are not otherwise used.
  18. var _ = proto.Marshal
  19. var _ = math.Inf
  20. type Snapshot struct {
  21. Crc uint32 `protobuf:"varint,1,opt,name=crc" json:"crc"`
  22. Data []byte `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"`
  23. XXX_unrecognized []byte `json:"-"`
  24. }
  25. func (m *Snapshot) Reset() { *m = Snapshot{} }
  26. func (m *Snapshot) String() string { return proto.CompactTextString(m) }
  27. func (*Snapshot) ProtoMessage() {}
  28. func init() {
  29. }
  30. func (m *Snapshot) Unmarshal(data []byte) error {
  31. l := len(data)
  32. iNdEx := 0
  33. for iNdEx < l {
  34. var wire uint64
  35. for shift := uint(0); ; shift += 7 {
  36. if iNdEx >= l {
  37. return io.ErrUnexpectedEOF
  38. }
  39. b := data[iNdEx]
  40. iNdEx++
  41. wire |= (uint64(b) & 0x7F) << shift
  42. if b < 0x80 {
  43. break
  44. }
  45. }
  46. fieldNum := int32(wire >> 3)
  47. wireType := int(wire & 0x7)
  48. switch fieldNum {
  49. case 1:
  50. if wireType != 0 {
  51. return fmt.Errorf("proto: wrong wireType = %d for field Crc", wireType)
  52. }
  53. for shift := uint(0); ; shift += 7 {
  54. if iNdEx >= l {
  55. return io.ErrUnexpectedEOF
  56. }
  57. b := data[iNdEx]
  58. iNdEx++
  59. m.Crc |= (uint32(b) & 0x7F) << shift
  60. if b < 0x80 {
  61. break
  62. }
  63. }
  64. case 2:
  65. if wireType != 2 {
  66. return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
  67. }
  68. var byteLen int
  69. for shift := uint(0); ; shift += 7 {
  70. if iNdEx >= l {
  71. return io.ErrUnexpectedEOF
  72. }
  73. b := data[iNdEx]
  74. iNdEx++
  75. byteLen |= (int(b) & 0x7F) << shift
  76. if b < 0x80 {
  77. break
  78. }
  79. }
  80. postIndex := iNdEx + byteLen
  81. if postIndex > l {
  82. return io.ErrUnexpectedEOF
  83. }
  84. m.Data = append([]byte{}, data[iNdEx:postIndex]...)
  85. iNdEx = postIndex
  86. default:
  87. var sizeOfWire int
  88. for {
  89. sizeOfWire++
  90. wire >>= 7
  91. if wire == 0 {
  92. break
  93. }
  94. }
  95. iNdEx -= sizeOfWire
  96. skippy, err := skipSnap(data[iNdEx:])
  97. if err != nil {
  98. return err
  99. }
  100. if (iNdEx + skippy) > l {
  101. return io.ErrUnexpectedEOF
  102. }
  103. m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...)
  104. iNdEx += skippy
  105. }
  106. }
  107. return nil
  108. }
  109. func skipSnap(data []byte) (n int, err error) {
  110. l := len(data)
  111. iNdEx := 0
  112. for iNdEx < l {
  113. var wire uint64
  114. for shift := uint(0); ; shift += 7 {
  115. if iNdEx >= l {
  116. return 0, io.ErrUnexpectedEOF
  117. }
  118. b := data[iNdEx]
  119. iNdEx++
  120. wire |= (uint64(b) & 0x7F) << shift
  121. if b < 0x80 {
  122. break
  123. }
  124. }
  125. wireType := int(wire & 0x7)
  126. switch wireType {
  127. case 0:
  128. for {
  129. if iNdEx >= l {
  130. return 0, io.ErrUnexpectedEOF
  131. }
  132. iNdEx++
  133. if data[iNdEx-1] < 0x80 {
  134. break
  135. }
  136. }
  137. return iNdEx, nil
  138. case 1:
  139. iNdEx += 8
  140. return iNdEx, nil
  141. case 2:
  142. var length int
  143. for shift := uint(0); ; shift += 7 {
  144. if iNdEx >= l {
  145. return 0, io.ErrUnexpectedEOF
  146. }
  147. b := data[iNdEx]
  148. iNdEx++
  149. length |= (int(b) & 0x7F) << shift
  150. if b < 0x80 {
  151. break
  152. }
  153. }
  154. iNdEx += length
  155. return iNdEx, nil
  156. case 3:
  157. for {
  158. var innerWire uint64
  159. var start int = iNdEx
  160. for shift := uint(0); ; shift += 7 {
  161. if iNdEx >= l {
  162. return 0, io.ErrUnexpectedEOF
  163. }
  164. b := data[iNdEx]
  165. iNdEx++
  166. innerWire |= (uint64(b) & 0x7F) << shift
  167. if b < 0x80 {
  168. break
  169. }
  170. }
  171. innerWireType := int(innerWire & 0x7)
  172. if innerWireType == 4 {
  173. break
  174. }
  175. next, err := skipSnap(data[start:])
  176. if err != nil {
  177. return 0, err
  178. }
  179. iNdEx = start + next
  180. }
  181. return iNdEx, nil
  182. case 4:
  183. return iNdEx, nil
  184. case 5:
  185. iNdEx += 4
  186. return iNdEx, nil
  187. default:
  188. return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
  189. }
  190. }
  191. panic("unreachable")
  192. }
  193. func (m *Snapshot) Size() (n int) {
  194. var l int
  195. _ = l
  196. n += 1 + sovSnap(uint64(m.Crc))
  197. if m.Data != nil {
  198. l = len(m.Data)
  199. n += 1 + l + sovSnap(uint64(l))
  200. }
  201. if m.XXX_unrecognized != nil {
  202. n += len(m.XXX_unrecognized)
  203. }
  204. return n
  205. }
  206. func sovSnap(x uint64) (n int) {
  207. for {
  208. n++
  209. x >>= 7
  210. if x == 0 {
  211. break
  212. }
  213. }
  214. return n
  215. }
  216. func sozSnap(x uint64) (n int) {
  217. return sovSnap(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  218. }
  219. func (m *Snapshot) Marshal() (data []byte, err error) {
  220. size := m.Size()
  221. data = make([]byte, size)
  222. n, err := m.MarshalTo(data)
  223. if err != nil {
  224. return nil, err
  225. }
  226. return data[:n], nil
  227. }
  228. func (m *Snapshot) MarshalTo(data []byte) (n int, err error) {
  229. var i int
  230. _ = i
  231. var l int
  232. _ = l
  233. data[i] = 0x8
  234. i++
  235. i = encodeVarintSnap(data, i, uint64(m.Crc))
  236. if m.Data != nil {
  237. data[i] = 0x12
  238. i++
  239. i = encodeVarintSnap(data, i, uint64(len(m.Data)))
  240. i += copy(data[i:], m.Data)
  241. }
  242. if m.XXX_unrecognized != nil {
  243. i += copy(data[i:], m.XXX_unrecognized)
  244. }
  245. return i, nil
  246. }
  247. func encodeFixed64Snap(data []byte, offset int, v uint64) int {
  248. data[offset] = uint8(v)
  249. data[offset+1] = uint8(v >> 8)
  250. data[offset+2] = uint8(v >> 16)
  251. data[offset+3] = uint8(v >> 24)
  252. data[offset+4] = uint8(v >> 32)
  253. data[offset+5] = uint8(v >> 40)
  254. data[offset+6] = uint8(v >> 48)
  255. data[offset+7] = uint8(v >> 56)
  256. return offset + 8
  257. }
  258. func encodeFixed32Snap(data []byte, offset int, v uint32) int {
  259. data[offset] = uint8(v)
  260. data[offset+1] = uint8(v >> 8)
  261. data[offset+2] = uint8(v >> 16)
  262. data[offset+3] = uint8(v >> 24)
  263. return offset + 4
  264. }
  265. func encodeVarintSnap(data []byte, offset int, v uint64) int {
  266. for v >= 1<<7 {
  267. data[offset] = uint8(v&0x7f | 0x80)
  268. v >>= 7
  269. offset++
  270. }
  271. data[offset] = uint8(v)
  272. return offset + 1
  273. }