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:
Patrick Niklaus
2016-10-06 01:05:03 +02:00
committed by Patrick Niklaus
parent 66f2cc5184
commit 1c2ead8fb8
21 changed files with 361 additions and 291 deletions
+6 -5
View File
@@ -105,7 +105,8 @@ void filterCandidates(const std::vector<util::Coordinate> &coordinates,
}
}
Status MatchPlugin::HandleRequest(const api::MatchParameters &parameters,
Status MatchPlugin::HandleRequest(const std::shared_ptr<datafacade::BaseDataFacade> facade,
const api::MatchParameters &parameters,
util::json::Object &json_result)
{
BOOST_ASSERT(parameters.IsValid());
@@ -150,7 +151,7 @@ Status MatchPlugin::HandleRequest(const api::MatchParameters &parameters,
});
}
auto candidates_lists = GetPhantomNodesInRange(parameters, search_radiuses);
auto candidates_lists = GetPhantomNodesInRange(*facade, parameters, search_radiuses);
filterCandidates(parameters.coordinates, candidates_lists);
if (std::all_of(candidates_lists.begin(),
@@ -165,7 +166,7 @@ Status MatchPlugin::HandleRequest(const api::MatchParameters &parameters,
}
// call the actual map matching
SubMatchingList sub_matchings = map_matching(
SubMatchingList sub_matchings = map_matching(*facade,
candidates_lists, parameters.coordinates, parameters.timestamps, parameters.radiuses);
if (sub_matchings.size() == 0)
@@ -192,11 +193,11 @@ Status MatchPlugin::HandleRequest(const api::MatchParameters &parameters,
// force uturns to be on, since we split the phantom nodes anyway and only have
// bi-directional
// phantom nodes for possible uturns
shortest_path(sub_routes[index].segment_end_coordinates, {false}, sub_routes[index]);
shortest_path(*facade, sub_routes[index].segment_end_coordinates, {false}, sub_routes[index]);
BOOST_ASSERT(sub_routes[index].shortest_path_length != INVALID_EDGE_WEIGHT);
}
api::MatchAPI match_api{BasePlugin::facade, parameters};
api::MatchAPI match_api{*facade, parameters};
match_api.MakeResponse(sub_matchings, sub_routes, json_result);
return Status::Ok;