Restructure files into namespaces and subdirectories
This commit is contained in:
parent
5b59d890c0
commit
f8e5032011
@ -17,7 +17,7 @@ add_subdirectory(query/v2)
|
||||
add_subdirectory(slk)
|
||||
add_subdirectory(rpc)
|
||||
add_subdirectory(auth)
|
||||
add_subdirectory(io/v3)
|
||||
add_subdirectory(io/simulator)
|
||||
|
||||
if (MG_ENTERPRISE)
|
||||
add_subdirectory(audit)
|
||||
|
@ -3,7 +3,10 @@ set(io_src_files
|
||||
network/endpoint.cpp
|
||||
network/socket.cpp
|
||||
network/utils.cpp
|
||||
future.hpp)
|
||||
future.hpp
|
||||
address.hpp
|
||||
errors.hpp
|
||||
transport.hpp)
|
||||
|
||||
find_package(fmt REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <boost/uuid/uuid.hpp>
|
||||
|
||||
namespace memgraph::io {
|
||||
struct Address {
|
||||
// It's important for all participants to have a
|
||||
// unique identifier - IP and port alone are not
|
||||
@ -46,3 +47,4 @@ struct Address {
|
||||
}
|
||||
}
|
||||
};
|
||||
}; // namespace memgraph::io
|
@ -11,6 +11,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace memgraph::io {
|
||||
// Signifies that a retriable operation was unable to
|
||||
// complete after a configured number of retries.
|
||||
struct RetriesExhausted {};
|
||||
@ -22,3 +23,4 @@ struct RetriesExhausted {};
|
||||
// It may be the case that the request was fully processed
|
||||
// but that the response was not received.
|
||||
struct TimedOut {};
|
||||
}; // namespace memgraph::io
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "utils/logging.hpp"
|
||||
|
||||
#include "io/v3/errors.hpp"
|
||||
#include "io/errors.hpp"
|
||||
|
||||
namespace memgraph::io {
|
||||
|
||||
|
11
src/io/simulator/CMakeLists.txt
Normal file
11
src/io/simulator/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
||||
set(io_simulator_sources
|
||||
simulator.hpp
|
||||
simulator_handle.hpp
|
||||
simulator_stats.hpp
|
||||
simulator_config.hpp)
|
||||
|
||||
find_package(fmt REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
add_library(mg-io-simulator STATIC ${io_simulator_sources})
|
||||
target_link_libraries(mg-io-simulator stdc++fs Threads::Threads fmt::fmt mg-utils)
|
@ -13,11 +13,12 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "io/v3/address.hpp"
|
||||
#include "io/v3/simulator_config.hpp"
|
||||
#include "io/v3/simulator_handle.hpp"
|
||||
#include "io/v3/simulator_transport.hpp"
|
||||
#include "io/address.hpp"
|
||||
#include "io/simulator/simulator_config.hpp"
|
||||
#include "io/simulator/simulator_handle.hpp"
|
||||
#include "io/simulator/simulator_transport.hpp"
|
||||
|
||||
namespace memgraph::io::simulator {
|
||||
class Simulator {
|
||||
std::mt19937 rng_{};
|
||||
std::shared_ptr<SimulatorHandle> simulator_handle_;
|
||||
@ -40,3 +41,4 @@ class Simulator {
|
||||
|
||||
SimulatorStats Stats() { return simulator_handle_->Stats(); }
|
||||
};
|
||||
}; // namespace memgraph::io::simulator
|
@ -11,6 +11,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace memgraph::io::simulator {
|
||||
struct SimulatorConfig {
|
||||
int drop_percent = 0;
|
||||
bool perform_timeouts = false;
|
||||
@ -19,3 +20,4 @@ struct SimulatorConfig {
|
||||
uint64_t start_time = 0;
|
||||
uint64_t abort_time = ULLONG_MAX;
|
||||
};
|
||||
}; // namespace memgraph::io::simulator
|
@ -23,12 +23,13 @@
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
#include "io/v3/address.hpp"
|
||||
#include "io/v3/errors.hpp"
|
||||
#include "io/v3/simulator_config.hpp"
|
||||
#include "io/v3/simulator_stats.hpp"
|
||||
#include "io/v3/transport.hpp"
|
||||
#include "io/address.hpp"
|
||||
#include "io/errors.hpp"
|
||||
#include "io/simulator/simulator_config.hpp"
|
||||
#include "io/simulator/simulator_stats.hpp"
|
||||
#include "io/transport.hpp"
|
||||
|
||||
namespace memgraph::io::simulator {
|
||||
struct OpaqueMessage {
|
||||
Address from_address;
|
||||
uint64_t request_id;
|
||||
@ -449,3 +450,4 @@ class SimulatorHandle {
|
||||
return stats_;
|
||||
}
|
||||
};
|
||||
}; // namespace memgraph::io::simulator
|
@ -11,6 +11,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace memgraph::io::simulator {
|
||||
struct SimulatorStats {
|
||||
uint64_t total_messages = 0;
|
||||
uint64_t dropped_messages = 0;
|
||||
@ -19,3 +20,4 @@ struct SimulatorStats {
|
||||
uint64_t total_responses = 0;
|
||||
uint64_t simulator_ticks = 0;
|
||||
};
|
||||
}; // namespace memgraph::io::simulator
|
@ -14,9 +14,10 @@
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "io/v3/address.hpp"
|
||||
#include "io/v3/simulator_handle.hpp"
|
||||
#include "io/address.hpp"
|
||||
#include "io/simulator/simulator_handle.hpp"
|
||||
|
||||
namespace memgraph::io::simulator {
|
||||
class SimulatorTransport {
|
||||
std::shared_ptr<SimulatorHandle> simulator_handle_;
|
||||
Address address_;
|
||||
@ -58,3 +59,4 @@ class SimulatorTransport {
|
||||
return distrib(rng_);
|
||||
}
|
||||
};
|
||||
}; // namespace memgraph::io::simulator
|
@ -17,15 +17,13 @@
|
||||
|
||||
#include "utils/result.hpp"
|
||||
|
||||
#include "io/address.hpp"
|
||||
#include "io/errors.hpp"
|
||||
#include "io/future.hpp"
|
||||
#include "io/v3/address.hpp"
|
||||
#include "io/v3/errors.hpp"
|
||||
|
||||
using memgraph::utils::BasicResult;
|
||||
|
||||
template <typename I>
|
||||
class Io;
|
||||
|
||||
namespace memgraph::io {
|
||||
// TODO(tyler) ensure that Message continues to represent
|
||||
// reasonable constraints around message types over time,
|
||||
// as we adapt things to use Thrift-generated message types.
|
||||
@ -129,3 +127,4 @@ class Io {
|
||||
|
||||
Address GetAddress() { return address_; }
|
||||
};
|
||||
}; // namespace memgraph::io
|
@ -1,14 +0,0 @@
|
||||
set(io_v3_sources
|
||||
address.hpp
|
||||
errors.hpp
|
||||
transport.hpp
|
||||
simulator.hpp
|
||||
simulator_handle.hpp
|
||||
simulator_stats.hpp
|
||||
simulator_config.hpp)
|
||||
|
||||
find_package(fmt REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
add_library(mg-io-v3 STATIC ${io_v3_sources})
|
||||
target_link_libraries(mg-io-v3 stdc++fs Threads::Threads fmt::fmt mg-utils)
|
@ -13,7 +13,7 @@ function(add_simulation_test test_cpp san)
|
||||
# used to help create two targets of the same name even though CMake
|
||||
# requires unique logical target names
|
||||
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${exec_name})
|
||||
target_link_libraries(${target_name} gtest gmock gtest_main mg-utils mg-io-v3)
|
||||
target_link_libraries(${target_name} gtest gmock gtest_main mg-utils mg-io mg-io-simulator)
|
||||
|
||||
# sanitize
|
||||
target_compile_options(${target_name} PRIVATE -fsanitize=${san})
|
||||
|
@ -11,7 +11,15 @@
|
||||
|
||||
#include <thread>
|
||||
|
||||
#include "io/v3/simulator.hpp"
|
||||
#include "io/simulator/simulator.hpp"
|
||||
|
||||
using memgraph::io::Address;
|
||||
using memgraph::io::Io;
|
||||
using memgraph::io::ResponseFuture;
|
||||
using memgraph::io::ResponseResult;
|
||||
using memgraph::io::simulator::Simulator;
|
||||
using memgraph::io::simulator::SimulatorConfig;
|
||||
using memgraph::io::simulator::SimulatorTransport;
|
||||
|
||||
struct CounterRequest {
|
||||
uint64_t proposal;
|
||||
|
@ -23,7 +23,17 @@
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
#include "io/v3/simulator.hpp"
|
||||
#include "io/simulator/simulator.hpp"
|
||||
|
||||
using memgraph::io::Address;
|
||||
using memgraph::io::Io;
|
||||
using memgraph::io::ResponseEnvelope;
|
||||
using memgraph::io::ResponseFuture;
|
||||
using memgraph::io::ResponseResult;
|
||||
using memgraph::io::simulator::Simulator;
|
||||
using memgraph::io::simulator::SimulatorConfig;
|
||||
using memgraph::io::simulator::SimulatorStats;
|
||||
using memgraph::io::simulator::SimulatorTransport;
|
||||
|
||||
using Op = std::vector<uint8_t>;
|
||||
using Term = uint64_t;
|
||||
|
Loading…
Reference in New Issue
Block a user