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/enquire.h"
00027 #include "xapian/visibility.h"
00028
00029 #include "remoteconnection.h"
00030
00031 #include <map>
00032 #include <string>
00033
00034
00035 namespace Xapian { class Weight; }
00036
00037 using namespace std;
00038
00040 class XAPIAN_VISIBILITY_DEFAULT RemoteServer : private RemoteConnection {
00042 void operator=(const RemoteServer &);
00043
00045 RemoteServer(const RemoteServer &);
00046
00051 Xapian::Database * db;
00052
00054 Xapian::WritableDatabase * wdb;
00055
00061 Xapian::timeout active_timeout;
00062
00068 Xapian::timeout idle_timeout;
00069
00071 map<string, Xapian::Weight *> wtschemes;
00072
00074 message_type get_message(Xapian::timeout timeout, string & result,
00075 message_type required_type = MSG_MAX);
00076
00078 void send_message(reply_type type, const string &message);
00079
00080
00081 void msg_allterms(const std::string & message);
00082
00083
00084 void msg_document(const std::string & message);
00085
00086
00087 void msg_termexists(const std::string & message);
00088
00089
00090 void msg_collfreq(const std::string & message);
00091
00092
00093 void msg_termfreq(const std::string & message);
00094
00095
00096 void msg_keepalive(const std::string & message);
00097
00098
00099 void msg_doclength(const std::string & message);
00100
00101
00102 void msg_query(const std::string & message);
00103
00104
00105 void msg_termlist(const std::string & message);
00106
00107
00108 void msg_postlist(const std::string & message);
00109
00110
00111 void msg_positionlist(const std::string &message);
00112
00113
00114 void msg_reopen(const std::string & message);
00115
00116
00117 void msg_update(const std::string &message);
00118
00119
00120 void msg_flush(const std::string & message);
00121
00122
00123 void msg_cancel(const string &message);
00124
00125
00126 void msg_adddocument(const std::string & message);
00127
00128
00129 void msg_deletedocument_pre_30_2(const std::string & message);
00130
00131
00132 void msg_deletedocument(const std::string & message);
00133
00134
00135 void msg_deletedocumentterm(const std::string & message);
00136
00137
00138 void msg_replacedocument(const std::string & message);
00139
00140
00141 void msg_replacedocumentterm(const std::string & message);
00142
00143 public:
00156 RemoteServer(const std::vector<std::string> &dbpaths,
00157 int fdin, int fdout,
00158 Xapian::timeout active_timeout_,
00159 Xapian::timeout idle_timeout_,
00160 bool writable = false);
00161
00163 ~RemoteServer();
00164
00170 void run();
00171
00173 void register_weighting_scheme(const Xapian::Weight &wt) {
00174 wtschemes[wt.name()] = wt.clone();
00175 }
00176 };
00177
00178 #endif // XAPIAN_INCLUDED_REMOTESERVER_H