log_entry.pb.go 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. // Code generated by protoc-gen-gogo.
  2. // source: log_entry.proto
  3. // DO NOT EDIT!
  4. /*
  5. Package protobuf is a generated protocol buffer package.
  6. It is generated from these files:
  7. log_entry.proto
  8. It has these top-level messages:
  9. LogEntry
  10. */
  11. package protobuf
  12. import proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
  13. import math "math"
  14. // discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto/gogo.pb"
  15. import io "io"
  16. import fmt "fmt"
  17. import github_com_gogo_protobuf_proto "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
  18. import strings "strings"
  19. import reflect "reflect"
  20. import sort "sort"
  21. import strconv "strconv"
  22. import bytes "bytes"
  23. // Reference imports to suppress errors if they are not otherwise used.
  24. var _ = proto.Marshal
  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 fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
  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 fmt.Errorf("proto: wrong wireType = %d for field Term", wireType)
  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 fmt.Errorf("proto: wrong wireType = %d for field CommandName", wireType)
  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 fmt.Errorf("proto: wrong wireType = %d for field Command", wireType)
  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([]byte{}, 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 := github_com_gogo_protobuf_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. return rune(r.Intn(126-43) + 43)
  269. }
  270. func randStringLogEntry(r randyLogEntry) string {
  271. v5 := r.Intn(100)
  272. tmps := make([]rune, v5)
  273. for i := 0; i < v5; i++ {
  274. tmps[i] = randUTF8RuneLogEntry(r)
  275. }
  276. return string(tmps)
  277. }
  278. func randUnrecognizedLogEntry(r randyLogEntry, maxFieldNumber int) (data []byte) {
  279. l := r.Intn(5)
  280. for i := 0; i < l; i++ {
  281. wire := r.Intn(4)
  282. if wire == 3 {
  283. wire = 5
  284. }
  285. fieldNumber := maxFieldNumber + r.Intn(100)
  286. data = randFieldLogEntry(data, r, fieldNumber, wire)
  287. }
  288. return data
  289. }
  290. func randFieldLogEntry(data []byte, r randyLogEntry, fieldNumber int, wire int) []byte {
  291. key := uint32(fieldNumber)<<3 | uint32(wire)
  292. switch wire {
  293. case 0:
  294. data = encodeVarintPopulateLogEntry(data, uint64(key))
  295. v6 := r.Int63()
  296. if r.Intn(2) == 0 {
  297. v6 *= -1
  298. }
  299. data = encodeVarintPopulateLogEntry(data, uint64(v6))
  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 := strings.Join([]string{`&protobuf.LogEntry{` +
  397. `Index:` + valueToGoStringLogEntry(this.Index, "uint64"),
  398. `Term:` + valueToGoStringLogEntry(this.Term, "uint64"),
  399. `CommandName:` + valueToGoStringLogEntry(this.CommandName, "string"),
  400. `Command:` + valueToGoStringLogEntry(this.Command, "byte"),
  401. `XXX_unrecognized:` + fmt.Sprintf("%#v", this.XXX_unrecognized) + `}`}, ", ")
  402. return s
  403. }
  404. func valueToGoStringLogEntry(v interface{}, typ string) string {
  405. rv := reflect.ValueOf(v)
  406. if rv.IsNil() {
  407. return "nil"
  408. }
  409. pv := reflect.Indirect(rv).Interface()
  410. return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
  411. }
  412. func extensionToGoStringLogEntry(e map[int32]github_com_gogo_protobuf_proto.Extension) string {
  413. if e == nil {
  414. return "nil"
  415. }
  416. s := "map[int32]proto.Extension{"
  417. keys := make([]int, 0, len(e))
  418. for k := range e {
  419. keys = append(keys, int(k))
  420. }
  421. sort.Ints(keys)
  422. ss := []string{}
  423. for _, k := range keys {
  424. ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString())
  425. }
  426. s += strings.Join(ss, ",") + "}"
  427. return s
  428. }
  429. func (this *LogEntry) VerboseEqual(that interface{}) error {
  430. if that == nil {
  431. if this == nil {
  432. return nil
  433. }
  434. return fmt.Errorf("that == nil && this != nil")
  435. }
  436. that1, ok := that.(*LogEntry)
  437. if !ok {
  438. return fmt.Errorf("that is not of type *LogEntry")
  439. }
  440. if that1 == nil {
  441. if this == nil {
  442. return nil
  443. }
  444. return fmt.Errorf("that is type *LogEntry but is nil && this != nil")
  445. } else if this == nil {
  446. return fmt.Errorf("that is type *LogEntrybut is not nil && this == nil")
  447. }
  448. if this.Index != nil && that1.Index != nil {
  449. if *this.Index != *that1.Index {
  450. return fmt.Errorf("Index this(%v) Not Equal that(%v)", *this.Index, *that1.Index)
  451. }
  452. } else if this.Index != nil {
  453. return fmt.Errorf("this.Index == nil && that.Index != nil")
  454. } else if that1.Index != nil {
  455. return fmt.Errorf("Index this(%v) Not Equal that(%v)", this.Index, that1.Index)
  456. }
  457. if this.Term != nil && that1.Term != nil {
  458. if *this.Term != *that1.Term {
  459. return fmt.Errorf("Term this(%v) Not Equal that(%v)", *this.Term, *that1.Term)
  460. }
  461. } else if this.Term != nil {
  462. return fmt.Errorf("this.Term == nil && that.Term != nil")
  463. } else if that1.Term != nil {
  464. return fmt.Errorf("Term this(%v) Not Equal that(%v)", this.Term, that1.Term)
  465. }
  466. if this.CommandName != nil && that1.CommandName != nil {
  467. if *this.CommandName != *that1.CommandName {
  468. return fmt.Errorf("CommandName this(%v) Not Equal that(%v)", *this.CommandName, *that1.CommandName)
  469. }
  470. } else if this.CommandName != nil {
  471. return fmt.Errorf("this.CommandName == nil && that.CommandName != nil")
  472. } else if that1.CommandName != nil {
  473. return fmt.Errorf("CommandName this(%v) Not Equal that(%v)", this.CommandName, that1.CommandName)
  474. }
  475. if !bytes.Equal(this.Command, that1.Command) {
  476. return fmt.Errorf("Command this(%v) Not Equal that(%v)", this.Command, that1.Command)
  477. }
  478. if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
  479. return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
  480. }
  481. return nil
  482. }
  483. func (this *LogEntry) Equal(that interface{}) bool {
  484. if that == nil {
  485. if this == nil {
  486. return true
  487. }
  488. return false
  489. }
  490. that1, ok := that.(*LogEntry)
  491. if !ok {
  492. return false
  493. }
  494. if that1 == nil {
  495. if this == nil {
  496. return true
  497. }
  498. return false
  499. } else if this == nil {
  500. return false
  501. }
  502. if this.Index != nil && that1.Index != nil {
  503. if *this.Index != *that1.Index {
  504. return false
  505. }
  506. } else if this.Index != nil {
  507. return false
  508. } else if that1.Index != nil {
  509. return false
  510. }
  511. if this.Term != nil && that1.Term != nil {
  512. if *this.Term != *that1.Term {
  513. return false
  514. }
  515. } else if this.Term != nil {
  516. return false
  517. } else if that1.Term != nil {
  518. return false
  519. }
  520. if this.CommandName != nil && that1.CommandName != nil {
  521. if *this.CommandName != *that1.CommandName {
  522. return false
  523. }
  524. } else if this.CommandName != nil {
  525. return false
  526. } else if that1.CommandName != nil {
  527. return false
  528. }
  529. if !bytes.Equal(this.Command, that1.Command) {
  530. return false
  531. }
  532. if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
  533. return false
  534. }
  535. return true
  536. }