lintel
0.2.0
Loading...
Searching...
No Matches
src
include
lintel
core
persistence
postgresql
Notify.h
Go to the documentation of this file.
1
#ifndef LINTEL_POSTGRESQL_NOTIFY_H
2
#define LINTEL_POSTGRESQL_NOTIFY_H
3
4
#include <libpq-fe.h>
5
6
#include <atomic>
7
#include <chrono>
8
#include <functional>
9
#include <string>
10
#include <thread>
11
12
#include "
Connection.h
"
13
14
namespace
lintel
{
15
namespace
postgresql {
22
class
Notify
23
{
24
private
:
25
static
constexpr
int32_t
kTimeoutSeconds = 1;
26
std::atomic<bool> m_shutdown =
false
;
27
Connection
&m_connection;
28
PGconn
*m_conn =
nullptr
;
29
std::thread m_thread;
30
31
std::string m_tableName;
32
std::function<
void
()> m_callBack;
34
std::chrono::seconds m_timeout{ kTimeoutSeconds };
35
37
void
run();
38
40
void
listen();
41
42
public
:
49
explicit
Notify
(
Connection
&connection, std::string
tableName
, std::function<
void
()> &callBack);
50
52
~Notify
();
53
};
54
}
// namespace postgresql
55
56
}
// namespace lintel
57
#endif
// LINTEL_POSTGRESQL_NOTIFY_H
lintel::postgresql::Connection
Definition
Connection.h:31
lintel::postgresql::Notify
Definition
Notify.h:23
lintel::postgresql::Notify::~Notify
~Notify()
lintel::postgresql::Notify::Notify
Notify(Connection &connection, std::string tableName, std::function< void()> &callBack)
lintel
Definition
BaseFeature.h:6
lintel::type_name
constexpr std::string_view type_name()
Definition
TypeName.h:9
Connection.h
Generated by
1.9.8