00001
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef XAPIAN_INCLUDED_REMOTESERVER_H
00023 #define XAPIAN_INCLUDED_REMOTESERVER_H
00024
00025 #include "xapian/database.h"
00026 #include "xapian/postingsource.h"
00027 #include "xapian/registry.h"
00028 #include "xapian/visibility.h"
00029 #include "xapian/weight.h"
00030
00031 #include "remoteconnection.h"
00032
00033 #include <string>
00034
00036 class XAPIAN_VISIBILITY_DEFAULT RemoteServer : private RemoteConnection {
00038 void operator=(const RemoteServer &);
00039
00041 RemoteServer(const RemoteServer &);
00042
00047 Xapian::Database * db;
00048
00050 Xapian::WritableDatabase * wdb;
00051
00053 bool writable;
00054
00060 double active_timeout;
00061
00067 double idle_timeout;
00068
00070 Xapian::Registry reg;
00071
00073 message_type get_message(double timeout, std::string & result,
00074 message_type required_type = MSG_MAX);
00075
00077 void send_message(reply_type type, const std::string &message);
00078
00080 void send_message(reply_type type, const std::string &message,
00081 double end_time) {
00082 unsigned char type_as_char = static_cast<unsigned char>(type);
00083 RemoteConnection::send_message(type_as_char, message, end_time);
00084 }
00085
00086
00087 void msg_allterms(const std::string & message);
00088
00089
00090 void msg_document(const std::string & message);
00091
00092
00093 void msg_termexists(const std::string & message);
00094
00095
00096 void msg_collfreq(const std::string & message);
00097
00098
00099 void msg_termfreq(const std::string & message);
00100
00101
00102 void msg_valuestats(const std::string & message);
00103
00104
00105 void msg_keepalive(const std::string & message);
00106
00107
00108 void msg_doclength(const std::string & message);
00109
00110
00111 void msg_query(const std::string & message);
00112
00113
00114 void msg_termlist(const std::string & message);
00115
00116
00117 void msg_postlist(const std::string & message);
00118
00119
00120 void msg_positionlist(const std::string &message);
00121
00122
00123 void msg_writeaccess(const std::string & message);
00124
00125
00126 void msg_reopen(const std::string & message);
00127
00128
00129 void msg_update(const std::string &message);
00130
00131
00132 void msg_commit(const std::string & message);
00133
00134
00135 void msg_cancel(const std::string &message);
00136
00137
00138 void msg_adddocument(const std::string & message);
00139
00140
00141 void msg_deletedocument(const std::string & message);
00142
00143
00144 void msg_deletedocumentterm(const std::string & message);
00145
00146
00147 void msg_replacedocument(const std::string & message);
00148
00149
00150 void msg_replacedocumentterm(const std::string & message);
00151
00152
00153 void msg_getmetadata(const std::string & message);
00154
00155
00156 void msg_openmetadatakeylist(const std::string & message);
00157
00158
00159 void msg_setmetadata(const std::string & message);
00160
00161
00162 void msg_addspelling(const std::string & message);
00163
00164
00165 void msg_removespelling(const std::string & message);
00166
00167 public:
00180 RemoteServer(const std::vector<std::string> &dbpaths,
00181 int fdin, int fdout,
00182 double active_timeout_,
00183 double idle_timeout_,
00184 bool writable = false);
00185
00187 ~RemoteServer();
00188
00194 void run();
00195
00197 const Xapian::Registry & get_registry() const { return reg; }
00198
00200 void set_registry(const Xapian::Registry & reg_) { reg = reg_; }
00201 };
00202
00203 #endif // XAPIAN_INCLUDED_REMOTESERVER_H