16 #ifndef IMPALA_RPC_THRIFT_CLIENT_H
17 #define IMPALA_RPC_THRIFT_CLIENT_H
21 #include <boost/shared_ptr.hpp>
23 #include <thrift/Thrift.h>
24 #include <thrift/transport/TSocket.h>
25 #include <thrift/transport/TSSLSocket.h>
26 #include <thrift/transport/TBufferTransports.h>
27 #include <thrift/protocol/TBinaryProtocol.h>
29 #include <gflags/gflags.h>
35 #include "gen-cpp/Types_types.h"
90 boost::shared_ptr<apache::thrift::transport::TSocket>
socket_;
91 boost::shared_ptr<apache::thrift::transport::TTransport>
transport_;
92 boost::shared_ptr<apache::thrift::protocol::TBinaryProtocol>
protocol_;
99 template <
class InterfaceType>
110 const std::string& service_name =
"",
AuthProvider* auth_provider = NULL,
122 template <
class InterfaceType>
124 const std::string& service_name,
127 iface_(new InterfaceType(protocol_)),
128 auth_provider_(auth_provider) {
DECLARE_string(principal)
bool ssl_
True if ssl encryption is enabled on this connection.
virtual Status WrapClientTransport(const std::string &hostname, boost::shared_ptr< apache::thrift::transport::TTransport > raw_transport, const std::string &service_name, boost::shared_ptr< apache::thrift::transport::TTransport > *wrapped_transport)=0
boost::shared_ptr< apache::thrift::transport::TSocket > socket_
All shared pointers, because Thrift requires them to be.
AuthProvider * GetInternalAuthProvider()
boost::shared_ptr< apache::thrift::transport::TTransport > transport_
InterfaceType * iface()
Returns the object used to actually make RPCs against the remote server.
AuthProvider * auth_provider_
TNetworkAddress MakeNetworkAddress(const string &hostname, int port)
ThriftClientImpl(const std::string &ipaddress, int port, bool ssl)
Status socket_create_status_
void setSendTimeout(int32_t ms)
Set send timeout on the underlying TSocket.
boost::shared_ptr< InterfaceType > iface_
TNetworkAddress address_
Address of the server this client communicates with.
Status OpenWithRetry(uint32_t num_retries, uint64_t wait_ms)
boost::shared_ptr< sasl::TSasl > sasl_client_
Super class for templatized thrift clients.
static AuthManager * GetInstance()
boost::shared_ptr< apache::thrift::protocol::TBinaryProtocol > protocol_
const TNetworkAddress & address() const
ThriftClient(const std::string &ipaddress, int port, const std::string &service_name="", AuthProvider *auth_provider=NULL, bool ssl=false)
void Close()
Close the connection with the remote server. May be called repeatedly.
void setRecvTimeout(int32_t ms)
Set receive timeout on the underlying TSocket.