Make the use RequestRouter more restricted

This commit is contained in:
gvolfing 2023-01-25 07:02:03 +01:00
parent b4ae8aea95
commit 3bc9c571a0
3 changed files with 6 additions and 11 deletions

View File

@ -296,7 +296,10 @@ class Interpreter final {
*/
void Abort();
RequestRouterInterface *GetRequestRouter() { return request_router_.get(); }
const RequestRouterInterface *GetRequestRouter() const { return request_router_.get(); }
void InstallSimulatorTicker(std::function<bool()> &&tick_simulator) {
request_router_->InstallSimulatorTicker(tick_simulator);
}
private:
struct QueryExecution {

View File

@ -12,7 +12,6 @@
#pragma once
#include <algorithm>
#include <boost/uuid/uuid.hpp>
#include <chrono>
#include <deque>
#include <iostream>
@ -28,6 +27,7 @@
#include <variant>
#include <vector>
#include "boost/uuid/uuid.hpp"
#include "coordinator/coordinator.hpp"
#include "coordinator/coordinator_client.hpp"
#include "coordinator/coordinator_rsm.hpp"

View File

@ -43,9 +43,7 @@ class SimulatedInterpreter {
~SimulatedInterpreter() = default;
void InstallSimulatorTicker(Simulator &simulator) {
std::function<bool()> tick_simulator = simulator.GetSimulatorTickClosure();
auto *request_router = interpreter_->GetRequestRouter();
request_router->InstallSimulatorTicker(tick_simulator);
interpreter_->InstallSimulatorTicker(simulator.GetSimulatorTickClosure());
}
std::vector<ResultStream> RunQueries(const std::vector<std::string> &queries) {
@ -65,14 +63,8 @@ class SimulatedInterpreter {
std::map<std::string, memgraph::storage::v3::PropertyValue> params;
const std::string *username = nullptr;
interpreter_->BeginTransaction();
auto *rr = interpreter_->GetRequestRouter();
rr->StartTransaction();
interpreter_->Prepare(query, params, username);
interpreter_->PullAll(&stream);
interpreter_->CommitTransaction();
return stream;
}