Files
scylladb/thrift/server.hh
Paweł Dziepak 002d2bc353 thrift: pass query_processor to the thrift handler
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2016-06-27 15:24:27 +02:00

78 lines
2.2 KiB
C++

/*
* Copyright (C) 2014 ScyllaDB
*/
/*
* This file is part of Scylla.
*
* Scylla is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Scylla is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Scylla. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef APPS_SEASTAR_THRIFT_SERVER_HH_
#define APPS_SEASTAR_THRIFT_SERVER_HH_
#include "core/reactor.hh"
#include "core/distributed.hh"
#include "cql3/query_processor.hh"
#include <memory>
#include <cstdint>
class thrift_server;
class thrift_stats;
class database;
namespace org { namespace apache { namespace cassandra {
static const sstring thrift_version = "20.1.0";
class CassandraCobSvIfFactory;
}}}
namespace apache { namespace thrift { namespace protocol {
class TProtocolFactory;
}}}
namespace apache { namespace thrift { namespace async {
class TAsyncProcessorFactory;
}}}
class thrift_server {
std::vector<server_socket> _listeners;
std::unique_ptr<thrift_stats> _stats;
boost::shared_ptr<org::apache::cassandra::CassandraCobSvIfFactory> _handler_factory;
std::unique_ptr<apache::thrift::protocol::TProtocolFactory> _protocol_factory;
boost::shared_ptr<apache::thrift::async::TAsyncProcessorFactory> _processor_factory;
uint64_t _total_connections = 0;
uint64_t _current_connections = 0;
uint64_t _requests_served = 0;
public:
thrift_server(distributed<database>& db, distributed<cql3::query_processor>& qp);
~thrift_server();
future<> listen(ipv4_addr addr, bool keepalive);
future<> stop();
void do_accepts(int which, bool keepalive);
class connection;
uint64_t total_connections() const;
uint64_t current_connections() const;
uint64_t requests_served() const;
};
#endif /* APPS_SEASTAR_THRIFT_SERVER_HH_ */