高热共公日志库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1039 lines
22 KiB

  1. package alils
  2. import (
  3. "fmt"
  4. "io"
  5. "math"
  6. "github.com/gogo/protobuf/proto"
  7. github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
  8. )
  9. // Reference imports to suppress errors if they are not otherwise used.
  10. var _ = proto.Marshal
  11. var _ = fmt.Errorf
  12. var _ = math.Inf
  13. var (
  14. // ErrInvalidLengthLog invalid proto
  15. ErrInvalidLengthLog = fmt.Errorf("proto: negative length found during unmarshaling")
  16. // ErrIntOverflowLog overflow
  17. ErrIntOverflowLog = fmt.Errorf("proto: integer overflow")
  18. )
  19. // Log define the proto Log
  20. type Log struct {
  21. Time *uint32 `protobuf:"varint,1,req,name=Time" json:"Time,omitempty"`
  22. Contents []*LogContent `protobuf:"bytes,2,rep,name=Contents" json:"Contents,omitempty"`
  23. XXXUnrecognized []byte `json:"-"`
  24. }
  25. // Reset the Log
  26. func (m *Log) Reset() { *m = Log{} }
  27. // String return the Compact Log
  28. func (m *Log) String() string { return proto.CompactTextString(m) }
  29. // ProtoMessage not implemented
  30. func (*Log) ProtoMessage() {}
  31. // GetTime return the Log's Time
  32. func (m *Log) GetTime() uint32 {
  33. if m != nil && m.Time != nil {
  34. return *m.Time
  35. }
  36. return 0
  37. }
  38. // GetContents return the Log's Contents
  39. func (m *Log) GetContents() []*LogContent {
  40. if m != nil {
  41. return m.Contents
  42. }
  43. return nil
  44. }
  45. // LogContent define the Log content struct
  46. type LogContent struct {
  47. Key *string `protobuf:"bytes,1,req,name=Key" json:"Key,omitempty"`
  48. Value *string `protobuf:"bytes,2,req,name=Value" json:"Value,omitempty"`
  49. XXXUnrecognized []byte `json:"-"`
  50. }
  51. // Reset LogContent
  52. func (m *LogContent) Reset() { *m = LogContent{} }
  53. // String return the compact text
  54. func (m *LogContent) String() string { return proto.CompactTextString(m) }
  55. // ProtoMessage not implemented
  56. func (*LogContent) ProtoMessage() {}
  57. // GetKey return the Key
  58. func (m *LogContent) GetKey() string {
  59. if m != nil && m.Key != nil {
  60. return *m.Key
  61. }
  62. return ""
  63. }
  64. // GetValue return the Value
  65. func (m *LogContent) GetValue() string {
  66. if m != nil && m.Value != nil {
  67. return *m.Value
  68. }
  69. return ""
  70. }
  71. // LogGroup define the logs struct
  72. type LogGroup struct {
  73. Logs []*Log `protobuf:"bytes,1,rep,name=Logs" json:"Logs,omitempty"`
  74. Reserved *string `protobuf:"bytes,2,opt,name=Reserved" json:"Reserved,omitempty"`
  75. Topic *string `protobuf:"bytes,3,opt,name=Topic" json:"Topic,omitempty"`
  76. Source *string `protobuf:"bytes,4,opt,name=Source" json:"Source,omitempty"`
  77. XXXUnrecognized []byte `json:"-"`
  78. }
  79. // Reset LogGroup
  80. func (m *LogGroup) Reset() { *m = LogGroup{} }
  81. // String return the compact text
  82. func (m *LogGroup) String() string { return proto.CompactTextString(m) }
  83. // ProtoMessage not implemented
  84. func (*LogGroup) ProtoMessage() {}
  85. // GetLogs return the loggroup logs
  86. func (m *LogGroup) GetLogs() []*Log {
  87. if m != nil {
  88. return m.Logs
  89. }
  90. return nil
  91. }
  92. // GetReserved return Reserved
  93. func (m *LogGroup) GetReserved() string {
  94. if m != nil && m.Reserved != nil {
  95. return *m.Reserved
  96. }
  97. return ""
  98. }
  99. // GetTopic return Topic
  100. func (m *LogGroup) GetTopic() string {
  101. if m != nil && m.Topic != nil {
  102. return *m.Topic
  103. }
  104. return ""
  105. }
  106. // GetSource return Source
  107. func (m *LogGroup) GetSource() string {
  108. if m != nil && m.Source != nil {
  109. return *m.Source
  110. }
  111. return ""
  112. }
  113. // LogGroupList define the LogGroups
  114. type LogGroupList struct {
  115. LogGroups []*LogGroup `protobuf:"bytes,1,rep,name=logGroups" json:"logGroups,omitempty"`
  116. XXXUnrecognized []byte `json:"-"`
  117. }
  118. // Reset LogGroupList
  119. func (m *LogGroupList) Reset() { *m = LogGroupList{} }
  120. // String return compact text
  121. func (m *LogGroupList) String() string { return proto.CompactTextString(m) }
  122. // ProtoMessage not implemented
  123. func (*LogGroupList) ProtoMessage() {}
  124. // GetLogGroups return the LogGroups
  125. func (m *LogGroupList) GetLogGroups() []*LogGroup {
  126. if m != nil {
  127. return m.LogGroups
  128. }
  129. return nil
  130. }
  131. // Marshal the logs to byte slice
  132. func (m *Log) Marshal() (data []byte, err error) {
  133. size := m.Size()
  134. data = make([]byte, size)
  135. n, err := m.MarshalTo(data)
  136. if err != nil {
  137. return nil, err
  138. }
  139. return data[:n], nil
  140. }
  141. // MarshalTo data
  142. func (m *Log) MarshalTo(data []byte) (int, error) {
  143. var i int
  144. _ = i
  145. var l int
  146. _ = l
  147. if m.Time == nil {
  148. return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("Time")
  149. }
  150. data[i] = 0x8
  151. i++
  152. i = encodeVarintLog(data, i, uint64(*m.Time))
  153. if len(m.Contents) > 0 {
  154. for _, msg := range m.Contents {
  155. data[i] = 0x12
  156. i++
  157. i = encodeVarintLog(data, i, uint64(msg.Size()))
  158. n, err := msg.MarshalTo(data[i:])
  159. if err != nil {
  160. return 0, err
  161. }
  162. i += n
  163. }
  164. }
  165. if m.XXXUnrecognized != nil {
  166. i += copy(data[i:], m.XXXUnrecognized)
  167. }
  168. return i, nil
  169. }
  170. // Marshal LogContent
  171. func (m *LogContent) Marshal() (data []byte, err error) {
  172. size := m.Size()
  173. data = make([]byte, size)
  174. n, err := m.MarshalTo(data)
  175. if err != nil {
  176. return nil, err
  177. }
  178. return data[:n], nil
  179. }
  180. // MarshalTo logcontent to data
  181. func (m *LogContent) MarshalTo(data []byte) (int, error) {
  182. var i int
  183. _ = i
  184. var l int
  185. _ = l
  186. if m.Key == nil {
  187. return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("Key")
  188. }
  189. data[i] = 0xa
  190. i++
  191. i = encodeVarintLog(data, i, uint64(len(*m.Key)))
  192. i += copy(data[i:], *m.Key)
  193. if m.Value == nil {
  194. return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("Value")
  195. }
  196. data[i] = 0x12
  197. i++
  198. i = encodeVarintLog(data, i, uint64(len(*m.Value)))
  199. i += copy(data[i:], *m.Value)
  200. if m.XXXUnrecognized != nil {
  201. i += copy(data[i:], m.XXXUnrecognized)
  202. }
  203. return i, nil
  204. }
  205. // Marshal LogGroup
  206. func (m *LogGroup) Marshal() (data []byte, err error) {
  207. size := m.Size()
  208. data = make([]byte, size)
  209. n, err := m.MarshalTo(data)
  210. if err != nil {
  211. return nil, err
  212. }
  213. return data[:n], nil
  214. }
  215. // MarshalTo LogGroup to data
  216. func (m *LogGroup) MarshalTo(data []byte) (int, error) {
  217. var i int
  218. _ = i
  219. var l int
  220. _ = l
  221. if len(m.Logs) > 0 {
  222. for _, msg := range m.Logs {
  223. data[i] = 0xa
  224. i++
  225. i = encodeVarintLog(data, i, uint64(msg.Size()))
  226. n, err := msg.MarshalTo(data[i:])
  227. if err != nil {
  228. return 0, err
  229. }
  230. i += n
  231. }
  232. }
  233. if m.Reserved != nil {
  234. data[i] = 0x12
  235. i++
  236. i = encodeVarintLog(data, i, uint64(len(*m.Reserved)))
  237. i += copy(data[i:], *m.Reserved)
  238. }
  239. if m.Topic != nil {
  240. data[i] = 0x1a
  241. i++
  242. i = encodeVarintLog(data, i, uint64(len(*m.Topic)))
  243. i += copy(data[i:], *m.Topic)
  244. }
  245. if m.Source != nil {
  246. data[i] = 0x22
  247. i++
  248. i = encodeVarintLog(data, i, uint64(len(*m.Source)))
  249. i += copy(data[i:], *m.Source)
  250. }
  251. if m.XXXUnrecognized != nil {
  252. i += copy(data[i:], m.XXXUnrecognized)
  253. }
  254. return i, nil
  255. }
  256. // Marshal LogGroupList
  257. func (m *LogGroupList) Marshal() (data []byte, err error) {
  258. size := m.Size()
  259. data = make([]byte, size)
  260. n, err := m.MarshalTo(data)
  261. if err != nil {
  262. return nil, err
  263. }
  264. return data[:n], nil
  265. }
  266. // MarshalTo LogGroupList to data
  267. func (m *LogGroupList) MarshalTo(data []byte) (int, error) {
  268. var i int
  269. _ = i
  270. var l int
  271. _ = l
  272. if len(m.LogGroups) > 0 {
  273. for _, msg := range m.LogGroups {
  274. data[i] = 0xa
  275. i++
  276. i = encodeVarintLog(data, i, uint64(msg.Size()))
  277. n, err := msg.MarshalTo(data[i:])
  278. if err != nil {
  279. return 0, err
  280. }
  281. i += n
  282. }
  283. }
  284. if m.XXXUnrecognized != nil {
  285. i += copy(data[i:], m.XXXUnrecognized)
  286. }
  287. return i, nil
  288. }
  289. func encodeFixed64Log(data []byte, offset int, v uint64) int {
  290. data[offset] = uint8(v)
  291. data[offset+1] = uint8(v >> 8)
  292. data[offset+2] = uint8(v >> 16)
  293. data[offset+3] = uint8(v >> 24)
  294. data[offset+4] = uint8(v >> 32)
  295. data[offset+5] = uint8(v >> 40)
  296. data[offset+6] = uint8(v >> 48)
  297. data[offset+7] = uint8(v >> 56)
  298. return offset + 8
  299. }
  300. func encodeFixed32Log(data []byte, offset int, v uint32) int {
  301. data[offset] = uint8(v)
  302. data[offset+1] = uint8(v >> 8)
  303. data[offset+2] = uint8(v >> 16)
  304. data[offset+3] = uint8(v >> 24)
  305. return offset + 4
  306. }
  307. func encodeVarintLog(data []byte, offset int, v uint64) int {
  308. for v >= 1<<7 {
  309. data[offset] = uint8(v&0x7f | 0x80)
  310. v >>= 7
  311. offset++
  312. }
  313. data[offset] = uint8(v)
  314. return offset + 1
  315. }
  316. // Size return the log's size
  317. func (m *Log) Size() (n int) {
  318. var l int
  319. _ = l
  320. if m.Time != nil {
  321. n += 1 + sovLog(uint64(*m.Time))
  322. }
  323. if len(m.Contents) > 0 {
  324. for _, e := range m.Contents {
  325. l = e.Size()
  326. n += 1 + l + sovLog(uint64(l))
  327. }
  328. }
  329. if m.XXXUnrecognized != nil {
  330. n += len(m.XXXUnrecognized)
  331. }
  332. return n
  333. }
  334. // Size return LogContent size based on Key and Value
  335. func (m *LogContent) Size() (n int) {
  336. var l int
  337. _ = l
  338. if m.Key != nil {
  339. l = len(*m.Key)
  340. n += 1 + l + sovLog(uint64(l))
  341. }
  342. if m.Value != nil {
  343. l = len(*m.Value)
  344. n += 1 + l + sovLog(uint64(l))
  345. }
  346. if m.XXXUnrecognized != nil {
  347. n += len(m.XXXUnrecognized)
  348. }
  349. return n
  350. }
  351. // Size return LogGroup size based on Logs
  352. func (m *LogGroup) Size() (n int) {
  353. var l int
  354. _ = l
  355. if len(m.Logs) > 0 {
  356. for _, e := range m.Logs {
  357. l = e.Size()
  358. n += 1 + l + sovLog(uint64(l))
  359. }
  360. }
  361. if m.Reserved != nil {
  362. l = len(*m.Reserved)
  363. n += 1 + l + sovLog(uint64(l))
  364. }
  365. if m.Topic != nil {
  366. l = len(*m.Topic)
  367. n += 1 + l + sovLog(uint64(l))
  368. }
  369. if m.Source != nil {
  370. l = len(*m.Source)
  371. n += 1 + l + sovLog(uint64(l))
  372. }
  373. if m.XXXUnrecognized != nil {
  374. n += len(m.XXXUnrecognized)
  375. }
  376. return n
  377. }
  378. // Size return LogGroupList size
  379. func (m *LogGroupList) Size() (n int) {
  380. var l int
  381. _ = l
  382. if len(m.LogGroups) > 0 {
  383. for _, e := range m.LogGroups {
  384. l = e.Size()
  385. n += 1 + l + sovLog(uint64(l))
  386. }
  387. }
  388. if m.XXXUnrecognized != nil {
  389. n += len(m.XXXUnrecognized)
  390. }
  391. return n
  392. }
  393. func sovLog(x uint64) (n int) {
  394. for {
  395. n++
  396. x >>= 7
  397. if x == 0 {
  398. break
  399. }
  400. }
  401. return n
  402. }
  403. func sozLog(x uint64) (n int) {
  404. return sovLog((x << 1) ^ (x >> 63))
  405. }
  406. // Unmarshal data to log
  407. func (m *Log) Unmarshal(data []byte) error {
  408. var hasFields [1]uint64
  409. l := len(data)
  410. iNdEx := 0
  411. for iNdEx < l {
  412. preIndex := iNdEx
  413. var wire uint64
  414. for shift := uint(0); ; shift += 7 {
  415. if shift >= 64 {
  416. return ErrIntOverflowLog
  417. }
  418. if iNdEx >= l {
  419. return io.ErrUnexpectedEOF
  420. }
  421. b := data[iNdEx]
  422. iNdEx++
  423. wire |= (uint64(b) & 0x7F) << shift
  424. if b < 0x80 {
  425. break
  426. }
  427. }
  428. fieldNum := int32(wire >> 3)
  429. wireType := int(wire & 0x7)
  430. if wireType == 4 {
  431. return fmt.Errorf("proto: Log: wiretype end group for non-group")
  432. }
  433. if fieldNum <= 0 {
  434. return fmt.Errorf("proto: Log: illegal tag %d (wire type %d)", fieldNum, wire)
  435. }
  436. switch fieldNum {
  437. case 1:
  438. if wireType != 0 {
  439. return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType)
  440. }
  441. var v uint32
  442. for shift := uint(0); ; shift += 7 {
  443. if shift >= 64 {
  444. return ErrIntOverflowLog
  445. }
  446. if iNdEx >= l {
  447. return io.ErrUnexpectedEOF
  448. }
  449. b := data[iNdEx]
  450. iNdEx++
  451. v |= (uint32(b) & 0x7F) << shift
  452. if b < 0x80 {
  453. break
  454. }
  455. }
  456. m.Time = &v
  457. hasFields[0] |= uint64(0x00000001)
  458. case 2:
  459. if wireType != 2 {
  460. return fmt.Errorf("proto: wrong wireType = %d for field Contents", wireType)
  461. }
  462. var msglen int
  463. for shift := uint(0); ; shift += 7 {
  464. if shift >= 64 {
  465. return ErrIntOverflowLog
  466. }
  467. if iNdEx >= l {
  468. return io.ErrUnexpectedEOF
  469. }
  470. b := data[iNdEx]
  471. iNdEx++
  472. msglen |= (int(b) & 0x7F) << shift
  473. if b < 0x80 {
  474. break
  475. }
  476. }
  477. if msglen < 0 {
  478. return ErrInvalidLengthLog
  479. }
  480. postIndex := iNdEx + msglen
  481. if postIndex > l {
  482. return io.ErrUnexpectedEOF
  483. }
  484. m.Contents = append(m.Contents, &LogContent{})
  485. if err := m.Contents[len(m.Contents)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
  486. return err
  487. }
  488. iNdEx = postIndex
  489. default:
  490. iNdEx = preIndex
  491. skippy, err := skipLog(data[iNdEx:])
  492. if err != nil {
  493. return err
  494. }
  495. if skippy < 0 {
  496. return ErrInvalidLengthLog
  497. }
  498. if (iNdEx + skippy) > l {
  499. return io.ErrUnexpectedEOF
  500. }
  501. m.XXXUnrecognized = append(m.XXXUnrecognized, data[iNdEx:iNdEx+skippy]...)
  502. iNdEx += skippy
  503. }
  504. }
  505. if hasFields[0]&uint64(0x00000001) == 0 {
  506. return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Time")
  507. }
  508. if iNdEx > l {
  509. return io.ErrUnexpectedEOF
  510. }
  511. return nil
  512. }
  513. // Unmarshal data to LogContent
  514. func (m *LogContent) Unmarshal(data []byte) error {
  515. var hasFields [1]uint64
  516. l := len(data)
  517. iNdEx := 0
  518. for iNdEx < l {
  519. preIndex := iNdEx
  520. var wire uint64
  521. for shift := uint(0); ; shift += 7 {
  522. if shift >= 64 {
  523. return ErrIntOverflowLog
  524. }
  525. if iNdEx >= l {
  526. return io.ErrUnexpectedEOF
  527. }
  528. b := data[iNdEx]
  529. iNdEx++
  530. wire |= (uint64(b) & 0x7F) << shift
  531. if b < 0x80 {
  532. break
  533. }
  534. }
  535. fieldNum := int32(wire >> 3)
  536. wireType := int(wire & 0x7)
  537. if wireType == 4 {
  538. return fmt.Errorf("proto: Content: wiretype end group for non-group")
  539. }
  540. if fieldNum <= 0 {
  541. return fmt.Errorf("proto: Content: illegal tag %d (wire type %d)", fieldNum, wire)
  542. }
  543. switch fieldNum {
  544. case 1:
  545. if wireType != 2 {
  546. return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
  547. }
  548. var stringLen uint64
  549. for shift := uint(0); ; shift += 7 {
  550. if shift >= 64 {
  551. return ErrIntOverflowLog
  552. }
  553. if iNdEx >= l {
  554. return io.ErrUnexpectedEOF
  555. }
  556. b := data[iNdEx]
  557. iNdEx++
  558. stringLen |= (uint64(b) & 0x7F) << shift
  559. if b < 0x80 {
  560. break
  561. }
  562. }
  563. intStringLen := int(stringLen)
  564. if intStringLen < 0 {
  565. return ErrInvalidLengthLog
  566. }
  567. postIndex := iNdEx + intStringLen
  568. if postIndex > l {
  569. return io.ErrUnexpectedEOF
  570. }
  571. s := string(data[iNdEx:postIndex])
  572. m.Key = &s
  573. iNdEx = postIndex
  574. hasFields[0] |= uint64(0x00000001)
  575. case 2:
  576. if wireType != 2 {
  577. return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
  578. }
  579. var stringLen uint64
  580. for shift := uint(0); ; shift += 7 {
  581. if shift >= 64 {
  582. return ErrIntOverflowLog
  583. }
  584. if iNdEx >= l {
  585. return io.ErrUnexpectedEOF
  586. }
  587. b := data[iNdEx]
  588. iNdEx++
  589. stringLen |= (uint64(b) & 0x7F) << shift
  590. if b < 0x80 {
  591. break
  592. }
  593. }
  594. intStringLen := int(stringLen)
  595. if intStringLen < 0 {
  596. return ErrInvalidLengthLog
  597. }
  598. postIndex := iNdEx + intStringLen
  599. if postIndex > l {
  600. return io.ErrUnexpectedEOF
  601. }
  602. s := string(data[iNdEx:postIndex])
  603. m.Value = &s
  604. iNdEx = postIndex
  605. hasFields[0] |= uint64(0x00000002)
  606. default:
  607. iNdEx = preIndex
  608. skippy, err := skipLog(data[iNdEx:])
  609. if err != nil {
  610. return err
  611. }
  612. if skippy < 0 {
  613. return ErrInvalidLengthLog
  614. }
  615. if (iNdEx + skippy) > l {
  616. return io.ErrUnexpectedEOF
  617. }
  618. m.XXXUnrecognized = append(m.XXXUnrecognized, data[iNdEx:iNdEx+skippy]...)
  619. iNdEx += skippy
  620. }
  621. }
  622. if hasFields[0]&uint64(0x00000001) == 0 {
  623. return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Key")
  624. }
  625. if hasFields[0]&uint64(0x00000002) == 0 {
  626. return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Value")
  627. }
  628. if iNdEx > l {
  629. return io.ErrUnexpectedEOF
  630. }
  631. return nil
  632. }
  633. // Unmarshal data to LogGroup
  634. func (m *LogGroup) Unmarshal(data []byte) error {
  635. l := len(data)
  636. iNdEx := 0
  637. for iNdEx < l {
  638. preIndex := iNdEx
  639. var wire uint64
  640. for shift := uint(0); ; shift += 7 {
  641. if shift >= 64 {
  642. return ErrIntOverflowLog
  643. }
  644. if iNdEx >= l {
  645. return io.ErrUnexpectedEOF
  646. }
  647. b := data[iNdEx]
  648. iNdEx++
  649. wire |= (uint64(b) & 0x7F) << shift
  650. if b < 0x80 {
  651. break
  652. }
  653. }
  654. fieldNum := int32(wire >> 3)
  655. wireType := int(wire & 0x7)
  656. if wireType == 4 {
  657. return fmt.Errorf("proto: LogGroup: wiretype end group for non-group")
  658. }
  659. if fieldNum <= 0 {
  660. return fmt.Errorf("proto: LogGroup: illegal tag %d (wire type %d)", fieldNum, wire)
  661. }
  662. switch fieldNum {
  663. case 1:
  664. if wireType != 2 {
  665. return fmt.Errorf("proto: wrong wireType = %d for field Logs", wireType)
  666. }
  667. var msglen int
  668. for shift := uint(0); ; shift += 7 {
  669. if shift >= 64 {
  670. return ErrIntOverflowLog
  671. }
  672. if iNdEx >= l {
  673. return io.ErrUnexpectedEOF
  674. }
  675. b := data[iNdEx]
  676. iNdEx++
  677. msglen |= (int(b) & 0x7F) << shift
  678. if b < 0x80 {
  679. break
  680. }
  681. }
  682. if msglen < 0 {
  683. return ErrInvalidLengthLog
  684. }
  685. postIndex := iNdEx + msglen
  686. if postIndex > l {
  687. return io.ErrUnexpectedEOF
  688. }
  689. m.Logs = append(m.Logs, &Log{})
  690. if err := m.Logs[len(m.Logs)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
  691. return err
  692. }
  693. iNdEx = postIndex
  694. case 2:
  695. if wireType != 2 {
  696. return fmt.Errorf("proto: wrong wireType = %d for field Reserved", wireType)
  697. }
  698. var stringLen uint64
  699. for shift := uint(0); ; shift += 7 {
  700. if shift >= 64 {
  701. return ErrIntOverflowLog
  702. }
  703. if iNdEx >= l {
  704. return io.ErrUnexpectedEOF
  705. }
  706. b := data[iNdEx]
  707. iNdEx++
  708. stringLen |= (uint64(b) & 0x7F) << shift
  709. if b < 0x80 {
  710. break
  711. }
  712. }
  713. intStringLen := int(stringLen)
  714. if intStringLen < 0 {
  715. return ErrInvalidLengthLog
  716. }
  717. postIndex := iNdEx + intStringLen
  718. if postIndex > l {
  719. return io.ErrUnexpectedEOF
  720. }
  721. s := string(data[iNdEx:postIndex])
  722. m.Reserved = &s
  723. iNdEx = postIndex
  724. case 3:
  725. if wireType != 2 {
  726. return fmt.Errorf("proto: wrong wireType = %d for field Topic", wireType)
  727. }
  728. var stringLen uint64
  729. for shift := uint(0); ; shift += 7 {
  730. if shift >= 64 {
  731. return ErrIntOverflowLog
  732. }
  733. if iNdEx >= l {
  734. return io.ErrUnexpectedEOF
  735. }
  736. b := data[iNdEx]
  737. iNdEx++
  738. stringLen |= (uint64(b) & 0x7F) << shift
  739. if b < 0x80 {
  740. break
  741. }
  742. }
  743. intStringLen := int(stringLen)
  744. if intStringLen < 0 {
  745. return ErrInvalidLengthLog
  746. }
  747. postIndex := iNdEx + intStringLen
  748. if postIndex > l {
  749. return io.ErrUnexpectedEOF
  750. }
  751. s := string(data[iNdEx:postIndex])
  752. m.Topic = &s
  753. iNdEx = postIndex
  754. case 4:
  755. if wireType != 2 {
  756. return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType)
  757. }
  758. var stringLen uint64
  759. for shift := uint(0); ; shift += 7 {
  760. if shift >= 64 {
  761. return ErrIntOverflowLog
  762. }
  763. if iNdEx >= l {
  764. return io.ErrUnexpectedEOF
  765. }
  766. b := data[iNdEx]
  767. iNdEx++
  768. stringLen |= (uint64(b) & 0x7F) << shift
  769. if b < 0x80 {
  770. break
  771. }
  772. }
  773. intStringLen := int(stringLen)
  774. if intStringLen < 0 {
  775. return ErrInvalidLengthLog
  776. }
  777. postIndex := iNdEx + intStringLen
  778. if postIndex > l {
  779. return io.ErrUnexpectedEOF
  780. }
  781. s := string(data[iNdEx:postIndex])
  782. m.Source = &s
  783. iNdEx = postIndex
  784. default:
  785. iNdEx = preIndex
  786. skippy, err := skipLog(data[iNdEx:])
  787. if err != nil {
  788. return err
  789. }
  790. if skippy < 0 {
  791. return ErrInvalidLengthLog
  792. }
  793. if (iNdEx + skippy) > l {
  794. return io.ErrUnexpectedEOF
  795. }
  796. m.XXXUnrecognized = append(m.XXXUnrecognized, data[iNdEx:iNdEx+skippy]...)
  797. iNdEx += skippy
  798. }
  799. }
  800. if iNdEx > l {
  801. return io.ErrUnexpectedEOF
  802. }
  803. return nil
  804. }
  805. // Unmarshal data to LogGroupList
  806. func (m *LogGroupList) Unmarshal(data []byte) error {
  807. l := len(data)
  808. iNdEx := 0
  809. for iNdEx < l {
  810. preIndex := iNdEx
  811. var wire uint64
  812. for shift := uint(0); ; shift += 7 {
  813. if shift >= 64 {
  814. return ErrIntOverflowLog
  815. }
  816. if iNdEx >= l {
  817. return io.ErrUnexpectedEOF
  818. }
  819. b := data[iNdEx]
  820. iNdEx++
  821. wire |= (uint64(b) & 0x7F) << shift
  822. if b < 0x80 {
  823. break
  824. }
  825. }
  826. fieldNum := int32(wire >> 3)
  827. wireType := int(wire & 0x7)
  828. if wireType == 4 {
  829. return fmt.Errorf("proto: LogGroupList: wiretype end group for non-group")
  830. }
  831. if fieldNum <= 0 {
  832. return fmt.Errorf("proto: LogGroupList: illegal tag %d (wire type %d)", fieldNum, wire)
  833. }
  834. switch fieldNum {
  835. case 1:
  836. if wireType != 2 {
  837. return fmt.Errorf("proto: wrong wireType = %d for field LogGroups", wireType)
  838. }
  839. var msglen int
  840. for shift := uint(0); ; shift += 7 {
  841. if shift >= 64 {
  842. return ErrIntOverflowLog
  843. }
  844. if iNdEx >= l {
  845. return io.ErrUnexpectedEOF
  846. }
  847. b := data[iNdEx]
  848. iNdEx++
  849. msglen |= (int(b) & 0x7F) << shift
  850. if b < 0x80 {
  851. break
  852. }
  853. }
  854. if msglen < 0 {
  855. return ErrInvalidLengthLog
  856. }
  857. postIndex := iNdEx + msglen
  858. if postIndex > l {
  859. return io.ErrUnexpectedEOF
  860. }
  861. m.LogGroups = append(m.LogGroups, &LogGroup{})
  862. if err := m.LogGroups[len(m.LogGroups)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
  863. return err
  864. }
  865. iNdEx = postIndex
  866. default:
  867. iNdEx = preIndex
  868. skippy, err := skipLog(data[iNdEx:])
  869. if err != nil {
  870. return err
  871. }
  872. if skippy < 0 {
  873. return ErrInvalidLengthLog
  874. }
  875. if (iNdEx + skippy) > l {
  876. return io.ErrUnexpectedEOF
  877. }
  878. m.XXXUnrecognized = append(m.XXXUnrecognized, data[iNdEx:iNdEx+skippy]...)
  879. iNdEx += skippy
  880. }
  881. }
  882. if iNdEx > l {
  883. return io.ErrUnexpectedEOF
  884. }
  885. return nil
  886. }
  887. func skipLog(data []byte) (n int, err error) {
  888. l := len(data)
  889. iNdEx := 0
  890. for iNdEx < l {
  891. var wire uint64
  892. for shift := uint(0); ; shift += 7 {
  893. if shift >= 64 {
  894. return 0, ErrIntOverflowLog
  895. }
  896. if iNdEx >= l {
  897. return 0, io.ErrUnexpectedEOF
  898. }
  899. b := data[iNdEx]
  900. iNdEx++
  901. wire |= (uint64(b) & 0x7F) << shift
  902. if b < 0x80 {
  903. break
  904. }
  905. }
  906. wireType := int(wire & 0x7)
  907. switch wireType {
  908. case 0:
  909. for shift := uint(0); ; shift += 7 {
  910. if shift >= 64 {
  911. return 0, ErrIntOverflowLog
  912. }
  913. if iNdEx >= l {
  914. return 0, io.ErrUnexpectedEOF
  915. }
  916. iNdEx++
  917. if data[iNdEx-1] < 0x80 {
  918. break
  919. }
  920. }
  921. return iNdEx, nil
  922. case 1:
  923. iNdEx += 8
  924. return iNdEx, nil
  925. case 2:
  926. var length int
  927. for shift := uint(0); ; shift += 7 {
  928. if shift >= 64 {
  929. return 0, ErrIntOverflowLog
  930. }
  931. if iNdEx >= l {
  932. return 0, io.ErrUnexpectedEOF
  933. }
  934. b := data[iNdEx]
  935. iNdEx++
  936. length |= (int(b) & 0x7F) << shift
  937. if b < 0x80 {
  938. break
  939. }
  940. }
  941. iNdEx += length
  942. if length < 0 {
  943. return 0, ErrInvalidLengthLog
  944. }
  945. return iNdEx, nil
  946. case 3:
  947. for {
  948. var innerWire uint64
  949. var start = iNdEx
  950. for shift := uint(0); ; shift += 7 {
  951. if shift >= 64 {
  952. return 0, ErrIntOverflowLog
  953. }
  954. if iNdEx >= l {
  955. return 0, io.ErrUnexpectedEOF
  956. }
  957. b := data[iNdEx]
  958. iNdEx++
  959. innerWire |= (uint64(b) & 0x7F) << shift
  960. if b < 0x80 {
  961. break
  962. }
  963. }
  964. innerWireType := int(innerWire & 0x7)
  965. if innerWireType == 4 {
  966. break
  967. }
  968. next, err := skipLog(data[start:])
  969. if err != nil {
  970. return 0, err
  971. }
  972. iNdEx = start + next
  973. }
  974. return iNdEx, nil
  975. case 4:
  976. return iNdEx, nil
  977. case 5:
  978. iNdEx += 4
  979. return iNdEx, nil
  980. default:
  981. return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
  982. }
  983. }
  984. panic("unreachable")
  985. }