ProgClient Class Reference

Implementation of RemoteDatabase using a spawned server. More...

#include <progclient.h>

Inheritance diagram for ProgClient:

Inheritance graph
[legend]
Collaboration diagram for ProgClient:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ProgClient (const std::string &progname, const std::string &arg, double msecs_timeout, bool writable)
 Constructor.
 ~ProgClient ()
 Destructor.

Private Member Functions

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

Static Private Member Functions

static int run_program (const std::string &progname, const std::string &args, pid_t &pid)
 Start the child process.
static std::string get_progcontext (const std::string &progname, const std::string &args)
 Generate context string for Xapian::Error exception objects.

Private Attributes

pid_t pid
 Process id of the child process.


Detailed Description

Implementation of RemoteDatabase using a spawned server.

ProgClient spawns a child process to connect to the server - for example, an ssh command to run the server on a remote host. Communication with the child process is via a pipe.

Definition at line 34 of file progclient.h.


Constructor & Destructor Documentation

ProgClient::ProgClient ( const ProgClient  )  [private]

Don't allow copying.

ProgClient::ProgClient ( const std::string &  progname,
const std::string &  arg,
double  msecs_timeout,
bool  writable 
)

Constructor.

Parameters:
progname The program used to create the connection.
args Any arguments to the program.
timeout Timeout for communication (in seconds).
writable Is this a WritableDatabase?

Definition at line 66 of file progclient.cc.

References LOGCALL_VOID.

ProgClient::~ProgClient (  ) 

Destructor.

Definition at line 234 of file progclient.cc.

References RemoteDatabase::do_close(), and pid.


Member Function Documentation

string ProgClient::get_progcontext ( const std::string &  progname,
const std::string &  args 
) [static, private]

Generate context string for Xapian::Error exception objects.

Parameters:
progname The program used to create the connection.
args Any arguments to the program.
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 79 of file progclient.cc.

References LOGCALL_STATIC, and RETURN.

Referenced by run_program().

void ProgClient::operator= ( const ProgClient  )  [private]

Don't allow assignment.

int ProgClient::run_program ( const std::string &  progname,
const std::string &  args,
pid_t &  pid 
) [static, private]

Start the child process.

Parameters:
progname The program used to create the connection.
args Any arguments to the program.
pid Reference to store the pid of the child process in.
Returns:
filedescriptor for reading from/writing to the child process.
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, this method has been deliberately made "static".

Definition at line 86 of file progclient.cc.

References RemoteDatabase::close(), Xapian::Internal::closefrom(), get_progcontext(), LOGCALL_STATIC, O_BINARY, Xapian::InMemory::open(), pid, and split_words().


Member Data Documentation

pid_t ProgClient::pid [private]

Process id of the child process.

Definition at line 43 of file progclient.h.

Referenced by run_program(), and ~ProgClient().


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

Documentation for Xapian (version 1.2.13).
Generated on 9 Jan 2013 by Doxygen 1.5.9.