log_entry.pb.go 13 KB

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