RemoteServer Class Reference

Remote backend server base class. More...

#include <remoteserver.h>

Inheritance diagram for RemoteServer:

Inheritance graph
[legend]
Collaboration diagram for RemoteServer:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 RemoteServer (const std::vector< std::string > &dbpaths, int fdin, int fdout, double active_timeout_, double idle_timeout_, bool writable=false)
 Construct a RemoteServer.
 ~RemoteServer ()
 Destructor.
void run ()
 Repeatedly accept messages from the client and process them.
const Xapian::Registryget_registry () const
 Get the registry used for (un)serialisation.
void set_registry (const Xapian::Registry &reg_)
 Set the registry used for (un)serialisation.

Private Member Functions

void operator= (const RemoteServer &)
 Don't allow assignment.
 RemoteServer (const RemoteServer &)
 Don't allow copying.
message_type get_message (double timeout, std::string &result, message_type required_type=MSG_MAX)
 Accept a message from the client.
void send_message (reply_type type, const std::string &message)
 Send a message to the client.
void send_message (reply_type type, const std::string &message, double end_time)
 Send a message to the client, with specific end_time.
void msg_allterms (const std::string &message)
void msg_document (const std::string &message)
void msg_termexists (const std::string &message)
void msg_collfreq (const std::string &message)
void msg_termfreq (const std::string &message)
void msg_valuestats (const std::string &message)
void msg_keepalive (const std::string &message)
void msg_doclength (const std::string &message)
void msg_query (const std::string &message)
void msg_termlist (const std::string &message)
void msg_postlist (const std::string &message)
void msg_positionlist (const std::string &message)
void msg_writeaccess (const std::string &message)
void msg_reopen (const std::string &message)
void msg_update (const std::string &message)
void msg_commit (const std::string &message)
void msg_cancel (const std::string &message)
void msg_adddocument (const std::string &message)
void msg_deletedocument (const std::string &message)
void msg_deletedocumentterm (const std::string &message)
void msg_replacedocument (const std::string &message)
void msg_replacedocumentterm (const std::string &message)
void msg_getmetadata (const std::string &message)
void msg_openmetadatakeylist (const std::string &message)
void msg_setmetadata (const std::string &message)
void msg_addspelling (const std::string &message)
void msg_removespelling (const std::string &message)

Private Attributes

Xapian::Databasedb
 The database we're using.
Xapian::WritableDatabasewdb
 The WritableDatabase we're using, or NULL if we're read-only.
bool writable
 Do we support writing?
double active_timeout
 Timeout for actions during a conversation.
double idle_timeout
 Timeout while waiting for a new action from the client.
Xapian::Registry reg
 The registry, which allows unserialisation of user subclasses.


Detailed Description

Remote backend server base class.

Definition at line 36 of file remoteserver.h.


Constructor & Destructor Documentation

RemoteServer::RemoteServer ( const RemoteServer  )  [private]

Don't allow copying.

RemoteServer::RemoteServer ( const std::vector< std::string > &  dbpaths,
int  fdin,
int  fdout,
double  active_timeout_,
double  idle_timeout_,
bool  writable = false 
)

Construct a RemoteServer.

Parameters:
dbpaths The paths to the Xapian databases to use.
fdin The file descriptor to read from.
fdout The file descriptor to write to (fdin and fdout may be the same).
active_timeout_ Timeout for actions during a conversation (specified in seconds).
idle_timeout_ Timeout while waiting for a new action from the client (specified in seconds).
writable Should the database be opened for writing?

Definition at line 47 of file remoteserver.cc.

References Assert, AssertEq, RemoteConnection::context, db, encode_length(), Xapian::Database::get_avlength(), Xapian::Database::get_doccount(), Xapian::Database::get_doclength_lower_bound(), Xapian::Database::get_doclength_upper_bound(), Xapian::Database::get_lastdocid(), Xapian::Database::get_uuid(), Xapian::Database::has_positions(), REPLY_EXCEPTION, REPLY_GREETING, send_message(), serialise_error(), writable, XAPIAN_REMOTE_PROTOCOL_MAJOR_VERSION, and XAPIAN_REMOTE_PROTOCOL_MINOR_VERSION.

RemoteServer::~RemoteServer (  ) 

Destructor.

Definition at line 109 of file remoteserver.cc.

References db.


Member Function Documentation

message_type RemoteServer::get_message ( double  timeout,
std::string &  result,
message_type  required_type = MSG_MAX 
) [private]

Accept a message from the client.

Definition at line 116 of file remoteserver.cc.

References RealTime::end_time(), MSG_MAX, MSG_SHUTDOWN, and Xapian::Internal::str().

Referenced by msg_query(), and run().

const Xapian::Registry& RemoteServer::get_registry (  )  const [inline]

Get the registry used for (un)serialisation.

Definition at line 197 of file remoteserver.h.

void RemoteServer::msg_adddocument ( const std::string &  message  )  [private]

void RemoteServer::msg_addspelling ( const std::string &  message  )  [private]

Definition at line 686 of file remoteserver.cc.

References Xapian::WritableDatabase::add_spelling(), decode_length(), and wdb.

Referenced by run().

void RemoteServer::msg_allterms ( const std::string &  message  )  [private]

void RemoteServer::msg_cancel ( const std::string &  message  )  [private]

