memgraph/src/distributed/plan_dispatcher.cpp
Matija Santl 62323965e3 Implement distributed plan dispatcher/consumer methods
Summary:
Implementations of `DistributePlanRpc`.
I'll add tests afterwards #promise

Reviewers: teon.banek, florijan

Reviewed By: florijan

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1131
2018-01-24 10:50:27 +01:00

21 lines
746 B
C++

#include <distributed/plan_dispatcher.hpp>
namespace distributed {
PlanDispatcher::PlanDispatcher(communication::messaging::System &system,
Coordination &coordination)
: clients_(system, coordination, kDistributedPlanServerName) {}
void PlanDispatcher::DispatchPlan(
int64_t plan_id, std::shared_ptr<query::plan::LogicalOperator> plan,
SymbolTable &symbol_table) {
auto futures = clients_.ExecuteOnWorkers<void>(
0, [plan_id, &plan, &symbol_table](communication::rpc::Client &client) {
auto result =
client.Call<DistributedPlanRpc>(300ms, plan_id, plan, symbol_table);
CHECK(result) << "Failed to dispatch plan to worker";
});
}
} // namespace distributed