Covalent Bond  0.0.1-alpha
'covalent bond' is a data middle office. As a 2022-2023 Fall SWE final project.
pipeline.hpp
Go to the documentation of this file.
1 
11 #ifndef __SERVER_PIPELINE_HPP_
12 #define __SERVER_PIPELINE_HPP_
13 
14 #ifdef _WIN32
15 #if _MSC_VER > 1000
16 #pragma once
17 #endif
18 #endif
19 
20 #if defined(__unix__) && defined(__clang__)
21 #pragma once
22 #endif
23 
24 #include <workflow/WFGraphTask.h>
25 #include <workflow/WFTaskFactory.h>
26 
27 #include "cbWebserver.hpp"
28 #include "cbRestfulHttpServer.hpp"
29 #include "task/cbComputeGraph.hpp"
31 
32 namespace cb {
33 namespace pipeline {
34 
36  public:
38  graphContainer(int32_t n);
39  graphContainer(graphContainer&) = delete;
40  graphContainer(const graphContainer&) = delete;
42  graphContainer operator=(const graphContainer&) = delete;
43 
50 
57  graph::cbComputeGraph* getGraph(int32_t idx);
58 
63  void execMain();
64 
70  void setTerminated(bool enable);
71 
77  size_t nums();
78 
79  private:
80  bool m_isTerminated = false;
81  std::vector<graph::cbComputeGraph*> m_graphs;
82  int32_t m_loopTime = 10;
83 };
84 
85 struct appCfg {
86  unsigned short webPort;
87  const char* webRoot;
88  unsigned short rHttpPort;
89  int32_t graphExecSec;
90  const char* redisHost;
91  const char* redisPassword;
92  const char* redisPort;
93  int32_t redisDBNum = 1;
94  bool redisSSL = false;
95 };
96 
97 class app {
98  public:
99  app(const appCfg& cfg);
100 
105  void initRHttp();
106 
111  void execMain();
112 
117  void stopMain();
118 
119  private:
124 };
125 
126 } // namespace pipeline
127 } // namespace cb
128 
129 #endif
cb::pipeline::appCfg::redisPort
const char * redisPort
Definition: pipeline.hpp:92
cb::graph::cbComputeGraph
Definition: cbComputeGraph.hpp:342
cb::pipeline::app::m_graphs
graphContainer m_graphs
Definition: pipeline.hpp:120
cb::utils::cbRestfulHttpServer
Definition: cbRestfulHttpServer.hpp:35
cb::pipeline::appCfg::rHttpPort
unsigned short rHttpPort
Definition: pipeline.hpp:88
cb::pipeline::app::app
app(const appCfg &cfg)
Definition: pipeline.cpp:60
cb::pipeline::app
Definition: pipeline.hpp:97
cb::pipeline::graphContainer::setTerminated
void setTerminated(bool enable)
Set the Terminated object.
Definition: pipeline.cpp:56
cb::pipeline::graphContainer::addGraph
void addGraph(graph::cbComputeGraph *g)
Definition: pipeline.cpp:17
cb::pipeline::graphContainer::m_graphs
std::vector< graph::cbComputeGraph * > m_graphs
Definition: pipeline.hpp:81
cb::pipeline::graphContainer::graphContainer
graphContainer(int32_t n)
Definition: pipeline.cpp:11
cb::pipeline::graphContainer::m_loopTime
int32_t m_loopTime
Definition: pipeline.hpp:82
cb::pipeline::appCfg
Definition: pipeline.hpp:85
cb::pipeline::graphContainer::m_isTerminated
bool m_isTerminated
Definition: pipeline.hpp:80
cb::pipeline::app::initRHttp
void initRHttp()
Definition: pipeline.cpp:70
cb::pipeline::appCfg::redisDBNum
int32_t redisDBNum
Definition: pipeline.hpp:93
cb
_WIN32
Definition: api.cpp:4
cb::pipeline::graphContainer::nums
size_t nums()
Definition: pipeline.cpp:58
cb::pipeline::appCfg::webRoot
const char * webRoot
Definition: pipeline.hpp:87
cb::pipeline::graphContainer::execMain
void execMain()
Definition: pipeline.cpp:26
cbWebserver.hpp
cb::pipeline::graphContainer
Definition: pipeline.hpp:35
cb::pipeline::appCfg::redisHost
const char * redisHost
Definition: pipeline.hpp:90
cb::pipeline::appCfg::redisPassword
const char * redisPassword
Definition: pipeline.hpp:91
cb::utils::cbWebserver
Definition: cbWebserver.hpp:50
cb::pipeline::appCfg::webPort
unsigned short webPort
Definition: pipeline.hpp:86
cbComputeGraph.hpp
The compute graph(DAG), a prepared graph for task flow to execute. It works as a state machine.
trivial::cbVirtualDeviceManager
Definition: cbVirtualDevice.hpp:260
cbVirtualDevice.hpp
abstract virtual device. Provide MySql/Redis/Kafka warper. All virtual device will handle the connect...
cb::pipeline::graphContainer::operator=
graphContainer operator=(graphContainer &)=delete
cb::pipeline::appCfg::graphExecSec
int32_t graphExecSec
Definition: pipeline.hpp:89
cb::pipeline::app::execMain
void execMain()
Definition: pipeline.cpp:246
cb::pipeline::graphContainer::getGraph
graph::cbComputeGraph * getGraph(int32_t idx)
Get the Graph object.
Definition: pipeline.cpp:19
cb::pipeline::appCfg::redisSSL
bool redisSSL
Definition: pipeline.hpp:94
cb::pipeline::graphContainer::~graphContainer
~graphContainer()
Definition: pipeline.cpp:13
cb::pipeline::app::m_web
utils::cbWebserver m_web
Definition: pipeline.hpp:121
cbRestfulHttpServer.hpp
A restful api like http server for programming post and get conveniently.
cb::pipeline::app::m_VDM
trivial::cbVirtualDeviceManager m_VDM
Definition: pipeline.hpp:123
cb::pipeline::app::stopMain
void stopMain()
Definition: pipeline.cpp:256
cb::pipeline::app::m_rHttp
utils::cbRestfulHttpServer m_rHttp
Definition: pipeline.hpp:122