snapshot_request.pb.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. // Code generated by protoc-gen-gogo.
  2. // source: snapshot_request.proto
  3. // DO NOT EDIT!
  4. package protobuf
  5. import proto "github.com/coreos/etcd/third_party/code.google.com/p/gogoprotobuf/proto"
  6. import json "encoding/json"
  7. import math "math"
  8. // discarding unused import gogoproto "code.google.com/p/gogoprotobuf/gogoproto/gogo.pb"
  9. import io7 "io"
  10. import code_google_com_p_gogoprotobuf_proto14 "github.com/coreos/etcd/third_party/code.google.com/p/gogoprotobuf/proto"
  11. import fmt21 "fmt"
  12. import strings14 "strings"
  13. import reflect14 "reflect"
  14. import fmt22 "fmt"
  15. import strings15 "strings"
  16. import code_google_com_p_gogoprotobuf_proto15 "github.com/coreos/etcd/third_party/code.google.com/p/gogoprotobuf/proto"
  17. import sort7 "sort"
  18. import strconv7 "strconv"
  19. import reflect15 "reflect"
  20. import fmt23 "fmt"
  21. import bytes7 "bytes"
  22. // Reference proto, json, and math imports to suppress error if they are not otherwise used.
  23. var _ = proto.Marshal
  24. var _ = &json.SyntaxError{}
  25. var _ = math.Inf
  26. type SnapshotRequest struct {
  27. LeaderName *string `protobuf:"bytes,1,req" json:"LeaderName,omitempty"`
  28. LastIndex *uint64 `protobuf:"varint,2,req" json:"LastIndex,omitempty"`
  29. LastTerm *uint64 `protobuf:"varint,3,req" json:"LastTerm,omitempty"`
  30. XXX_unrecognized []byte `json:"-"`
  31. }
  32. func (m *SnapshotRequest) Reset() { *m = SnapshotRequest{} }
  33. func (*SnapshotRequest) ProtoMessage() {}
  34. func (m *SnapshotRequest) GetLeaderName() string {
  35. if m != nil && m.LeaderName != nil {
  36. return *m.LeaderName
  37. }
  38. return ""
  39. }
  40. func (m *SnapshotRequest) GetLastIndex() uint64 {
  41. if m != nil && m.LastIndex != nil {
  42. return *m.LastIndex
  43. }
  44. return 0
  45. }
  46. func (m *SnapshotRequest) GetLastTerm() uint64 {
  47. if m != nil && m.LastTerm != nil {
  48. return *m.LastTerm
  49. }
  50. return 0
  51. }
  52. func init() {
  53. }
  54. func (m *SnapshotRequest) Unmarshal(data []byte) error {
  55. l := len(data)
  56. index := 0
  57. for index < l {
  58. var wire uint64
  59. for shift := uint(0); ; shift += 7 {
  60. if index >= l {
  61. return io7.ErrUnexpectedEOF
  62. }
  63. b := data[index]
  64. index++
  65. wire |= (uint64(b) & 0x7F) << shift
  66. if b < 0x80 {
  67. break
  68. }
  69. }
  70. fieldNum := int32(wire >> 3)
  71. wireType := int(wire & 0x7)
  72. switch fieldNum {
  73. case 1:
  74. if wireType != 2 {
  75. return proto.ErrWrongType
  76. }
  77. var stringLen uint64
  78. for shift := uint(0); ; shift += 7 {
  79. if index >= l {
  80. return io7.ErrUnexpectedEOF
  81. }
  82. b := data[index]
  83. index++
  84. stringLen |= (uint64(b) & 0x7F) << shift
  85. if b < 0x80 {
  86. break
  87. }
  88. }
  89. postIndex := index + int(stringLen)
  90. if postIndex > l {
  91. return io7.ErrUnexpectedEOF
  92. }
  93. s := string(data[index:postIndex])
  94. m.LeaderName = &s
  95. index = postIndex
  96. case 2:
  97. if wireType != 0 {
  98. return proto.ErrWrongType
  99. }
  100. var v uint64
  101. for shift := uint(0); ; shift += 7 {
  102. if index >= l {
  103. return io7.ErrUnexpectedEOF
  104. }
  105. b := data[index]
  106. index++
  107. v |= (uint64(b) & 0x7F) << shift
  108. if b < 0x80 {
  109. break
  110. }
  111. }
  112. m.LastIndex = &v
  113. case 3:
  114. if wireType != 0 {
  115. return proto.ErrWrongType
  116. }
  117. var v uint64
  118. for shift := uint(0); ; shift += 7 {
  119. if index >= l {
  120. return io7.ErrUnexpectedEOF
  121. }
  122. b := data[index]
  123. index++
  124. v |= (uint64(b) & 0x7F) << shift
  125. if b < 0x80 {
  126. break
  127. }
  128. }
  129. m.LastTerm = &v
  130. default:
  131. var sizeOfWire int
  132. for {
  133. sizeOfWire++
  134. wire >>= 7
  135. if wire == 0 {
  136. break
  137. }
  138. }
  139. index -= sizeOfWire
  140. skippy, err := code_google_com_p_gogoprotobuf_proto14.Skip(data[index:])
  141. if err != nil {
  142. return err
  143. }
  144. m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
  145. index += skippy
  146. }
  147. }
  148. return nil
  149. }
  150. func (this *SnapshotRequest) String() string {
  151. if this == nil {
  152. return "nil"
  153. }
  154. s := strings14.Join([]string{`&SnapshotRequest{`,
  155. `LeaderName:` + valueToStringSnapshotRequest(this.LeaderName) + `,`,
  156. `LastIndex:` + valueToStringSnapshotRequest(this.LastIndex) + `,`,
  157. `LastTerm:` + valueToStringSnapshotRequest(this.LastTerm) + `,`,
  158. `XXX_unrecognized:` + fmt21.Sprintf("%v", this.XXX_unrecognized) + `,`,
  159. `}`,
  160. }, "")
  161. return s
  162. }
  163. func valueToStringSnapshotRequest(v interface{}) string {
  164. rv := reflect14.ValueOf(v)
  165. if rv.IsNil() {
  166. return "nil"
  167. }
  168. pv := reflect14.Indirect(rv).Interface()
  169. return fmt21.Sprintf("*%v", pv)
  170. }
  171. func (m *SnapshotRequest) Size() (n int) {
  172. var l int
  173. _ = l
  174. if m.LeaderName != nil {
  175. l = len(*m.LeaderName)
  176. n += 1 + l + sovSnapshotRequest(uint64(l))
  177. }
  178. if m.LastIndex != nil {
  179. n += 1 + sovSnapshotRequest(uint64(*m.LastIndex))
  180. }
  181. if m.LastTerm != nil {
  182. n += 1 + sovSnapshotRequest(uint64(*m.LastTerm))
  183. }
  184. if m.XXX_unrecognized != nil {
  185. n += len(m.XXX_unrecognized)
  186. }
  187. return n
  188. }
  189. func sovSnapshotRequest(x uint64) (n int) {
  190. for {
  191. n++
  192. x >>= 7
  193. if x == 0 {
  194. break
  195. }
  196. }
  197. return n
  198. }
  199. func sozSnapshotRequest(x uint64) (n int) {
  200. return sovSnapshotRequest(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  201. return sovSnapshotRequest(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  202. }
  203. func NewPopulatedSnapshotRequest(r randySnapshotRequest, easy bool) *SnapshotRequest {
  204. this := &SnapshotRequest{}
  205. v1 := randStringSnapshotRequest(r)
  206. this.LeaderName = &v1
  207. v2 := uint64(r.Uint32())
  208. this.LastIndex = &v2
  209. v3 := uint64(r.Uint32())
  210. this.LastTerm = &v3
  211. if !easy && r.Intn(10) != 0 {
  212. this.XXX_unrecognized = randUnrecognizedSnapshotRequest(r, 4)
  213. }
  214. return this
  215. }
  216. type randySnapshotRequest interface {
  217. Float32() float32
  218. Float64() float64
  219. Int63() int64
  220. Int31() int32
  221. Uint32() uint32
  222. Intn(n int) int
  223. }
  224. func randUTF8RuneSnapshotRequest(r randySnapshotRequest) rune {
  225. res := rune(r.Uint32() % 1112064)
  226. if 55296 <= res {
  227. res += 2047
  228. }
  229. return res
  230. }
  231. func randStringSnapshotRequest(r randySnapshotRequest) string {
  232. v4 := r.Intn(100)
  233. tmps := make([]rune, v4)
  234. for i := 0; i < v4; i++ {
  235. tmps[i] = randUTF8RuneSnapshotRequest(r)
  236. }
  237. return string(tmps)
  238. }
  239. func randUnrecognizedSnapshotRequest(r randySnapshotRequest, maxFieldNumber int) (data []byte) {
  240. l := r.Intn(5)
  241. for i := 0; i < l; i++ {
  242. wire := r.Intn(4)
  243. if wire == 3 {
  244. wire = 5
  245. }
  246. fieldNumber := maxFieldNumber + r.Intn(100)
  247. data = randFieldSnapshotRequest(data, r, fieldNumber, wire)
  248. }
  249. return data
  250. }
  251. func randFieldSnapshotRequest(data []byte, r randySnapshotRequest, fieldNumber int, wire int) []byte {
  252. key := uint32(fieldNumber)<<3 | uint32(wire)
  253. switch wire {
  254. case 0:
  255. data = encodeVarintPopulateSnapshotRequest(data, uint64(key))
  256. data = encodeVarintPopulateSnapshotRequest(data, uint64(r.Int63()))
  257. case 1:
  258. data = encodeVarintPopulateSnapshotRequest(data, uint64(key))
  259. data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
  260. case 2:
  261. data = encodeVarintPopulateSnapshotRequest(data, uint64(key))
  262. ll := r.Intn(100)
  263. data = encodeVarintPopulateSnapshotRequest(data, uint64(ll))
  264. for j := 0; j < ll; j++ {
  265. data = append(data, byte(r.Intn(256)))
  266. }
  267. default:
  268. data = encodeVarintPopulateSnapshotRequest(data, uint64(key))
  269. data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
  270. }
  271. return data
  272. }
  273. func encodeVarintPopulateSnapshotRequest(data []byte, v uint64) []byte {
  274. for v >= 1<<7 {
  275. data = append(data, uint8(uint64(v)&0x7f|0x80))
  276. v >>= 7
  277. }
  278. data = append(data, uint8(v))
  279. return data
  280. }
  281. func (m *SnapshotRequest) Marshal() (data []byte, err error) {
  282. size := m.Size()
  283. data = make([]byte, size)
  284. n, err := m.MarshalTo(data)
  285. if err != nil {
  286. return nil, err
  287. }
  288. return data[:n], nil
  289. }
  290. func (m *SnapshotRequest) MarshalTo(data []byte) (n int, err error) {
  291. var i int
  292. _ = i
  293. var l int
  294. _ = l
  295. if m.LeaderName != nil {
  296. data[i] = 0xa
  297. i++
  298. i = encodeVarintSnapshotRequest(data, i, uint64(len(*m.LeaderName)))
  299. i += copy(data[i:], *m.LeaderName)
  300. }
  301. if m.LastIndex != nil {
  302. data[i] = 0x10
  303. i++
  304. i = encodeVarintSnapshotRequest(data, i, uint64(*m.LastIndex))
  305. }
  306. if m.LastTerm != nil {
  307. data[i] = 0x18
  308. i++
  309. i = encodeVarintSnapshotRequest(data, i, uint64(*m.LastTerm))
  310. }
  311. if m.XXX_unrecognized != nil {
  312. i += copy(data[i:], m.XXX_unrecognized)
  313. }
  314. return i, nil
  315. }
  316. func encodeFixed64SnapshotRequest(data []byte, offset int, v uint64) int {
  317. data[offset] = uint8(v)
  318. data[offset+1] = uint8(v >> 8)
  319. data[offset+2] = uint8(v >> 16)
  320. data[offset+3] = uint8(v >> 24)
  321. data[offset+4] = uint8(v >> 32)
  322. data[offset+5] = uint8(v >> 40)
  323. data[offset+6] = uint8(v >> 48)
  324. data[offset+7] = uint8(v >> 56)
  325. return offset + 8
  326. }
  327. func encodeFixed32SnapshotRequest(data []byte, offset int, v uint32) int {
  328. data[offset] = uint8(v)
  329. data[offset+1] = uint8(v >> 8)
  330. data[offset+2] = uint8(v >> 16)
  331. data[offset+3] = uint8(v >> 24)
  332. return offset + 4
  333. }
  334. func encodeVarintSnapshotRequest(data []byte, offset int, v uint64) int {
  335. for v >= 1<<7 {
  336. data[offset] = uint8(v&0x7f | 0x80)
  337. v >>= 7
  338. offset++
  339. }
  340. data[offset] = uint8(v)
  341. return offset + 1
  342. }
  343. func (this *SnapshotRequest) GoString() string {
  344. if this == nil {
  345. return "nil"
  346. }
  347. s := strings15.Join([]string{`&protobuf.SnapshotRequest{` + `LeaderName:` + valueToGoStringSnapshotRequest(this.LeaderName, "string"), `LastIndex:` + valueToGoStringSnapshotRequest(this.LastIndex, "uint64"), `LastTerm:` + valueToGoStringSnapshotRequest(this.LastTerm, "uint64"), `XXX_unrecognized:` + fmt22.Sprintf("%#v", this.XXX_unrecognized) + `}`}, ", ")
  348. return s
  349. }
  350. func valueToGoStringSnapshotRequest(v interface{}, typ string) string {
  351. rv := reflect15.ValueOf(v)
  352. if rv.IsNil() {
  353. return "nil"
  354. }
  355. pv := reflect15.Indirect(rv).Interface()
  356. return fmt22.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
  357. }
  358. func extensionToGoStringSnapshotRequest(e map[int32]code_google_com_p_gogoprotobuf_proto15.Extension) string {
  359. if e == nil {
  360. return "nil"
  361. }
  362. s := "map[int32]proto.Extension{"
  363. keys := make([]int, 0, len(e))
  364. for k := range e {
  365. keys = append(keys, int(k))
  366. }
  367. sort7.Ints(keys)
  368. ss := []string{}
  369. for _, k := range keys {
  370. ss = append(ss, strconv7.Itoa(k)+": "+e[int32(k)].GoString())
  371. }
  372. s += strings15.Join(ss, ",") + "}"
  373. return s
  374. }
  375. func (this *SnapshotRequest) VerboseEqual(that interface{}) error {
  376. if that == nil {
  377. if this == nil {
  378. return nil
  379. }
  380. return fmt23.Errorf("that == nil && this != nil")
  381. }
  382. that1, ok := that.(*SnapshotRequest)
  383. if !ok {
  384. return fmt23.Errorf("that is not of type *SnapshotRequest")
  385. }
  386. if that1 == nil {
  387. if this == nil {
  388. return nil
  389. }
  390. return fmt23.Errorf("that is type *SnapshotRequest but is nil && this != nil")
  391. } else if this == nil {
  392. return fmt23.Errorf("that is type *SnapshotRequestbut is not nil && this == nil")
  393. }
  394. if this.LeaderName != nil && that1.LeaderName != nil {
  395. if *this.LeaderName != *that1.LeaderName {
  396. return fmt23.Errorf("LeaderName this(%v) Not Equal that(%v)", *this.LeaderName, *that1.LeaderName)
  397. }
  398. } else if this.LeaderName != nil {
  399. return fmt23.Errorf("this.LeaderName == nil && that.LeaderName != nil")
  400. } else if that1.LeaderName != nil {
  401. return fmt23.Errorf("LeaderName this(%v) Not Equal that(%v)", this.LeaderName, that1.LeaderName)
  402. }
  403. if this.LastIndex != nil && that1.LastIndex != nil {
  404. if *this.LastIndex != *that1.LastIndex {
  405. return fmt23.Errorf("LastIndex this(%v) Not Equal that(%v)", *this.LastIndex, *that1.LastIndex)
  406. }
  407. } else if this.LastIndex != nil {
  408. return fmt23.Errorf("this.LastIndex == nil && that.LastIndex != nil")
  409. } else if that1.LastIndex != nil {
  410. return fmt23.Errorf("LastIndex this(%v) Not Equal that(%v)", this.LastIndex, that1.LastIndex)
  411. }
  412. if this.LastTerm != nil && that1.LastTerm != nil {
  413. if *this.LastTerm != *that1.LastTerm {
  414. return fmt23.Errorf("LastTerm this(%v) Not Equal that(%v)", *this.LastTerm, *that1.LastTerm)
  415. }
  416. } else if this.LastTerm != nil {
  417. return fmt23.Errorf("this.LastTerm == nil && that.LastTerm != nil")
  418. } else if that1.LastTerm != nil {
  419. return fmt23.Errorf("LastTerm this(%v) Not Equal that(%v)", this.LastTerm, that1.LastTerm)
  420. }
  421. if !bytes7.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
  422. return fmt23.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
  423. }
  424. return nil
  425. }
  426. func (this *SnapshotRequest) Equal(that interface{}) bool {
  427. if that == nil {
  428. if this == nil {
  429. return true
  430. }
  431. return false
  432. }
  433. that1, ok := that.(*SnapshotRequest)
  434. if !ok {
  435. return false
  436. }
  437. if that1 == nil {
  438. if this == nil {
  439. return true
  440. }
  441. return false
  442. } else if this == nil {
  443. return false
  444. }
  445. if this.LeaderName != nil && that1.LeaderName != nil {
  446. if *this.LeaderName != *that1.LeaderName {
  447. return false
  448. }
  449. } else if this.LeaderName != nil {
  450. return false
  451. } else if that1.LeaderName != nil {
  452. return false
  453. }
  454. if this.LastIndex != nil && that1.LastIndex != nil {
  455. if *this.LastIndex != *that1.LastIndex {
  456. return false
  457. }
  458. } else if this.LastIndex != nil {
  459. return false
  460. } else if that1.LastIndex != nil {
  461. return false
  462. }
  463. if this.LastTerm != nil && that1.LastTerm != nil {
  464. if *this.LastTerm != *that1.LastTerm {
  465. return false
  466. }
  467. } else if this.LastTerm != nil {
  468. return false
  469. } else if that1.LastTerm != nil {
  470. return false
  471. }
  472. if !bytes7.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
  473. return false
  474. }
  475. return true
  476. }