2020-05-30 17:04:02 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-05-30 20:02:11 +00:00
|
|
|
#include <atomic>
|
|
|
|
#include <memory>
|
|
|
|
#include <Server/IServer.h>
|
2021-10-22 07:15:34 +00:00
|
|
|
#include <Server/TCPServerConnectionFactory.h>
|
2020-05-30 17:04:02 +00:00
|
|
|
#include <Core/PostgreSQLProtocol.h>
|
2022-09-28 08:45:15 +00:00
|
|
|
#include "config.h"
|
2021-11-01 14:03:20 +00:00
|
|
|
|
2020-05-30 17:04:02 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2021-10-22 07:15:34 +00:00
|
|
|
class PostgreSQLHandlerFactory : public TCPServerConnectionFactory
|
2020-05-30 17:04:02 +00:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
IServer & server;
|
2024-01-23 17:04:50 +00:00
|
|
|
LoggerPtr log;
|
2024-01-03 16:47:15 +00:00
|
|
|
ProfileEvents::Event read_event;
|
|
|
|
ProfileEvents::Event write_event;
|
2020-06-08 12:05:49 +00:00
|
|
|
|
|
|
|
#if USE_SSL
|
2020-05-30 17:04:02 +00:00
|
|
|
bool ssl_enabled = true;
|
|
|
|
#else
|
|
|
|
bool ssl_enabled = false;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
std::atomic<Int32> last_connection_id = 0;
|
|
|
|
std::vector<std::shared_ptr<PostgreSQLProtocol::PGAuthentication::AuthenticationMethod>> auth_methods;
|
|
|
|
|
|
|
|
public:
|
2024-01-03 16:47:15 +00:00
|
|
|
explicit PostgreSQLHandlerFactory(IServer & server_, const ProfileEvents::Event & read_event_ = ProfileEvents::end(), const ProfileEvents::Event & write_event_ = ProfileEvents::end());
|
2020-05-30 17:04:02 +00:00
|
|
|
|
2021-10-22 07:15:34 +00:00
|
|
|
Poco::Net::TCPServerConnection * createConnection(const Poco::Net::StreamSocket & socket, TCPServer & server) override;
|
2020-05-30 17:04:02 +00:00
|
|
|
};
|
|
|
|
}
|