void RemoteServer::msg_collfreq ( const std::string &  message  )  [private]

Definition at line 525 of file remoteserver.cc.

References db, encode_length(), Xapian::Database::get_collection_freq(), REPLY_COLLFREQ, and send_message().

Referenced by run().

void RemoteServer::msg_commit ( const std::string &  message  )  [private]

Definition at line 566 of file remoteserver.cc.

References Xapian::WritableDatabase::commit(), REPLY_DONE, send_message(), and wdb.

Referenced by run().

void RemoteServer::msg_deletedocument ( const std::string &  message  )  [private]

Definition at line 600 of file remoteserver.cc.

References decode_length(), Xapian::WritableDatabase::delete_document(), REPLY_DONE, send_message(), and wdb.

Referenced by run().

void RemoteServer::msg_deletedocumentterm ( const std::string &  message  )  [private]

Definition at line 615 of file remoteserver.cc.

References Xapian::WritableDatabase::delete_document(), and wdb.

Referenced by run().

void RemoteServer::msg_doclength ( const std::string &  message  )  [private]

void RemoteServer::msg_document ( const std::string &  message  )  [private]

void RemoteServer::msg_getmetadata ( const std::string &  message  )  [private]

Definition at line 654 of file remoteserver.cc.

References db, Xapian::Database::get_metadata(), REPLY_METADATA, and send_message().

Referenced by run().

void RemoteServer::msg_keepalive ( const std::string &  message  )  [private]

Definition at line 511 of file remoteserver.cc.

References db, Xapian::Database::keep_alive(), REPLY_DONE, and send_message().

Referenced by run().

void RemoteServer::msg_openmetadatakeylist ( const std::string &  message  )  [private]

void RemoteServer::msg_positionlist ( const std::string &  message  )  [private]

void RemoteServer::msg_postlist ( const std::string &  message  )  [private]

void RemoteServer::msg_query ( const std::string &  message  )  [private]

void RemoteServer::msg_removespelling ( const std::string &  message  )  [private]

Definition at line 697 of file remoteserver.cc.

References decode_length(), Xapian::WritableDatabase::remove_spelling(), and wdb.

Referenced by run().

void RemoteServer::msg_reopen ( const std::string &  message  )  [private]

Definition at line 325 of file remoteserver.cc.

References db, msg_update(), and Xapian::Database::reopen().

Referenced by run().

void RemoteServer::msg_replacedocument ( const std::string &  message  )  [private]

void RemoteServer::msg_replacedocumentterm ( const std::string &  message  )  [private]

void RemoteServer::msg_setmetadata ( const std::string &  message  )  [private]

Definition at line 672 of file remoteserver.cc.

References decode_length(), Xapian::WritableDatabase::set_metadata(), and wdb.

Referenced by run().

void RemoteServer::msg_termexists ( const std::string &  message  )  [private]

Definition at line 519 of file remoteserver.cc.

References db, REPLY_TERMDOESNTEXIST, REPLY_TERMEXISTS, send_message(), and Xapian::Database::term_exists().

Referenced by run().

void RemoteServer::msg_termfreq ( const std::string &  message  )  [private]

Definition at line 531 of file remoteserver.cc.

References db, encode_length(), Xapian::Database::get_termfreq(), REPLY_TERMFREQ, and send_message().

Referenced by run().

void RemoteServer::msg_termlist ( const std::string &  message  )  [private]

void RemoteServer::msg_update ( const std::string &  message  )  [private]

void RemoteServer::msg_valuestats ( const std::string &  message  )  [private]

void RemoteServer::msg_writeaccess ( const std::string &  message  )  [private]

Definition at line 313 of file remoteserver.cc.

References RemoteConnection::context, db, Xapian::DB_OPEN, msg_update(), wdb, and writable.

Referenced by run().

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

Don't allow assignment.

void RemoteServer::run (  ) 

void RemoteServer::send_message ( reply_type  type,
const std::string &  message,
double  end_time 
) [inline, private]

Send a message to the client, with specific end_time.

Definition at line 80 of file remoteserver.h.

References RemoteConnection::send_message().

void RemoteServer::send_message ( reply_type  type,
const std::string &  message 
) [private]

void RemoteServer::set_registry ( const Xapian::Registry reg_  )  [inline]

Set the registry used for (un)serialisation.

Definition at line 200 of file remoteserver.h.


Member Data Documentation

double RemoteServer::active_timeout [private]

Timeout for actions during a conversation.

The timeout is specified in seconds. If the timeout is exceeded then a Xapian::NetworkTimeoutError is thrown.

Definition at line 60 of file remoteserver.h.

Referenced by msg_query(), and send_message().

double RemoteServer::idle_timeout [private]

Timeout while waiting for a new action from the client.

The timeout is specified in seconds. If the timeout is exceeded then a Xapian::NetworkTimeoutError is thrown.

Definition at line 67 of file remoteserver.h.

Referenced by run().

The registry, which allows unserialisation of user subclasses.

Definition at line 70 of file remoteserver.h.

Referenced by msg_query().

bool RemoteServer::writable [private]

Do we support writing?

Definition at line 53 of file remoteserver.h.

Referenced by msg_writeaccess(), and RemoteServer().


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

Documentation for Xapian (version 1.2.8).
Generated on 14 Dec 2011 by Doxygen 1.5.9.