Make DataFacade local to every request
This is the first step to having fine grained locking on data updates, see issue #2570.
This commit is contained in:
committed by
Patrick Niklaus
parent
66f2cc5184
commit
1c2ead8fb8
@@ -17,13 +17,14 @@ namespace engine
|
||||
namespace plugins
|
||||
{
|
||||
|
||||
NearestPlugin::NearestPlugin(datafacade::BaseDataFacade &facade, const int max_results_)
|
||||
: BasePlugin{facade}, max_results{max_results_}
|
||||
NearestPlugin::NearestPlugin(const int max_results_)
|
||||
: max_results{max_results_}
|
||||
{
|
||||
}
|
||||
|
||||
Status NearestPlugin::HandleRequest(const api::NearestParameters ¶ms,
|
||||
util::json::Object &json_result)
|
||||
Status NearestPlugin::HandleRequest(const std::shared_ptr<datafacade::BaseDataFacade> facade,
|
||||
const api::NearestParameters ¶ms,
|
||||
util::json::Object &json_result) const
|
||||
{
|
||||
BOOST_ASSERT(params.IsValid());
|
||||
|
||||
@@ -44,7 +45,7 @@ Status NearestPlugin::HandleRequest(const api::NearestParameters ¶ms,
|
||||
return Error("InvalidOptions", "Only one input coordinate is supported", json_result);
|
||||
}
|
||||
|
||||
auto phantom_nodes = GetPhantomNodes(params, params.number_of_results);
|
||||
auto phantom_nodes = GetPhantomNodes(*facade, params, params.number_of_results);
|
||||
|
||||
if (phantom_nodes.front().size() == 0)
|
||||
{
|
||||
@@ -52,7 +53,7 @@ Status NearestPlugin::HandleRequest(const api::NearestParameters ¶ms,
|
||||
}
|
||||
BOOST_ASSERT(phantom_nodes.front().size() > 0);
|
||||
|
||||
api::NearestAPI nearest_api(facade, params);
|
||||
api::NearestAPI nearest_api(*facade, params);
|
||||
nearest_api.MakeResponse(phantom_nodes, json_result);
|
||||
|
||||
return Status::Ok;
|
||||
|
||||
Reference in New Issue
Block a user