Apply suggestions from code review

Co-authored-by: Kostas Kyrimis  <kostaskyrim@gmail.com>
This commit is contained in:
gvolfing 2022-12-15 15:25:46 +01:00 committed by GitHub
parent 3604046f68
commit ae57fa3199
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 17 additions and 17 deletions

View File

@ -29,7 +29,7 @@ class LocalSystem {
return Io{local_transport, address};
}
std::shared_ptr<LocalTransportHandle> &GetTransportHandle() { return local_transport_handle_; }
std::shared_ptr<LocalTransportHandle> GetTransportHandle() const { return local_transport_handle_; }
void ShutDown() { local_transport_handle_->ShutDown(); }
};

View File

@ -50,6 +50,6 @@ class Simulator {
SimulatorStats Stats() { return simulator_handle_->Stats(); }
std::shared_ptr<SimulatorHandle> GetSimulatorHandle() { return simulator_handle_; }
std::shared_ptr<SimulatorHandle> GetSimulatorHandle() const { return simulator_handle_; }
};
}; // namespace memgraph::io::simulator

View File

@ -793,7 +793,7 @@ using RWType = plan::ReadWriteTypeChecker::RWType;
InterpreterContext::InterpreterContext(storage::v3::Shard *db, const InterpreterConfig config,
const std::filesystem::path & /*data_directory*/,
std::unique_ptr<RequestRouterFactory> &&request_router_factory,
std::unique_ptr<RequestRouterFactory> request_router_factory,
coordinator::Address coordinator_addr)
: db(db),
config(config),
@ -807,10 +807,10 @@ Interpreter::Interpreter(InterpreterContext *interpreter_context) : interpreter_
interpreter_context_->request_router_factory_->CreateRequestRouter(interpreter_context_->coordinator_address);
// Get edge ids
const auto edge_ids_alloc_min_max_pair =
const auto [min, max] =
request_router_->AllocateInitialEdgeIds(interpreter_context_->coordinator_address);
if (edge_ids_alloc_min_max_pair) {
interpreter_context_->edge_ids_alloc = {edge_ids_alloc_min_max_pair->first, edge_ids_alloc_min_max_pair->second};
interpreter_context_->edge_ids_alloc = {min, max}
}
}

View File

@ -173,7 +173,7 @@ struct PreparedQuery {
struct InterpreterContext {
explicit InterpreterContext(storage::v3::Shard *db, InterpreterConfig config,
const std::filesystem::path &data_directory,
std::unique_ptr<RequestRouterFactory> &&request_router_factory,
std::unique_ptr<RequestRouterFactory> request_router_factory,
coordinator::Address coordinator_addr);
storage::v3::Shard *db;

View File

@ -655,7 +655,7 @@ class RequestRouterFactory {
virtual TransportHandleVariant GetTransportHandle() { return transport_handle_; }
virtual std::unique_ptr<RequestRouterInterface> CreateRequestRouter(
const coordinator::Address &coordinator_address) const noexcept = 0;
const coordinator::Address &coordinator_address) const = 0;
};
class LocalRequestRouterFactory : public RequestRouterFactory {
@ -664,7 +664,7 @@ class LocalRequestRouterFactory : public RequestRouterFactory {
: RequestRouterFactory(transport_handle) {}
std::unique_ptr<RequestRouterInterface> CreateRequestRouter(
const coordinator::Address &coordinator_address) const noexcept override {
const coordinator::Address &coordinator_address) const override {
using TransportType = io::local_transport::LocalTransport;
auto actual_transport_handle = std::get<LocalTransportHandlePtr>(transport_handle_);
@ -686,7 +686,7 @@ class LocalRequestRouterFactory : public RequestRouterFactory {
};
class SimulatedRequestRouterFactory : public RequestRouterFactory {
mutable io::simulator::Simulator *simulator_;
io::simulator::Simulator *simulator_;
coordinator::Address address_;
public:
@ -694,7 +694,7 @@ class SimulatedRequestRouterFactory : public RequestRouterFactory {
: RequestRouterFactory(simulator.GetSimulatorHandle()), simulator_(&simulator), address_(address) {}
std::unique_ptr<RequestRouterInterface> CreateRequestRouter(
const coordinator::Address &coordinator_address) const noexcept override {
const coordinator::Address &coordinator_address) const override {
using TransportType = io::simulator::SimulatorTransport;
auto actual_transport_handle = std::get<SimulatorTransportHandlePtr>(transport_handle_);

View File

@ -42,7 +42,6 @@ RC_GTEST_PROP(RandomClusterConfig, HappyPath, (ClusterConfig cluster_config, Non
.scramble_messages = true,
.rng_seed = rng_seed,
.start_time = Time::min(),
// TODO(tyler) set abort_time to something more restrictive than Time::max()
.abort_time = Time::max(),
};

View File

@ -9,8 +9,8 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
#include <machine_manager/machine_config.hpp>
#include <machine_manager/machine_manager.hpp>
#include "machine_manager/machine_config.hpp"
#include "machine_manager/machine_manager.hpp"
#include "io/simulator/simulator_handle.hpp"
#include "query/v2/config.hpp"
#include "query/v2/discard_value_stream.hpp"
@ -18,7 +18,8 @@
#include "query/v2/interpreter.hpp"
#include "query/v2/request_router.hpp"
#include <memory>
#include <vector>
#include <string>
// TODO(gvolfing)
// -How to set up the entire raft cluster with the QE. Also provide abrstraction for that.
@ -30,9 +31,9 @@ class SimulatedInterpreter {
using ResultStream = query::v2::DiscardValueResultStream;
public:
explicit SimulatedInterpreter(std::unique_ptr<query::v2::InterpreterContext> &&interpreter_context)
explicit SimulatedInterpreter(std::unique_ptr<query::v2::InterpreterContext> interpreter_context)
: interpreter_context_(std::move(interpreter_context)) {
interpreter_ = std::make_unique<memgraph::query::v2::Interpreter>(&(*interpreter_context_));
interpreter_ = std::make_unique<memgraph::query::v2::Interpreter>(interpreter_context_);
}
SimulatedInterpreter(const SimulatedInterpreter &) = delete;
@ -79,7 +80,7 @@ SimulatedInterpreter SetUpInterpreter(Address coordinator_address, Simulator &si
std::make_unique<memgraph::query::v2::SimulatedRequestRouterFactory>(simulator, coordinator_address);
auto interpreter_context = std::make_unique<memgraph::query::v2::InterpreterContext>(
(memgraph::storage::v3::Shard *)(nullptr),
nullptr
memgraph::query::v2::InterpreterConfig{.query = {.allow_load_csv = true},
.execution_timeout_sec = 600,
.replication_replica_check_frequency = std::chrono::seconds(1),