00001 #ifndef LUX_DIST_INDEXSERVER_H
00002 #define LUX_DIST_INDEXSERVER_H
00003
00004 #include "handler.h"
00005 #include "result.h"
00006 #include "lux/search.h"
00007 #include "lux/index.h"
00008
00009 #ifdef HAVE_TR1_MEMORY
00010 #include <tr1/memory>
00011 #elif HAVE_BOOST_SHARED_PTR_HPP
00012 #include <boost/shared_ptr.hpp>
00013 #endif
00014
00015 namespace Lux {
00016 namespace Dist {
00017
00018 class IndexServer : public Handler {
00019 public:
00020 IndexServer(void *p);
00021 virtual ~IndexServer(void);
00022
00023 private:
00024 #ifdef HAVE_TR1_MEMORY
00025 std::tr1::shared_ptr<Lux::Searcher> s_;
00026 std::tr1::shared_ptr<Lux::Indexer> i_;
00027 #elif HAVE_BOOST_SHARED_PTR_HPP
00028 boost::shared_ptr<Lux::Searcher> s_;
00029 boost::shared_ptr<Lux::Indexer> i_;
00030 #endif
00031
00032 virtual bool exec(request_header_t &header,
00033 char *body, uint32_t body_len);
00034 bool exec_find(char *body, uint32_t len);
00035 bool exec_getdoc(char *body, uint32_t len);
00036 bool exec_update(char *body, uint32_t len);
00037 bool serialize_doc_rs(DocResultSet &drs,
00038 char **data, uint32_t size);
00039 bool serialize_idx_rs(IndexResultSet &irs,Condition &cond,
00040 char **data, uint32_t *size);
00041 };
00042
00043 }
00044 }
00045
00046 #endif