Removed unused template parameter from network stack.
Reviewers: mislav.bradac, buda Reviewed By: buda Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D632
This commit is contained in:
parent
d750970381
commit
7939b04117
@ -30,14 +30,12 @@ namespace communication {
|
||||
* @tparam Session the server can handle different Sessions, each session
|
||||
* represents a different protocol so the same network infrastructure
|
||||
* can be used for handling different protocols
|
||||
* @tparam OutputStream the server has to get the output stream as a template
|
||||
parameter because the output stream is templated
|
||||
* @tparam Socket the input/output socket that should be used
|
||||
* @tparam SessionData the class with objects that will be forwarded to the session
|
||||
*/
|
||||
template <typename Session, typename OutputStream, typename Socket, typename SessionData>
|
||||
template <typename Session, typename Socket, typename SessionData>
|
||||
class Server
|
||||
: public io::network::EventListener<Server<Session, OutputStream, Socket, SessionData>> {
|
||||
: public io::network::EventListener<Server<Session, Socket, SessionData>> {
|
||||
using Event = io::network::Epoll::Event;
|
||||
|
||||
public:
|
||||
@ -58,7 +56,7 @@ class Server
|
||||
workers_.reserve(n);
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
workers_.push_back(
|
||||
std::make_unique<Worker<Session, OutputStream, Socket, SessionData>>(
|
||||
std::make_unique<Worker<Session, Socket, SessionData>>(
|
||||
session_data_));
|
||||
workers_.back()->Start(alive_);
|
||||
}
|
||||
@ -110,7 +108,7 @@ class Server
|
||||
void OnErrorEvent(Event &event) { close(event.data.fd); }
|
||||
|
||||
private:
|
||||
std::vector<typename Worker<Session, OutputStream, Socket, SessionData>::uptr> workers_;
|
||||
std::vector<typename Worker<Session, Socket, SessionData>::uptr> workers_;
|
||||
std::atomic<bool> alive_{true};
|
||||
int idx_{0};
|
||||
|
||||
|
@ -26,20 +26,18 @@ namespace communication {
|
||||
* @tparam Session the worker can handle different Sessions, each session
|
||||
* represents a different protocol so the same network infrastructure
|
||||
* can be used for handling different protocols
|
||||
* @tparam OutputStream the worker has to get the output stream as a template
|
||||
parameter because the output stream is templated
|
||||
* @tparam Socket the input/output socket that should be used
|
||||
* @tparam SessionData the class with objects that will be forwarded to the session
|
||||
*/
|
||||
template <typename Session, typename OutputStream, typename Socket, typename SessionData>
|
||||
template <typename Session, typename Socket, typename SessionData>
|
||||
class Worker
|
||||
|
||||
: public io::network::StreamReader<Worker<Session, OutputStream, Socket, SessionData>,
|
||||
: public io::network::StreamReader<Worker<Session, Socket, SessionData>,
|
||||
Session> {
|
||||
using StreamBuffer = io::network::StreamBuffer;
|
||||
|
||||
public:
|
||||
using uptr = std::unique_ptr<Worker<Session, OutputStream, Socket, SessionData>>;
|
||||
using uptr = std::unique_ptr<Worker<Session, Socket, SessionData>>;
|
||||
|
||||
Worker(SessionData &session_data) : session_data_(session_data) {}
|
||||
|
||||
|
@ -25,7 +25,7 @@ using result_stream_t =
|
||||
communication::bolt::ChunkedEncoderBuffer<socket_t>>>;
|
||||
using session_data_t = communication::bolt::SessionData<result_stream_t>;
|
||||
using bolt_server_t =
|
||||
communication::Server<session_t, result_stream_t, socket_t, session_data_t>;
|
||||
communication::Server<session_t, socket_t, session_data_t>;
|
||||
|
||||
DEFINE_string(interface, "0.0.0.0", "Default interface on which to listen.");
|
||||
DEFINE_string(port, "7687", "Default port on which to listen.");
|
||||
|
@ -21,8 +21,6 @@ static constexpr const int REPLY = 10;
|
||||
using endpoint_t = io::network::NetworkEndpoint;
|
||||
using socket_t = io::network::Socket;
|
||||
|
||||
class TestOutputStream {};
|
||||
|
||||
class TestData {};
|
||||
|
||||
class TestSession {
|
||||
@ -64,8 +62,7 @@ class TestSession {
|
||||
io::network::Epoll::Event event_;
|
||||
};
|
||||
|
||||
using test_server_t =
|
||||
communication::Server<TestSession, TestOutputStream, socket_t, TestData>;
|
||||
using test_server_t = communication::Server<TestSession, socket_t, TestData>;
|
||||
|
||||
void server_start(void *serverptr, int num) {
|
||||
((test_server_t *)serverptr)->Start(num);
|
||||
|
@ -23,8 +23,6 @@ static constexpr const char interface[] = "127.0.0.1";
|
||||
using endpoint_t = io::network::NetworkEndpoint;
|
||||
using socket_t = io::network::Socket;
|
||||
|
||||
class TestOutputStream {};
|
||||
|
||||
class TestData {};
|
||||
|
||||
class TestSession {
|
||||
@ -51,8 +49,7 @@ class TestSession {
|
||||
io::network::Epoll::Event event_;
|
||||
};
|
||||
|
||||
using test_server_t =
|
||||
communication::Server<TestSession, TestOutputStream, socket_t, TestData>;
|
||||
using test_server_t = communication::Server<TestSession, socket_t, TestData>;
|
||||
|
||||
test_server_t *serverptr;
|
||||
std::atomic<bool> run{true};
|
||||
|
Loading…
Reference in New Issue
Block a user