GetCenter.hpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * @Description: 数据中心
  3. * @Version: 1.0
  4. * @Autor: lishengyin
  5. * @Date: 2022-04-02 13:58:46
  6. * @LastEditors: lishengyin
  7. * @LastEditTime: 2022-04-26 17:02:23
  8. */
  9. #ifndef __GETCENTER_HPP_
  10. #define __GETCENTER_HPP_
  11. #include <iostream>
  12. #include "Util/logger.h"
  13. #include "Util/NoticeCenter.h"
  14. #include "Poller/EventPoller.h"
  15. #include "Util/SqlPool.h"
  16. #include "Network/TcpClient.h"
  17. #include "Poller/Timer.h"
  18. #include "ins_base.hpp"
  19. #include "dataTypeList.hpp"
  20. #include "requests.h"
  21. #include "axios.h"
  22. using namespace std;
  23. using namespace toolkit;
  24. using namespace hv;
  25. namespace ins{
  26. class GetCenter:public Module
  27. {
  28. private:
  29. GetCenter() : Module("GetCenter"){
  30. Init();
  31. }
  32. public:
  33. using Ptr = std::shared_ptr<GetCenter>;
  34. ~GetCenter(){this->Destroy();}
  35. /**
  36. * @description: 初始化
  37. * @param {*}
  38. * @return {*}
  39. */
  40. int8_t Init() override;
  41. /**
  42. * @description: 释放资源
  43. * @param {*}
  44. * @return {*}
  45. */
  46. void Destroy() override;
  47. /**
  48. * @description: 创建新的实例
  49. * @param {*}
  50. * @return {*}
  51. */
  52. static std::shared_ptr<GetCenter> CreateNew();
  53. /**
  54. * @description: 获取ptr
  55. * @param {*}
  56. * @return {*}
  57. */
  58. static std::shared_ptr<GetCenter> getPtr();
  59. /**
  60. * @description: 获取服务
  61. * @param {*}
  62. * @return {*}
  63. */
  64. bool getKsServices();
  65. /**
  66. * @description: 获取Ks Pods
  67. * @param {*}
  68. * @return {*}
  69. */
  70. bool getKsPods();
  71. /**
  72. * @description: 获取ksNodes
  73. * @param {*}
  74. * @return {*}
  75. */
  76. bool getKsNodes();
  77. /**
  78. * @description: 获取KsToken
  79. * @param {*}
  80. * @return {*}
  81. */
  82. bool getKsToken();
  83. /**
  84. * @description: 获取apollo的列表
  85. * @param {*}
  86. * @return {*}
  87. */
  88. bool getApolloList();
  89. /**
  90. * @description:
  91. * @param {*}
  92. * @return {*}
  93. */
  94. vector<vector<std::string>> ExecuteSql(std::string& sql);
  95. // describe
  96. /**
  97. * @description: 是否正常
  98. * @param {*}
  99. * @return {*}
  100. */
  101. bool isNormally() override{
  102. return true;
  103. }
  104. // DESCRIPTION
  105. };
  106. };
  107. #endif