#include <remoteserver.h>
Inheritance diagram for RemoteServer:
Public Member Functions | |
RemoteServer (const std::vector< std::string > &dbpaths, int fdin, int fdout, Xapian::timeout active_timeout_, Xapian::timeout idle_timeout_, bool writable=false) | |
Construct a RemoteServer. | |
~RemoteServer () | |
Destructor. | |
void | run () |
Repeatedly accept messages from the client and process them. | |
void | register_weighting_scheme (const Xapian::Weight &wt) |
Register a user-defined weighting scheme class. | |
Private Member Functions | |
void | operator= (const RemoteServer &) |
Don't allow assignment. | |
RemoteServer (const RemoteServer &) | |
Don't allow copying. | |
message_type | get_message (Xapian::timeout timeout, string &result, message_type required_type=MSG_MAX) |
Accept a message from the client. | |
void | send_message (reply_type type, const string &message) |
Send a message to the client. | |
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_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_reopen (const std::string &message) |
void | msg_update (const std::string &message) |
void | msg_flush (const std::string &message) |
void | msg_cancel (const string &message) |
void | msg_adddocument (const std::string &message) |
void | msg_deletedocument_pre_30_2 (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) |
Private Attributes | |
Xapian::Database * | db |
The database we're using. | |
Xapian::WritableDatabase * | wdb |
The WritableDatabase we're using, or NULL if we're read-only. | |
Xapian::timeout | active_timeout |
Timeout for actions during a conversation. | |
Xapian::timeout | idle_timeout |
Timeout while waiting for a new action from the client. | |
map< string, Xapian::Weight * > | wtschemes |
Registered weighting schemes. |
Definition at line 40 of file remoteserver.h.
RemoteServer::RemoteServer | ( | const RemoteServer & | ) | [private] |
Don't allow copying.
RemoteServer::RemoteServer | ( | const std::vector< std::string > & | dbpaths, | |
int | fdin, | |||
int | fdout, | |||
Xapian::timeout | active_timeout_, | |||
Xapian::timeout | idle_timeout_, | |||
bool | writable = false | |||
) |
Construct a RemoteServer.
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 milliseconds). | |
idle_timeout_ | Timeout while waiting for a new action from the client (specified in milliseconds). | |
writable | Should the database be opened for writing? |
Definition at line 46 of file remoteserver.cc.
References Xapian::Database::add_database(), AssertEq, RemoteConnection::context, db, Xapian::DB_CREATE_OR_OPEN, encode_length(), Xapian::Database::get_avlength(), Xapian::Database::get_doccount(), Xapian::Database::get_lastdocid(), Xapian::Database::has_positions(), REPLY_EXCEPTION, REPLY_GREETING, send_message(), serialise_double(), serialise_error(), wdb, wtschemes, XAPIAN_REMOTE_PROTOCOL_MAJOR_VERSION, and XAPIAN_REMOTE_PROTOCOL_MINOR_VERSION.
RemoteServer::~RemoteServer | ( | ) |
void RemoteServer::operator= | ( | const RemoteServer & | ) | [private] |
Don't allow assignment.
message_type RemoteServer::get_message | ( | Xapian::timeout | timeout, | |
string & | result, | |||
message_type | required_type = MSG_MAX | |||
) | [private] |
Accept a message from the client.
Definition at line 123 of file remoteserver.cc.
References RemoteConnection::get_message(), MSG_MAX, MSG_SHUTDOWN, OmTime::now(), and om_tostring().
Referenced by run().
void RemoteServer::send_message | ( | reply_type | type, | |
const string & | message | |||
) | [private] |
Send a message to the client.
Definition at line 150 of file remoteserver.cc.
References active_timeout, OmTime::now(), and RemoteConnection::send_message().
Referenced by RemoteServer(), and run().
void RemoteServer::msg_allterms | ( | const std::string & | message | ) | [private] |
Referenced by run().
void RemoteServer::msg_document | ( | const std::string & | message | ) | [private] |
Referenced by run().
void RemoteServer::msg_termexists | ( | const std::string & | message | ) | [private] |
Referenced by run().
void RemoteServer::msg_collfreq | ( | const std::string & | message | ) | [private] |
Referenced by run().
void RemoteServer::msg_termfreq | ( | const std::string & | message | ) | [private] |
Referenced by run().
void RemoteServer::msg_keepalive | ( | const std::string & | message | ) | [private] |
Referenced by run().
void RemoteServer::msg_doclength | ( | const std::string & | message | ) | [private] |
Referenced by run().
void RemoteServer::msg_query | ( | const std::string & | message | ) | [private] |
Referenced by run().
void RemoteServer::msg_termlist | ( | const std::string & | message | ) | [private] |
Referenced by run().
void RemoteServer::msg_postlist | ( | const std::string & | message | ) | [private] |
Referenced by run().
void RemoteServer::msg_positionlist | ( | const std::string & | message | ) | [private] |
Referenced by run().
void RemoteServer::msg_reopen | ( | const std::string & | message | ) | [private] |
Referenced by run().
void RemoteServer::msg_update | ( | const std::string & | message | ) | [private] |
Referenced by run().
void RemoteServer::msg_flush | ( | const std::string & | message | ) | [private] |
Referenced by run().
void RemoteServer::msg_cancel | ( | const string & | message | ) | [private] |
Definition at line 534 of file remoteserver.cc.
References Xapian::WritableDatabase::begin_transaction(), Xapian::WritableDatabase::cancel_transaction(), and wdb.
Referenced by run().
void RemoteServer::msg_adddocument | ( | const std::string & | message | ) | [private] |
Referenced by run().
void RemoteServer::msg_deletedocument_pre_30_2 | ( | const std::string & | message | ) | [private] |
Referenced by run().
void RemoteServer::msg_deletedocument | ( | const std::string & | message | ) | [private] |
Referenced by run().
void RemoteServer::msg_deletedocumentterm | ( | const std::string & | message | ) | [private] |
Referenced by run().
void RemoteServer::msg_replacedocument | ( | const std::string & | message | ) | [private] |
Referenced by run().
void RemoteServer::msg_replacedocumentterm | ( | const std::string & | message | ) | [private] |
Referenced by run().
void RemoteServer::run | ( | ) |
Repeatedly accept messages from the client and process them.
The loop continues until either the connection is closed, or a non-Xapian exception is thrown.
Definition at line 162 of file remoteserver.cc.
References get_message(), idle_timeout, msg_adddocument(), msg_allterms(), msg_cancel(), msg_collfreq(), msg_deletedocument(), msg_deletedocument_pre_30_2(), msg_deletedocumentterm(), msg_doclength(), msg_document(), msg_flush(), msg_keepalive(), msg_positionlist(), msg_postlist(), msg_query(), msg_reopen(), msg_replacedocument(), msg_replacedocumentterm(), msg_termexists(), msg_termfreq(), msg_termlist(), msg_update(), OmTime::now(), om_tostring(), REPLY_EXCEPTION, send_message(), RemoteConnection::send_message(), and serialise_error().
Referenced by main().
void RemoteServer::register_weighting_scheme | ( | const Xapian::Weight & | wt | ) | [inline] |
Register a user-defined weighting scheme class.
Definition at line 173 of file remoteserver.h.
References Xapian::Weight::clone(), and Xapian::Weight::name().
Xapian::Database* RemoteServer::db [private] |
The database we're using.
If we're writable, this is the same as wdb.
Definition at line 51 of file remoteserver.h.
Referenced by RemoteServer(), and ~RemoteServer().
Xapian::WritableDatabase* RemoteServer::wdb [private] |
The WritableDatabase we're using, or NULL if we're read-only.
Definition at line 54 of file remoteserver.h.
Referenced by msg_cancel(), and RemoteServer().
Xapian::timeout RemoteServer::active_timeout [private] |
Timeout for actions during a conversation.
The timeout is specified in milliseconds. If the timeout is exceeded then a Xapian::NetworkTimeoutError is thrown.
Definition at line 61 of file remoteserver.h.
Referenced by send_message().
Xapian::timeout RemoteServer::idle_timeout [private] |
Timeout while waiting for a new action from the client.
The timeout is specified in milliseconds. If the timeout is exceeded then a Xapian::NetworkTimeoutError is thrown.
Definition at line 68 of file remoteserver.h.
Referenced by run().
map<string, Xapian::Weight *> RemoteServer::wtschemes [private] |
Registered weighting schemes.
Definition at line 71 of file remoteserver.h.
Referenced by RemoteServer(), and ~RemoteServer().