64 static std::shared_ptr<DBServer_PostgreSQL>
init_dbserver(
int argc,
const char*
const* argv,
const std::shared_ptr<uniset::SharedMemory>& ic =
nullptr,
const std::string& prefix =
"pgsql" );
67 static void help_print(
int argc,
const char*
const* argv );
69 inline std::shared_ptr<LogAgregator> logAggregator()
73 inline std::shared_ptr<DebugStream> log()
78 bool isConnectOk()
const;
80 static constexpr std::string_view tblcols = {
"date,time,time_usec,sensor_id,value,node" };
83 typedef std::unordered_map<int, std::string> DBTableMap;
85 virtual void initDBServer()
override;
86 virtual void onReconnect( std::unique_ptr<PostgreSQLInterface>& db ) {};
94 virtual std::string getMonitInfo(
const std::string& params )
override;
96 bool writeToBase(
const std::string& query );
98 inline std::string tblName(
int key)
111 std::unique_ptr<PostgreSQLInterface> db;
112 typedef std::queue<std::string> QueryBuffer;
118 typedef std::vector<PostgreSQLInterface::Record> InsertBuffer;
119 void flushInsertBuffer();
120 virtual void addRecord(
const PostgreSQLInterface::Record&& rec );
121 virtual bool writeInsertBufferToDB(
const std::string& table
122 , std::string_view colname
123 ,
const InsertBuffer& ibuf );
128 int PingTime = { 15000 };
129 int ReconnectTime = { 30000 };
131 bool connect_ok = {
false };
134 size_t qbufSize = { 200 };
135 bool lastRemove = {
false };
139 size_t ibufSize = { 0 };
140 size_t ibufMaxSize = { 2000 };
141 timeout_t ibufSyncTimeout = { 15000 };
142 float ibufOverflowCleanFactor = { 0.5 };
The DBServer_PostgreSQL class Реализация работы с PostgreSQL. Т.к. основная работа сервера - это част...
Definition DBServer_PostgreSQL.h:57
Timers
Definition DBServer_PostgreSQL.h:104
@ FlushInsertBuffer
Definition DBServer_PostgreSQL.h:107
@ PingTimer
Definition DBServer_PostgreSQL.h:105
@ ReconnectTimer
Definition DBServer_PostgreSQL.h:106
virtual bool deactivateObject() override
Деактивация объекта (переопределяется для необходимых действий при завершении работы)
Definition DBServer_PostgreSQL.cc:454
static std::shared_ptr< DBServer_PostgreSQL > init_dbserver(int argc, const char *const *argv, const std::shared_ptr< uniset::SharedMemory > &ic=nullptr, const std::string &prefix="pgsql")
Definition DBServer_PostgreSQL.cc:493
static void help_print(int argc, const char *const *argv)
Definition DBServer_PostgreSQL.cc:522
Definition MessageType.h:283