PageRenderTime 54ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/github.com/coreos/etcd/snap/snappb/snap.pb.go

https://gitlab.com/admin-github-cloud/bootkube
Go | 332 lines | 305 code | 14 blank | 13 comment | 68 complexity | 08a6c53e7dad156aeac45092a15067ec MD5 | raw file
  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 (
  13. "fmt"
  14. proto "github.com/gogo/protobuf/proto"
  15. math "math"
  16. )
  17. import io "io"
  18. // Reference imports to suppress errors if they are not otherwise used.
  19. var _ = proto.Marshal
  20. var _ = fmt.Errorf
  21. var _ = math.Inf
  22. type Snapshot struct {
  23. Crc uint32 `protobuf:"varint,1,opt,name=crc" json:"crc"`
  24. Data []byte `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"`
  25. XXX_unrecognized []byte `json:"-"`
  26. }
  27. func (m *Snapshot) Reset() { *m = Snapshot{} }
  28. func (m *Snapshot) String() string { return proto.CompactTextString(m) }
  29. func (*Snapshot) ProtoMessage() {}
  30. func init() {
  31. proto.RegisterType((*Snapshot)(nil), "snappb.snapshot")
  32. }
  33. func (m *Snapshot) Marshal() (data []byte, err error) {
  34. size := m.Size()
  35. data = make([]byte, size)
  36. n, err := m.MarshalTo(data)
  37. if err != nil {
  38. return nil, err
  39. }
  40. return data[:n], nil
  41. }
  42. func (m *Snapshot) MarshalTo(data []byte) (int, error) {
  43. var i int
  44. _ = i
  45. var l int
  46. _ = l
  47. data[i] = 0x8
  48. i++
  49. i = encodeVarintSnap(data, i, uint64(m.Crc))
  50. if m.Data != nil {
  51. data[i] = 0x12
  52. i++
  53. i = encodeVarintSnap(data, i, uint64(len(m.Data)))
  54. i += copy(data[i:], m.Data)
  55. }
  56. if m.XXX_unrecognized != nil {
  57. i += copy(data[i:], m.XXX_unrecognized)
  58. }
  59. return i, nil
  60. }
  61. func encodeFixed64Snap(data []byte, offset int, v uint64) int {
  62. data[offset] = uint8(v)
  63. data[offset+1] = uint8(v >> 8)
  64. data[offset+2] = uint8(v >> 16)
  65. data[offset+3] = uint8(v >> 24)
  66. data[offset+4] = uint8(v >> 32)
  67. data[offset+5] = uint8(v >> 40)
  68. data[offset+6] = uint8(v >> 48)
  69. data[offset+7] = uint8(v >> 56)
  70. return offset + 8
  71. }
  72. func encodeFixed32Snap(data []byte, offset int, v uint32) int {
  73. data[offset] = uint8(v)
  74. data[offset+1] = uint8(v >> 8)
  75. data[offset+2] = uint8(v >> 16)
  76. data[offset+3] = uint8(v >> 24)
  77. return offset + 4
  78. }
  79. func encodeVarintSnap(data []byte, offset int, v uint64) int {
  80. for v >= 1<<7 {
  81. data[offset] = uint8(v&0x7f | 0x80)
  82. v >>= 7
  83. offset++
  84. }
  85. data[offset] = uint8(v)
  86. return offset + 1
  87. }
  88. func (m *Snapshot) Size() (n int) {
  89. var l int
  90. _ = l
  91. n += 1 + sovSnap(uint64(m.Crc))
  92. if m.Data != nil {
  93. l = len(m.Data)
  94. n += 1 + l + sovSnap(uint64(l))
  95. }
  96. if m.XXX_unrecognized != nil {
  97. n += len(m.XXX_unrecognized)
  98. }
  99. return n
  100. }
  101. func sovSnap(x uint64) (n int) {
  102. for {
  103. n++
  104. x >>= 7
  105. if x == 0 {
  106. break
  107. }
  108. }
  109. return n
  110. }
  111. func sozSnap(x uint64) (n int) {
  112. return sovSnap(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  113. }
  114. func (m *Snapshot) Unmarshal(data []byte) error {
  115. l := len(data)
  116. iNdEx := 0
  117. for iNdEx < l {
  118. preIndex := iNdEx
  119. var wire uint64
  120. for shift := uint(0); ; shift += 7 {
  121. if shift >= 64 {
  122. return ErrIntOverflowSnap
  123. }
  124. if iNdEx >= l {
  125. return io.ErrUnexpectedEOF
  126. }
  127. b := data[iNdEx]
  128. iNdEx++
  129. wire |= (uint64(b) & 0x7F) << shift
  130. if b < 0x80 {
  131. break
  132. }
  133. }
  134. fieldNum := int32(wire >> 3)
  135. wireType := int(wire & 0x7)
  136. if wireType == 4 {
  137. return fmt.Errorf("proto: snapshot: wiretype end group for non-group")
  138. }
  139. if fieldNum <= 0 {
  140. return fmt.Errorf("proto: snapshot: illegal tag %d (wire type %d)", fieldNum, wire)
  141. }
  142. switch fieldNum {
  143. case 1:
  144. if wireType != 0 {
  145. return fmt.Errorf("proto: wrong wireType = %d for field Crc", wireType)
  146. }
  147. m.Crc = 0
  148. for shift := uint(0); ; shift += 7 {
  149. if shift >= 64 {
  150. return ErrIntOverflowSnap
  151. }
  152. if iNdEx >= l {
  153. return io.ErrUnexpectedEOF
  154. }
  155. b := data[iNdEx]
  156. iNdEx++
  157. m.Crc |= (uint32(b) & 0x7F) << shift
  158. if b < 0x80 {
  159. break
  160. }
  161. }
  162. case 2:
  163. if wireType != 2 {
  164. return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
  165. }
  166. var byteLen int
  167. for shift := uint(0); ; shift += 7 {
  168. if shift >= 64 {
  169. return ErrIntOverflowSnap
  170. }
  171. if iNdEx >= l {
  172. return io.ErrUnexpectedEOF
  173. }
  174. b := data[iNdEx]
  175. iNdEx++
  176. byteLen |= (int(b) & 0x7F) << shift
  177. if b < 0x80 {
  178. break
  179. }
  180. }
  181. if byteLen < 0 {
  182. return ErrInvalidLengthSnap
  183. }
  184. postIndex := iNdEx + byteLen
  185. if postIndex > l {
  186. return io.ErrUnexpectedEOF
  187. }
  188. m.Data = append(m.Data[:0], data[iNdEx:postIndex]...)
  189. if m.Data == nil {
  190. m.Data = []byte{}
  191. }
  192. iNdEx = postIndex
  193. default:
  194. iNdEx = preIndex
  195. skippy, err := skipSnap(data[iNdEx:])
  196. if err != nil {
  197. return err
  198. }
  199. if skippy < 0 {
  200. return ErrInvalidLengthSnap
  201. }
  202. if (iNdEx + skippy) > l {
  203. return io.ErrUnexpectedEOF
  204. }
  205. m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...)
  206. iNdEx += skippy
  207. }
  208. }
  209. if iNdEx > l {
  210. return io.ErrUnexpectedEOF
  211. }
  212. return nil
  213. }
  214. func skipSnap(data []byte) (n int, err error) {
  215. l := len(data)
  216. iNdEx := 0
  217. for iNdEx < l {
  218. var wire uint64
  219. for shift := uint(0); ; shift += 7 {
  220. if shift >= 64 {
  221. return 0, ErrIntOverflowSnap
  222. }
  223. if iNdEx >= l {
  224. return 0, io.ErrUnexpectedEOF
  225. }
  226. b := data[iNdEx]
  227. iNdEx++
  228. wire |= (uint64(b) & 0x7F) << shift
  229. if b < 0x80 {
  230. break
  231. }
  232. }
  233. wireType := int(wire & 0x7)
  234. switch wireType {
  235. case 0:
  236. for shift := uint(0); ; shift += 7 {
  237. if shift >= 64 {
  238. return 0, ErrIntOverflowSnap
  239. }
  240. if iNdEx >= l {
  241. return 0, io.ErrUnexpectedEOF
  242. }
  243. iNdEx++
  244. if data[iNdEx-1] < 0x80 {
  245. break
  246. }
  247. }
  248. return iNdEx, nil
  249. case 1:
  250. iNdEx += 8
  251. return iNdEx, nil
  252. case 2:
  253. var length int
  254. for shift := uint(0); ; shift += 7 {
  255. if shift >= 64 {
  256. return 0, ErrIntOverflowSnap
  257. }
  258. if iNdEx >= l {
  259. return 0, io.ErrUnexpectedEOF
  260. }
  261. b := data[iNdEx]
  262. iNdEx++
  263. length |= (int(b) & 0x7F) << shift
  264. if b < 0x80 {
  265. break
  266. }
  267. }
  268. iNdEx += length
  269. if length < 0 {
  270. return 0, ErrInvalidLengthSnap
  271. }
  272. return iNdEx, nil
  273. case 3:
  274. for {
  275. var innerWire uint64
  276. var start int = iNdEx
  277. for shift := uint(0); ; shift += 7 {
  278. if shift >= 64 {
  279. return 0, ErrIntOverflowSnap
  280. }
  281. if iNdEx >= l {
  282. return 0, io.ErrUnexpectedEOF
  283. }
  284. b := data[iNdEx]
  285. iNdEx++
  286. innerWire |= (uint64(b) & 0x7F) << shift
  287. if b < 0x80 {
  288. break
  289. }
  290. }
  291. innerWireType := int(innerWire & 0x7)
  292. if innerWireType == 4 {
  293. break
  294. }
  295. next, err := skipSnap(data[start:])
  296. if err != nil {
  297. return 0, err
  298. }
  299. iNdEx = start + next
  300. }
  301. return iNdEx, nil
  302. case 4:
  303. return iNdEx, nil
  304. case 5:
  305. iNdEx += 4
  306. return iNdEx, nil
  307. default:
  308. return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
  309. }
  310. }
  311. panic("unreachable")
  312. }
  313. var (
  314. ErrInvalidLengthSnap = fmt.Errorf("proto: negative length found during unmarshaling")
  315. ErrIntOverflowSnap = fmt.Errorf("proto: integer overflow")
  316. )