mu-server: minor cleanups
This commit is contained in:
@ -27,8 +27,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <thread>
|
|
||||||
#include <mutex>
|
|
||||||
#include <variant>
|
#include <variant>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@ -123,7 +121,6 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief object to manage the server-context for all commands.
|
/// @brief object to manage the server-context for all commands.
|
||||||
struct Server::Private {
|
struct Server::Private {
|
||||||
Private(Store& store, const Server::Options& opts, Output output)
|
Private(Store& store, const Server::Options& opts, Output output)
|
||||||
@ -135,8 +132,6 @@ struct Server::Private {
|
|||||||
|
|
||||||
~Private() {
|
~Private() {
|
||||||
indexer().stop();
|
indexer().stop();
|
||||||
if (index_thread_.joinable())
|
|
||||||
index_thread_.join();
|
|
||||||
if (!tmp_dir_.empty())
|
if (!tmp_dir_.empty())
|
||||||
remove_directory(tmp_dir_);
|
remove_directory(tmp_dir_);
|
||||||
}
|
}
|
||||||
@ -215,7 +210,6 @@ private:
|
|||||||
Server::Output output_;
|
Server::Output output_;
|
||||||
const CommandHandler command_handler_;
|
const CommandHandler command_handler_;
|
||||||
std::atomic<bool> keep_going_{};
|
std::atomic<bool> keep_going_{};
|
||||||
std::thread index_thread_;
|
|
||||||
std::string tmp_dir_;
|
std::string tmp_dir_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -282,7 +276,6 @@ msg_sexp_str(const Message& msg, Store::Id docid, const Option<QueryMatch&> qm)
|
|||||||
return sexpstr;
|
return sexpstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CommandHandler::CommandInfoMap
|
CommandHandler::CommandInfoMap
|
||||||
Server::Private::make_command_map()
|
Server::Private::make_command_map()
|
||||||
{
|
{
|
||||||
@ -572,7 +565,6 @@ Server::Private::data_handler(const Command& cmd)
|
|||||||
"invalid request type '{}'", request_type);
|
"invalid request type '{}'", request_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* creating a message object just to get a path seems a bit excessive maybe
|
* creating a message object just to get a path seems a bit excessive maybe
|
||||||
* mu_store_get_path could be added if this turns out to be a problem
|
* mu_store_get_path could be added if this turns out to be a problem
|
||||||
@ -648,7 +640,6 @@ Server::Private::output_results(const QueryResults& qres, size_t batch_size) con
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Server::Private::find_handler(const Command& cmd)
|
Server::Private::find_handler(const Command& cmd)
|
||||||
{
|
{
|
||||||
@ -791,10 +782,9 @@ Server::Private::index_handler(const Command& cmd)
|
|||||||
// ignore .noupdate with an empty store.
|
// ignore .noupdate with an empty store.
|
||||||
conf.ignore_noupdate = store().empty();
|
conf.ignore_noupdate = store().empty();
|
||||||
|
|
||||||
// nothing to do
|
if (indexer().is_running()) // already
|
||||||
if (indexer().is_running()) {
|
|
||||||
throw Error{Error::Code::Xapian, "indexer is already running"};
|
throw Error{Error::Code::Xapian, "indexer is already running"};
|
||||||
}
|
|
||||||
do_index(conf);
|
do_index(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -991,7 +981,6 @@ Server::Private::queries_handler(const Command& cmd)
|
|||||||
output_sexp(Sexp(":queries"_sym, std::move(qresults)));
|
output_sexp(Sexp(":queries"_sym, std::move(qresults)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Server::Private::quit_handler(const Command& cmd)
|
Server::Private::quit_handler(const Command& cmd)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user