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
@@ -23,13 +23,15 @@ namespace engine
|
||||
namespace plugins
|
||||
{
|
||||
|
||||
TablePlugin::TablePlugin(datafacade::BaseDataFacade &facade, const int max_locations_distance_table)
|
||||
: BasePlugin{facade}, distance_table(&facade, heaps),
|
||||
TablePlugin::TablePlugin(const int max_locations_distance_table)
|
||||
: distance_table(heaps),
|
||||
max_locations_distance_table(max_locations_distance_table)
|
||||
{
|
||||
}
|
||||
|
||||
Status TablePlugin::HandleRequest(const api::TableParameters ¶ms, util::json::Object &result)
|
||||
Status TablePlugin::HandleRequest(const std::shared_ptr<datafacade::BaseDataFacade> facade,
|
||||
const api::TableParameters ¶ms,
|
||||
util::json::Object &result)
|
||||
{
|
||||
BOOST_ASSERT(params.IsValid());
|
||||
|
||||
@@ -58,15 +60,15 @@ Status TablePlugin::HandleRequest(const api::TableParameters ¶ms, util::json
|
||||
return Error("TooBig", "Too many table coordinates", result);
|
||||
}
|
||||
|
||||
auto snapped_phantoms = SnapPhantomNodes(GetPhantomNodes(params));
|
||||
auto result_table = distance_table(snapped_phantoms, params.sources, params.destinations);
|
||||
auto snapped_phantoms = SnapPhantomNodes(GetPhantomNodes(*facade, params));
|
||||
auto result_table = distance_table(*facade, snapped_phantoms, params.sources, params.destinations);
|
||||
|
||||
if (result_table.empty())
|
||||
{
|
||||
return Error("NoTable", "No table found", result);
|
||||
}
|
||||
|
||||
api::TableAPI table_api{facade, params};
|
||||
api::TableAPI table_api{*facade, params};
|
||||
table_api.MakeResponse(result_table, snapped_phantoms, result);
|
||||
|
||||
return Status::Ok;
|
||||
|
||||
Reference in New Issue
Block a user