/* * @Description: * @Version: 1.0 * @Autor: lishengyin * @Date: 2022-04-02 14:19:36 * @LastEditors: lishengyin * @LastEditTime: 2022-04-18 17:25:25 */ #ifndef __SECTORPOWER_HPP_ #define __SECTORPOWER_HPP_ #include #include "ins_base.hpp" #include #include #include #include #include #include "Util/logger.h" #include "Util/NoticeCenter.h" #include "TaskCenter.hpp" using namespace std; using namespace toolkit; namespace ins { /** * @description: sectorPower 权力部门 */ class Sectorpower:public Module { private: Sectorpower(); public: using Ptr = std::shared_ptr; ~Sectorpower(){this->Destroy();} /** * @description: 获取ptr * @param {*} * @return {*} */ static std::shared_ptr getPtr(); /** * @description: 初始化 * @param {*} * @return {*} */ int8_t Init() override; /** * @description: 释放 * @param {*} * @return {*} */ void Destroy() override; /** * @description: 是否正常 * @param {*} * @return {*} */ bool isNormally() override{ return true; } /** * @description: 检查任务 * @param {*} * @return {*} */ bool reviewTask(ins::InsTask::Ptr& task); /** * @description: 获取工作流任务 * @param {*} * @return {*} */ InsTask::Ptr getWorkflowTask(InsPacket::Ptr pack); /** * @description: 业务入队 * @param {*} * @return {*} */ int8_t enqueue(InsPacket::Ptr packet); protected: mutex m_mutex; condition_variable condition; bool stop = false; vector workers; queue Transactions; }; } // namespace name #endif