Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
impala::ThriftClient< InterfaceType > Class Template Reference

#include <thrift-client.h>

Inheritance diagram for impala::ThriftClient< InterfaceType >:
Collaboration diagram for impala::ThriftClient< InterfaceType >:

Public Member Functions

 ThriftClient (const std::string &ipaddress, int port, const std::string &service_name="", AuthProvider *auth_provider=NULL, bool ssl=false)
 
InterfaceType * iface ()
 Returns the object used to actually make RPCs against the remote server. More...
 
const TNetworkAddress & address () const
 
Status Open ()
 
Status OpenWithRetry (uint32_t num_retries, uint64_t wait_ms)
 
void Close ()
 Close the connection with the remote server. May be called repeatedly. More...
 
void setRecvTimeout (int32_t ms)
 Set receive timeout on the underlying TSocket. More...
 
void setSendTimeout (int32_t ms)
 Set send timeout on the underlying TSocket. More...
 

Protected Member Functions

Status CreateSocket ()
 

Protected Attributes

TNetworkAddress address_
 Address of the server this client communicates with. More...
 
bool ssl_
 True if ssl encryption is enabled on this connection. More...
 
Status socket_create_status_
 
boost::shared_ptr< sasl::TSaslsasl_client_
 
boost::shared_ptr
< apache::thrift::transport::TSocket > 
socket_
 All shared pointers, because Thrift requires them to be. More...
 
boost::shared_ptr
< apache::thrift::transport::TTransport > 
transport_
 
boost::shared_ptr
< apache::thrift::protocol::TBinaryProtocol > 
protocol_
 

Private Attributes

boost::shared_ptr< InterfaceType > iface_
 
AuthProviderauth_provider_
 

Detailed Description

template<class InterfaceType>
class impala::ThriftClient< InterfaceType >

Utility client to a Thrift server. The parameter type is the Thrift interface type that the server implements. TODO: Consider a builder class to make constructing this class easier.

Definition at line 100 of file thrift-client.h.

Constructor & Destructor Documentation

template<class InterfaceType >
impala::ThriftClient< InterfaceType >::ThriftClient ( const std::string &  ipaddress,
int  port,
const std::string &  service_name = "",
AuthProvider auth_provider = NULL,
bool  ssl = false 
)

Creates, but does not connect, a new ThriftClient for a remote server.

  • ipaddress: address of remote server
  • port: port on which remote service runs
  • service_name: If set, the target service to connect to.
  • auth_provider: Authentication scheme to use. If NULL, use the global default client<->demon authentication scheme.
  • ssl: if true, SSL is enabled on this connection

Definition at line 123 of file thrift-client.h.

References impala::ThriftClientImpl::address_, impala::ThriftClient< InterfaceType >::auth_provider_, impala::AuthManager::GetInstance(), impala::AuthManager::GetInternalAuthProvider(), impala::ThriftClient< InterfaceType >::iface_, impala::ThriftClientImpl::protocol_, impala::ThriftClientImpl::socket_, impala::ThriftClientImpl::transport_, and impala::AuthProvider::WrapClientTransport().

Member Function Documentation

const TNetworkAddress& impala::ThriftClientImpl::address ( ) const
inlineinherited

Definition at line 48 of file thrift-client.h.

References impala::ThriftClientImpl::address_.

void impala::ThriftClientImpl::Close ( )
inherited

Close the connection with the remote server. May be called repeatedly.

Definition at line 69 of file thrift-client.cc.

Referenced by impala::ThriftClientImpl::~ThriftClientImpl().

Status impala::ThriftClientImpl::CreateSocket ( )
protectedinherited

Create a new socket without opening it. Returns an error if the socket could not be created.

Definition at line 86 of file thrift-client.cc.

References impala::OK.

Referenced by impala::ThriftClientImpl::ThriftClientImpl().

template<class InterfaceType>
InterfaceType* impala::ThriftClient< InterfaceType >::iface ( )
inline

Returns the object used to actually make RPCs against the remote server.

Definition at line 114 of file thrift-client.h.

References impala::ThriftClient< InterfaceType >::iface_.

Referenced by main(), impala::ClientCache< T >::MakeClient(), and Send().

Status impala::ThriftClientImpl::Open ( )
inherited

Open the connection to the remote server. May be called repeatedly, is idempotent unless there is a failure to connect.

Definition at line 35 of file thrift-client.cc.

References impala::OK.

Referenced by HandleBroadcast(), HandleSend(), and main().

Status impala::ThriftClientImpl::OpenWithRetry ( uint32_t  num_retries,
uint64_t  wait_ms 
)
inherited

Retry the Open num_retries time waiting wait_ms milliseconds between retries. If num_retries == 0, the connection is retried indefinitely.

Definition at line 48 of file thrift-client.cc.

References impala::Status::ok(), and impala::SleepForMs().

void impala::ThriftClientImpl::setRecvTimeout ( int32_t  ms)
inlineinherited

Set receive timeout on the underlying TSocket.

Definition at line 62 of file thrift-client.h.

References impala::ThriftClientImpl::socket_.

void impala::ThriftClientImpl::setSendTimeout ( int32_t  ms)
inlineinherited

Set send timeout on the underlying TSocket.

Definition at line 65 of file thrift-client.h.

References impala::ThriftClientImpl::socket_.

Member Data Documentation

TNetworkAddress impala::ThriftClientImpl::address_
protectedinherited

Address of the server this client communicates with.

Definition at line 78 of file thrift-client.h.

Referenced by impala::ThriftClientImpl::address(), and impala::ThriftClient< InterfaceType >::ThriftClient().

template<class InterfaceType>
AuthProvider* impala::ThriftClient< InterfaceType >::auth_provider_
private
template<class InterfaceType>
boost::shared_ptr<InterfaceType> impala::ThriftClient< InterfaceType >::iface_
private
boost::shared_ptr<apache::thrift::protocol::TBinaryProtocol> impala::ThriftClientImpl::protocol_
protectedinherited

Definition at line 92 of file thrift-client.h.

Referenced by impala::ThriftClient< InterfaceType >::ThriftClient().

boost::shared_ptr<sasl::TSasl> impala::ThriftClientImpl::sasl_client_
protectedinherited

Sasl Client object. Contains client kerberos identification data. Will be NULL if kerberos is not being used.

Definition at line 87 of file thrift-client.h.

boost::shared_ptr<apache::thrift::transport::TSocket> impala::ThriftClientImpl::socket_
protectedinherited

All shared pointers, because Thrift requires them to be.

Definition at line 90 of file thrift-client.h.

Referenced by impala::ThriftClientImpl::setRecvTimeout(), impala::ThriftClientImpl::setSendTimeout(), and impala::ThriftClient< InterfaceType >::ThriftClient().

Status impala::ThriftClientImpl::socket_create_status_
protectedinherited

Definition at line 83 of file thrift-client.h.

Referenced by impala::ThriftClientImpl::ThriftClientImpl().

bool impala::ThriftClientImpl::ssl_
protectedinherited

True if ssl encryption is enabled on this connection.

Definition at line 81 of file thrift-client.h.

boost::shared_ptr<apache::thrift::transport::TTransport> impala::ThriftClientImpl::transport_
protectedinherited

Definition at line 91 of file thrift-client.h.

Referenced by impala::ThriftClient< InterfaceType >::ThriftClient().


The documentation for this class was generated from the following file: