log_entry.pb.go 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  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/Godeps/_workspace/src/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/Godeps/_workspace/src/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/Godeps/_workspace/src/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 code_google_com_p_gogoprotobuf_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 code_google_com_p_gogoprotobuf_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 code_google_com_p_gogoprotobuf_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 code_google_com_p_gogoprotobuf_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. if (index + skippy) > l {
  174. return io.ErrUnexpectedEOF
  175. }
  176. m.XXX_unrecognized = append(m.XXX_unrecognized, data[index:index+skippy]...)
  177. index += skippy
  178. }
  179. }
  180. return nil
  181. }
  182. func (this *LogEntry) String() string {
  183. if this == nil {
  184. return "nil"
  185. }
  186. s := strings.Join([]string{`&LogEntry{`,
  187. `Index:` + valueToStringLogEntry(this.Index) + `,`,
  188. `Term:` + valueToStringLogEntry(this.Term) + `,`,
  189. `CommandName:` + valueToStringLogEntry(this.CommandName) + `,`,
  190. `Command:` + valueToStringLogEntry(this.Command) + `,`,
  191. `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
  192. `}`,
  193. }, "")
  194. return s
  195. }
  196. func valueToStringLogEntry(v interface{}) string {
  197. rv := reflect.ValueOf(v)
  198. if rv.IsNil() {
  199. return "nil"
  200. }
  201. pv := reflect.Indirect(rv).Interface()
  202. return fmt.Sprintf("*%v", pv)
  203. }
  204. func (m *LogEntry) Size() (n int) {
  205. var l int
  206. _ = l
  207. if m.Index != nil {
  208. n += 1 + sovLogEntry(uint64(*m.Index))
  209. }
  210. if m.Term != nil {
  211. n += 1 + sovLogEntry(uint64(*m.Term))
  212. }
  213. if m.CommandName != nil {
  214. l = len(*m.CommandName)
  215. n += 1 + l + sovLogEntry(uint64(l))
  216. }
  217. if m.Command != nil {
  218. l = len(m.Command)
  219. n += 1 + l + sovLogEntry(uint64(l))
  220. }
  221. if m.XXX_unrecognized != nil {
  222. n += len(m.XXX_unrecognized)
  223. }
  224. return n
  225. }
  226. func sovLogEntry(x uint64) (n int) {
  227. for {
  228. n++
  229. x >>= 7
  230. if x == 0 {
  231. break
  232. }
  233. }
  234. return n
  235. }
  236. func sozLogEntry(x uint64) (n int) {
  237. return sovLogEntry(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  238. }
  239. func NewPopulatedLogEntry(r randyLogEntry, easy bool) *LogEntry {
  240. this := &LogEntry{}
  241. v1 := uint64(r.Uint32())
  242. this.Index = &v1
  243. v2 := uint64(r.Uint32())
  244. this.Term = &v2
  245. v3 := randStringLogEntry(r)
  246. this.CommandName = &v3
  247. if r.Intn(10) != 0 {
  248. v4 := r.Intn(100)
  249. this.Command = make([]byte, v4)
  250. for i := 0; i < v4; i++ {
  251. this.Command[i] = byte(r.Intn(256))
  252. }
  253. }
  254. if !easy && r.Intn(10) != 0 {
  255. this.XXX_unrecognized = randUnrecognizedLogEntry(r, 5)
  256. }
  257. return this
  258. }
  259. type randyLogEntry interface {
  260. Float32() float32
  261. Float64() float64
  262. Int63() int64
  263. Int31() int32
  264. Uint32() uint32
  265. Intn(n int) int
  266. }
  267. func randUTF8RuneLogEntry(r randyLogEntry) rune {
  268. res := rune(r.Uint32() % 1112064)
  269. if 55296 <= res {
  270. res += 2047
  271. }
  272. return res
  273. }
  274. func randStringLogEntry(r randyLogEntry) string {
  275. v5 := r.Intn(100)
  276. tmps := make([]rune, v5)
  277. for i := 0; i < v5; i++ {
  278. tmps[i] = randUTF8RuneLogEntry(r)
  279. }
  280. return string(tmps)
  281. }
  282. func randUnrecognizedLogEntry(r randyLogEntry, maxFieldNumber int) (data []byte) {
  283. l := r.Intn(5)
  284. for i := 0; i < l; i++ {
  285. wire := r.Intn(4)
  286. if wire == 3 {
  287. wire = 5
  288. }
  289. fieldNumber := maxFieldNumber + r.Intn(100)
  290. data = randFieldLogEntry(data, r, fieldNumber, wire)
  291. }
  292. return data
  293. }
  294. func randFieldLogEntry(data []byte, r randyLogEntry, fieldNumber int, wire int) []byte {
  295. key := uint32(fieldNumber)<<3 | uint32(wire)
  296. switch wire {
  297. case 0:
  298. data = encodeVarintPopulateLogEntry(data, uint64(key))
  299. data = encodeVarintPopulateLogEntry(data, uint64(r.Int63()))
  300. case 1:
  301. data = encodeVarintPopulateLogEntry(data, uint64(key))
  302. 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)))
  303. case 2:
  304. data = encodeVarintPopulateLogEntry(data, uint64(key))
  305. ll := r.Intn(100)
  306. data = encodeVarintPopulateLogEntry(data, uint64(ll))
  307. for j := 0; j < ll; j++ {
  308. data = append(data, byte(r.Intn(256)))
  309. }
  310. default:
  311. data = encodeVarintPopulateLogEntry(data, uint64(key))
  312. data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
  313. }
  314. return data
  315. }
  316. func encodeVarintPopulateLogEntry(data []byte, v uint64) []byte {
  317. for v >= 1<<7 {
  318. data = append(data, uint8(uint64(v)&0x7f|0x80))
  319. v >>= 7
  320. }
  321. data = append(data, uint8(v))
  322. return data
  323. }
  324. func (m *LogEntry) Marshal() (data []byte, err error) {
  325. size := m.Size()
  326. data = make([]byte, size)
  327. n, err := m.MarshalTo(data)
  328. if err != nil {
  329. return nil, err
  330. }
  331. return data[:n], nil
  332. }
  333. func (m *LogEntry) MarshalTo(data []byte) (n int, err error) {
  334. var i int
  335. _ = i
  336. var l int
  337. _ = l
  338. if m.Index != nil {
  339. data[i] = 0x8
  340. i++
  341. i = encodeVarintLogEntry(data, i, uint64(*m.Index))
  342. }
  343. if m.Term != nil {
  344. data[i] = 0x10
  345. i++
  346. i = encodeVarintLogEntry(data, i, uint64(*m.Term))
  347. }
  348. if m.CommandName != nil {
  349. data[i] = 0x1a
  350. i++
  351. i = encodeVarintLogEntry(data, i, uint64(len(*m.CommandName)))
  352. i += copy(data[i:], *m.CommandName)
  353. }
  354. if m.Command != nil {
  355. data[i] = 0x22
  356. i++
  357. i = encodeVarintLogEntry(data, i, uint64(len(m.Command)))
  358. i += copy(data[i:], m.Command)
  359. }
  360. if m.XXX_unrecognized != nil {
  361. i += copy(data[i:], m.XXX_unrecognized)
  362. }
  363. return i, nil
  364. }
  365. func encodeFixed64LogEntry(data []byte, offset int, v uint64) int {
  366. data[offset] = uint8(v)
  367. data[offset+1] = uint8(v >> 8)
  368. data[offset+2] = uint8(v >> 16)
  369. data[offset+3] = uint8(v >> 24)
  370. data[offset+4] = uint8(v >> 32)
  371. data[offset+5] = uint8(v >> 40)
  372. data[offset+6] = uint8(v >> 48)
  373. data[offset+7] = uint8(v >> 56)
  374. return offset + 8
  375. }
  376. func encodeFixed32LogEntry(data []byte, offset int, v uint32) int {
  377. data[offset] = uint8(v)
  378. data[offset+1] = uint8(v >> 8)
  379. data[offset+2] = uint8(v >> 16)
  380. data[offset+3] = uint8(v >> 24)
  381. return offset + 4
  382. }
  383. func encodeVarintLogEntry(data []byte, offset int, v uint64) int {
  384. for v >= 1<<7 {
  385. data[offset] = uint8(v&0x7f | 0x80)
  386. v >>= 7
  387. offset++
  388. }
  389. data[offset] = uint8(v)
  390. return offset + 1
  391. }
  392. func (this *LogEntry) GoString() string {
  393. if this == nil {
  394. return "nil"
  395. }
  396. 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) + `}`}, ", ")
  397. return s
  398. }
  399. func valueToGoStringLogEntry(v interface{}, typ string) string {
  400. rv := reflect1.ValueOf(v)
  401. if rv.IsNil() {
  402. return "nil"
  403. }
  404. pv := reflect1.Indirect(rv).Interface()
  405. return fmt1.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
  406. }
  407. func extensionToGoStringLogEntry(e map[int32]code_google_com_p_gogoprotobuf_proto1.Extension) string {
  408. if e == nil {
  409. return "nil"
  410. }
  411. s := "map[int32]proto.Extension{"
  412. keys := make([]int, 0, len(e))
  413. for k := range e {
  414. keys = append(keys, int(k))
  415. }
  416. sort.Ints(keys)
  417. ss := []string{}
  418. for _, k := range keys {
  419. ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString())
  420. }
  421. s += strings1.Join(ss, ",") + "}"
  422. return s
  423. }
  424. func (this *LogEntry) VerboseEqual(that interface{}) error {
  425. if that == nil {
  426. if this == nil {
  427. return nil
  428. }
  429. return fmt2.Errorf("that == nil && this != nil")
  430. }
  431. that1, ok := that.(*LogEntry)
  432. if !ok {
  433. return fmt2.Errorf("that is not of type *LogEntry")
  434. }
  435. if that1 == nil {
  436. if this == nil {
  437. return nil
  438. }
  439. return fmt2.Errorf("that is type *LogEntry but is nil && this != nil")
  440. } else if this == nil {
  441. return fmt2.Errorf("that is type *LogEntrybut is not nil && this == nil")
  442. }
  443. if this.Index != nil && that1.Index != nil {
  444. if *this.Index != *that1.Index {
  445. return fmt2.Errorf("Index this(%v) Not Equal that(%v)", *this.Index, *that1.Index)
  446. }
  447. } else if this.Index != nil {
  448. return fmt2.Errorf("this.Index == nil && that.Index != nil")
  449. } else if that1.Index != nil {
  450. return fmt2.Errorf("Index this(%v) Not Equal that(%v)", this.Index, that1.Index)
  451. }
  452. if this.Term != nil && that1.Term != nil {
  453. if *this.Term != *that1.Term {
  454. return fmt2.Errorf("Term this(%v) Not Equal that(%v)", *this.Term, *that1.Term)
  455. }
  456. } else if this.Term != nil {
  457. return fmt2.Errorf("this.Term == nil && that.Term != nil")
  458. } else if that1.Term != nil {
  459. return fmt2.Errorf("Term this(%v) Not Equal that(%v)", this.Term, that1.Term)
  460. }
  461. if this.CommandName != nil && that1.CommandName != nil {
  462. if *this.CommandName != *that1.CommandName {
  463. return fmt2.Errorf("CommandName this(%v) Not Equal that(%v)", *this.CommandName, *that1.CommandName)
  464. }
  465. } else if this.CommandName != nil {
  466. return fmt2.Errorf("this.CommandName == nil && that.CommandName != nil")
  467. } else if that1.CommandName != nil {
  468. return fmt2.Errorf("CommandName this(%v) Not Equal that(%v)", this.CommandName, that1.CommandName)
  469. }
  470. if !bytes.Equal(this.Command, that1.Command) {
  471. return fmt2.Errorf("Command this(%v) Not Equal that(%v)", this.Command, that1.Command)
  472. }
  473. if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
  474. return fmt2.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
  475. }
  476. return nil
  477. }
  478. func (this *LogEntry) Equal(that interface{}) bool {
  479. if that == nil {
  480. if this == nil {
  481. return true
  482. }
  483. return false
  484. }
  485. that1, ok := that.(*LogEntry)
  486. if !ok {
  487. return false
  488. }
  489. if that1 == nil {
  490. if this == nil {
  491. return true
  492. }
  493. return false
  494. } else if this == nil {
  495. return false
  496. }
  497. if this.Index != nil && that1.Index != nil {
  498. if *this.Index != *that1.Index {
  499. return false
  500. }
  501. } else if this.Index != nil {
  502. return false
  503. } else if that1.Index != nil {
  504. return false
  505. }
  506. if this.Term != nil && that1.Term != nil {
  507. if *this.Term != *that1.Term {
  508. return false
  509. }
  510. } else if this.Term != nil {
  511. return false
  512. } else if that1.Term != nil {
  513. return false
  514. }
  515. if this.CommandName != nil && that1.CommandName != nil {
  516. if *this.CommandName != *that1.CommandName {
  517. return false
  518. }
  519. } else if this.CommandName != nil {
  520. return false
  521. } else if that1.CommandName != nil {
  522. return false
  523. }
  524. if !bytes.Equal(this.Command, that1.Command) {
  525. return false
  526. }
  527. if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
  528. return false
  529. }
  530. return true
  531. }