xapian-core  1.4.25
Public Member Functions | Private Member Functions | Static Private Member Functions | List of all members
RemoteTcpClient Class Reference

TCP/IP socket based RemoteDatabase implementation. More...

#include <remotetcpclient.h>

+ Inheritance diagram for RemoteTcpClient:
+ Collaboration diagram for RemoteTcpClient:

Public Member Functions

 RemoteTcpClient (const std::string &hostname, int port, double timeout_, double timeout_connect, bool writable, int flags)
 Constructor. More...
 
 ~RemoteTcpClient ()
 Destructor. More...
 

Private Member Functions

void operator= (const RemoteTcpClient &)
 Don't allow assignment. More...
 
 RemoteTcpClient (const RemoteTcpClient &)
 Don't allow copying. More...
 

Static Private Member Functions

static int open_socket (const std::string &hostname, int port, double timeout_connect)
 Attempt to open a TCP/IP socket connection to xapian-tcpsrv. More...
 
static std::string get_tcpcontext (const std::string &hostname, int port)
 Get a context string for use when constructing Xapian::NetworkError. More...
 

Detailed Description

TCP/IP socket based RemoteDatabase implementation.

Connects via TCP/IP to an instance of xapian-tcpsrv.

Definition at line 36 of file remotetcpclient.h.

Constructor & Destructor Documentation

◆ RemoteTcpClient() [1/2]

RemoteTcpClient::RemoteTcpClient ( const RemoteTcpClient )
private

Don't allow copying.

◆ RemoteTcpClient() [2/2]

RemoteTcpClient::RemoteTcpClient ( const std::string &  hostname,
int  port,
double  timeout_,
double  timeout_connect,
bool  writable,
int  flags 
)
inline

Constructor.

Attempts to open a TCP/IP connection to xapian-tcpsrv running on port port of host hostname.

Parameters
timeout_connectTimeout for trying to connect (in seconds).
timeoutTimeout during communication after successfully connecting (in seconds).
writableIs this a WritableDatabase?
flagsXapian::DB_RETRY_LOCK or 0.

Definition at line 76 of file remotetcpclient.h.

References ~RemoteTcpClient().

◆ ~RemoteTcpClient()

RemoteTcpClient::~RemoteTcpClient ( )

Destructor.

Definition at line 59 of file remotetcpclient.cc.

Referenced by RemoteTcpClient().

Member Function Documentation

◆ get_tcpcontext()

string RemoteTcpClient::get_tcpcontext ( const std::string &  hostname,
int  port 
)
staticprivate

Get a context string for use when constructing Xapian::NetworkError.

Note: this method is used from constructors so has been made static to avoid problems with trying to use uninitialised member variables. In particular, it can't be made a virtual method of the base class.

Definition at line 49 of file remotetcpclient.cc.

References Xapian::Internal::str().

◆ open_socket()

int RemoteTcpClient::open_socket ( const std::string &  hostname,
int  port,
double  timeout_connect 
)
staticprivate

Attempt to open a TCP/IP socket connection to xapian-tcpsrv.

Connect to xapian-tcpsrv running on port port of host hostname. Give up trying to connect after timeout_connect seconds.

Note: this method is called early on during class construction before any member variables or even the base class have been initialised. To help avoid accidentally trying to use member variables or call other methods which do, this method has been deliberately made "static".

Definition at line 33 of file remotetcpclient.cc.

References Xapian::Error::get_error_string(), Xapian::Error::get_msg(), and TcpClient::open_socket().

◆ operator=()

void RemoteTcpClient::operator= ( const RemoteTcpClient )
private

Don't allow assignment.


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