snap.pb.go 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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/code.google.com/p/gogoprotobuf/proto"
  13. import json "encoding/json"
  14. import math "math"
  15. // discarding unused import gogoproto "code.google.com/p/gogoprotobuf/gogoproto/gogo.pb"
  16. import io "io"
  17. import code_google_com_p_gogoprotobuf_proto "github.com/coreos/etcd/Godeps/_workspace/src/code.google.com/p/gogoprotobuf/proto"
  18. // Reference proto, json, and math imports to suppress error if they are not otherwise used.
  19. var _ = proto.Marshal
  20. var _ = &json.SyntaxError{}
  21. var _ = math.Inf
  22. type Snapshot struct {
  23. Crc uint32 `protobuf:"varint,1,req,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. }
  32. func (m *Snapshot) Unmarshal(data []byte) error {
  33. l := len(data)
  34. index := 0
  35. for index < l {
  36. var wire uint64
  37. for shift := uint(0); ; shift += 7 {
  38. if index >= l {
  39. return io.ErrUnexpectedEOF
  40. }
  41. b := data[index]
  42. index++
  43. wire |= (uint64(b) & 0x7F) << shift
  44. if b < 0x80 {
  45. break
  46. }
  47. }
  48. fieldNum := int32(wire >> 3)
  49. wireType := int(wire & 0x7)
  50. switch fieldNum {
  51. case 1:
  52. if wireType != 0 {
  53. return code_google_com_p_gogoprotobuf_proto.ErrWrongType
  54. }
  55. for shift := uint(0); ; shift += 7 {
  56. if index >= l {
  57. return io.ErrUnexpectedEOF
  58. }
  59. b := data[index]
  60. index++
  61. m.Crc |= (uint32(b) & 0x7F) << shift
  62. if b < 0x80 {
  63. break
  64. }
  65. }
  66. case 2:
  67. if wireType != 2 {
  68. return code_google_com_p_gogoprotobuf_proto.ErrWrongType
  69. }
  70. var byteLen int
  71. for shift := uint(0); ; shift += 7 {
  72. if index >= l {
  73. return io.ErrUnexpectedEOF
  74. }
  75. b := data[index]
  76. index++
  77. byteLen |= (int(b) & 0x7F) << shift
  78. if b < 0x80 {
  79. break
  80. }
  81. }
  82. postIndex := index + byteLen
  83. if postIndex > l {
  84. return io.ErrUnexpectedEOF
  85. }
  86. m.Data = append(m.Data, data[index:postIndex]...)
  87. index = postIndex
  88. default:
  89. var sizeOfWire int
  90. for {
  91. sizeOfWire++
  92. wire >>= 7
  93. if wire == 0 {
  94. break
  95. }
  96. }
  97. index -= sizeOfWire
  98. skippy, err := code_google_com_p_gogoprotobuf_proto.Skip(data[index:])
  99. if err != nil {
  100. return err
  101. }
  102. if (index + skippy) > l {
  103. return io.ErrUnexpectedEOF
  104. }
  105. m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
  106. index += skippy
  107. }
  108. }
  109. return nil
  110. }
  111. func (m *Snapshot) Size() (n int) {
  112. var l int
  113. _ = l
  114. n += 1 + sovSnap(uint64(m.Crc))
  115. if m.Data != nil {
  116. l = len(m.Data)
  117. n += 1 + l + sovSnap(uint64(l))
  118. }
  119. if m.XXX_unrecognized != nil {
  120. n += len(m.XXX_unrecognized)
  121. }
  122. return n
  123. }
  124. func sovSnap(x uint64) (n int) {
  125. for {
  126. n++
  127. x >>= 7
  128. if x == 0 {
  129. break
  130. }
  131. }
  132. return n
  133. }
  134. func sozSnap(x uint64) (n int) {
  135. return sovSnap(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  136. }
  137. func (m *Snapshot) Marshal() (data []byte, err error) {
  138. size := m.Size()
  139. data = make([]byte, size)
  140. n, err := m.MarshalTo(data)
  141. if err != nil {
  142. return nil, err
  143. }
  144. return data[:n], nil
  145. }
  146. func (m *Snapshot) MarshalTo(data []byte) (n int, err error) {
  147. var i int
  148. _ = i
  149. var l int
  150. _ = l
  151. data[i] = 0x8
  152. i++
  153. i = encodeVarintSnap(data, i, uint64(m.Crc))
  154. if m.Data != nil {
  155. data[i] = 0x12
  156. i++
  157. i = encodeVarintSnap(data, i, uint64(len(m.Data)))
  158. i += copy(data[i:], m.Data)
  159. }
  160. if m.XXX_unrecognized != nil {
  161. i += copy(data[i:], m.XXX_unrecognized)
  162. }
  163. return i, nil
  164. }
  165. func encodeFixed64Snap(data []byte, offset int, v uint64) int {
  166. data[offset] = uint8(v)
  167. data[offset+1] = uint8(v >> 8)
  168. data[offset+2] = uint8(v >> 16)
  169. data[offset+3] = uint8(v >> 24)
  170. data[offset+4] = uint8(v >> 32)
  171. data[offset+5] = uint8(v >> 40)
  172. data[offset+6] = uint8(v >> 48)
  173. data[offset+7] = uint8(v >> 56)
  174. return offset + 8
  175. }
  176. func encodeFixed32Snap(data []byte, offset int, v uint32) int {
  177. data[offset] = uint8(v)
  178. data[offset+1] = uint8(v >> 8)
  179. data[offset+2] = uint8(v >> 16)
  180. data[offset+3] = uint8(v >> 24)
  181. return offset + 4
  182. }
  183. func encodeVarintSnap(data []byte, offset int, v uint64) int {
  184. for v >= 1<<7 {
  185. data[offset] = uint8(v&0x7f | 0x80)
  186. v >>= 7
  187. offset++
  188. }
  189. data[offset] = uint8(v)
  190. return offset + 1
  191. }