From b2344384cf68e5073ea15531c32987d0ba41f488 Mon Sep 17 00:00:00 2001 From: Marcelo Zimbres Date: Sat, 28 Jan 2023 17:57:35 +0100 Subject: [PATCH] Renames Aedis to Boost.Redis. --- CMakeLists.txt | 45 ++-- README.md | 96 ++++----- ...fig.cmake.in => BoostRedisConfig.cmake.in} | 0 .../common/{aedis.cpp => boost_redis.cpp} | 2 +- examples/common/common.cpp | 6 +- examples/common/common.hpp | 4 +- examples/cpp17_intro.cpp | 17 +- examples/cpp17_intro_sync.cpp | 13 +- examples/cpp17_low_level_sync.cpp | 10 +- examples/cpp20_chat_room.cpp | 6 +- examples/cpp20_containers.cpp | 17 +- examples/cpp20_echo_server.cpp | 6 +- examples/cpp20_intro.cpp | 8 +- examples/cpp20_intro_awaitable_ops.cpp | 8 +- examples/cpp20_intro_tls.cpp | 13 +- examples/cpp20_low_level_async.cpp | 6 +- examples/cpp20_resolve_with_sentinel.cpp | 8 +- examples/cpp20_serialization.cpp | 13 +- examples/cpp20_subscriber.cpp | 6 +- include/{aedis.hpp => boost/redis.hpp} | 14 +- include/{aedis => boost/redis}/adapt.hpp | 31 ++- .../{aedis => boost/redis}/adapter/adapt.hpp | 12 +- .../redis}/adapter/detail/adapters.hpp | 51 +++-- .../redis}/adapter/detail/response_traits.hpp | 25 ++- include/{aedis => boost/redis}/connection.hpp | 37 ++-- .../redis}/detail/connection_base.hpp | 55 +++-- .../redis}/detail/connection_ops.hpp | 89 ++++---- include/{aedis => boost/redis}/error.hpp | 14 +- include/{aedis => boost/redis}/impl/error.ipp | 18 +- include/{aedis => boost/redis}/operation.hpp | 12 +- .../redis}/resp3/detail/impl/parser.ipp | 13 +- .../redis}/resp3/detail/parser.hpp | 12 +- .../redis}/resp3/detail/read_ops.hpp | 37 ++-- .../redis}/resp3/impl/request.ipp | 6 +- .../redis}/resp3/impl/type.ipp | 6 +- include/{aedis => boost/redis}/resp3/node.hpp | 14 +- include/{aedis => boost/redis}/resp3/read.hpp | 37 ++-- .../{aedis => boost/redis}/resp3/request.hpp | 28 +-- include/{aedis => boost/redis}/resp3/type.hpp | 10 +- .../{aedis => boost/redis}/resp3/write.hpp | 22 +- include/{aedis => boost/redis}/src.hpp | 8 +- .../{aedis => boost/redis}/ssl/connection.hpp | 67 +++--- tests/conn_echo_stress.cpp | 12 +- tests/conn_exec.cpp | 16 +- tests/conn_exec_cancel.cpp | 10 +- tests/conn_exec_retry.cpp | 14 +- tests/conn_push.cpp | 22 +- tests/conn_quit.cpp | 12 +- tests/conn_quit_coalesce.cpp | 12 +- tests/conn_reconnect.cpp | 8 +- tests/conn_run_cancel.cpp | 12 +- tests/conn_tls.cpp | 12 +- tests/issue_50.cpp | 6 +- tests/low_level.cpp | 198 +++++++++--------- tests/request.cpp | 6 +- 55 files changed, 615 insertions(+), 627 deletions(-) rename cmake/{AedisConfig.cmake.in => BoostRedisConfig.cmake.in} (100%) rename examples/common/{aedis.cpp => boost_redis.cpp} (85%) rename include/{aedis.hpp => boost/redis.hpp} (65%) rename include/{aedis => boost/redis}/adapt.hpp (84%) rename include/{aedis => boost/redis}/adapter/adapt.hpp (89%) rename include/{aedis => boost/redis}/adapter/detail/adapters.hpp (88%) rename include/{aedis => boost/redis}/adapter/detail/response_traits.hpp (89%) rename include/{aedis => boost/redis}/connection.hpp (87%) rename include/{aedis => boost/redis}/detail/connection_base.hpp (88%) rename include/{aedis => boost/redis}/detail/connection_ops.hpp (82%) rename include/{aedis => boost/redis}/error.hpp (84%) rename include/{aedis => boost/redis}/impl/error.ipp (80%) rename include/{aedis => boost/redis}/operation.hpp (72%) rename include/{aedis => boost/redis}/resp3/detail/impl/parser.ipp (93%) rename include/{aedis => boost/redis}/resp3/detail/parser.hpp (89%) rename include/{aedis => boost/redis}/resp3/detail/read_ops.hpp (76%) rename include/{aedis => boost/redis}/resp3/impl/request.ipp (77%) rename include/{aedis => boost/redis}/resp3/impl/type.ipp (97%) rename include/{aedis => boost/redis}/resp3/node.hpp (87%) rename include/{aedis => boost/redis}/resp3/read.hpp (84%) rename include/{aedis => boost/redis}/resp3/request.hpp (93%) rename include/{aedis => boost/redis}/resp3/type.hpp (91%) rename include/{aedis => boost/redis}/resp3/write.hpp (61%) rename include/{aedis => boost/redis}/src.hpp (50%) rename include/{aedis => boost/redis}/ssl/connection.hpp (63%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 69994349..d97a4eff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,29 +1,22 @@ -# At the moment the official build system is still autotools and this -# file is meant to support Aedis on windows. - -# BOOST_ROOT=/opt/boost_1_79/ cmake -DCMAKE_CXX_FLAGS="-g -O0 -# -std=c++20 -Wall -Wextra --coverage -fkeep-inline-functions -# -fkeep-static-functions" -DCMAKE_EXE_LINKER_FLAGS="--coverage" -# ~/my/aedis - cmake_minimum_required(VERSION 3.14) project( - Aedis + boost_redis VERSION 1.4.1 DESCRIPTION "A redis client library" - HOMEPAGE_URL "https://mzimbres.github.io/aedis" + HOMEPAGE_URL "https://boostorg.github.io/redis/" LANGUAGES CXX ) -add_library(aedis INTERFACE) -target_include_directories(aedis INTERFACE +add_library(boost_redis INTERFACE) +add_library(Boost::redis ALIAS boost_redis) +target_include_directories(boost_redis INTERFACE $ $ ) target_link_libraries( - aedis + boost_redis INTERFACE Boost::asio Boost::assert @@ -34,17 +27,17 @@ target_link_libraries( Boost::utility ) -target_compile_features(aedis INTERFACE cxx_std_17) +target_compile_features(boost_redis INTERFACE cxx_std_17) # Asio bases C++ feature detection on __cplusplus. Make MSVC # define it correctly if (MSVC) - target_compile_options(aedis INTERFACE /Zc:__cplusplus) + target_compile_options(boost_redis INTERFACE /Zc:__cplusplus) endif() include(CMakePackageConfigHelpers) write_basic_package_version_file( - "${PROJECT_BINARY_DIR}/AedisConfigVersion.cmake" + "${PROJECT_BINARY_DIR}/BoostRedisConfigVersion.cmake" COMPATIBILITY AnyNewerVersion ) @@ -62,7 +55,7 @@ include_directories(include) add_library(common STATIC examples/common/common.cpp examples/common/main.cpp - examples/common/aedis.cpp + examples/common/boost_redis.cpp ) target_compile_features(common PUBLIC cxx_std_20) if (MSVC) @@ -311,23 +304,23 @@ endif() # Install #======================================================================= -install(TARGETS aedis - EXPORT aedis +install(TARGETS boost_redis + EXPORT boost_redis PUBLIC_HEADER DESTINATION include COMPONENT Development ) include(CMakePackageConfigHelpers) configure_package_config_file( - "${PROJECT_SOURCE_DIR}/cmake/AedisConfig.cmake.in" - "${PROJECT_BINARY_DIR}/AedisConfig.cmake" - INSTALL_DESTINATION lib/cmake/aedis + "${PROJECT_SOURCE_DIR}/cmake/BoostRedisConfig.cmake.in" + "${PROJECT_BINARY_DIR}/BoostRedisConfig.cmake" + INSTALL_DESTINATION lib/cmake/boost/redis ) -install(EXPORT aedis DESTINATION lib/cmake/aedis) -install(FILES "${PROJECT_BINARY_DIR}/AedisConfigVersion.cmake" - "${PROJECT_BINARY_DIR}/AedisConfig.cmake" - DESTINATION lib/cmake/aedis) +install(EXPORT boost_redis DESTINATION lib/cmake/boost/redis) +install(FILES "${PROJECT_BINARY_DIR}/BoostRedisConfigVersion.cmake" + "${PROJECT_BINARY_DIR}/BoostRedisConfig.cmake" + DESTINATION lib/cmake/boost/redis) install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include) diff --git a/README.md b/README.md index d15e4b5a..fc7c9d2b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Aedis +# Boost.Redis -Aedis is a [Redis](https://redis.io/) client library built on top of +Boost.Redis is a [Redis](https://redis.io/) client library built on top of [Boost.Asio](https://www.boost.org/doc/libs/release/doc/html/boost_asio.html) that implements the latest version of the Redis communication protocol @@ -9,16 +9,16 @@ It makes communication with a Redis server easy by hiding low-level code away from the user, which, in the majority of the cases will be concerned with only three library entities -* `aedis::connection`: A connection to the Redis server with +* `boost::redis::connection`: A connection to the Redis server with high-level functions to execute Redis commands, receive server pushes and support for automatic command [pipelines](https://redis.io/docs/manual/pipelining/). -* `aedis::resp3::request`: A container of Redis commands that supports +* `boost::redis::resp3::request`: A container of Redis commands that supports STL containers and user defined data types. -* `aedis::adapt()`: A function that adapts data structures to receive responses. +* `boost::redis::adapt()`: A function that adapts data structures to receive responses. In the next sections we will cover all those points in detail with -examples. The requirements for using Aedis are +examples. The requirements for using Boost.Redis are * Boost 1.80 or greater. * C++17 minimum. @@ -172,7 +172,7 @@ them are * [Client-side caching](https://redis.io/docs/manual/client-side-caching/) The connection class supports server pushes by means of the -`aedis::connection::async_receive` function, the coroutine shows how +`boost::redis::connection::async_receive` function, the coroutine shows how to used it ```cpp @@ -234,9 +234,9 @@ above the only place that has to manage the error is the run function. ### Cancellation -Aedis supports both implicit and explicit cancellation of connection +Boost.Redis supports both implicit and explicit cancellation of connection operations. Explicit cancellation is supported by means of the -`aedis::connection::cancel` member function. Implicit +`boost::redis::connection::cancel` member function. Implicit terminal-cancellation, like those that happen when using Asio awaitable `operator ||` will be discussed with more detail below. @@ -263,7 +263,7 @@ co_await (conn.async_exec(...) || conn.async_exec(...) || ... || conn.async_exec ``` * This works but is unnecessary. Unless the user has set - `aedis::resp3::request::config::coalesce` to `false`, and he + `boost::redis::resp3::request::config::coalesce` to `false`, and he usually shouldn't, the connection will automatically merge the individual requests into a single payload. @@ -295,7 +295,7 @@ req.push_range("SUBSCRIBE", std::cbegin(list), std::cend(list)); req.push_range("HSET", "key", map); ``` -Sending a request to Redis is performed with `aedis::connection::async_exec` as already stated. +Sending a request to Redis is performed with `boost::redis::connection::async_exec` as already stated. @@ -313,7 +313,7 @@ struct mystruct {...}; void to_bulk(std::pmr::string& to, mystruct const& obj) { std::string dummy = "Dummy serializaiton string."; - aedis::resp3::to_bulk(to, dummy); + boost::redis::resp3::to_bulk(to, dummy); } ``` @@ -334,17 +334,17 @@ Example cpp20_serialization.cpp shows how store json strings in Redis. ### Config flags -The `aedis::resp3::request::config` object inside the request dictates how the -`aedis::connection` should handle the request in some important situations. The +The `boost::redis::resp3::request::config` object inside the request dictates how the +`boost::redis::connection` should handle the request in some important situations. The reader is advised to read it carefully. ## Responses -Aedis uses the following strategy to support Redis responses +Boost.Redis uses the following strategy to support Redis responses -* **Static**: For `aedis::resp3::request` whose sizes are known at compile time +* **Static**: For `boost::redis::resp3::request` whose sizes are known at compile time `std::tuple` is supported. -* **Dynamic**: Otherwise use `std::vector>`. +* **Dynamic**: Otherwise use `std::vector>`. For example, below is a request with a compile time size @@ -366,11 +366,11 @@ have as many elements as the request has commands (exceptions below). It is also necessary that each tuple element is capable of storing the response to the command it refers to, otherwise an error will occur. To ignore responses to individual commands in the request use the tag -`aedis::ignore` +`boost::redis::ignore` ```cpp // Ignore the second and last responses. -std::tuple +std::tuple ``` The following table provides the resp3-types returned by some Redis @@ -418,7 +418,7 @@ can be read in the tuple below ```cpp std::tuple< - aedis::ignore, // hello + redis::ignore, // hello int, // rpush int, // hset std::vector, // lrange @@ -474,7 +474,7 @@ that has size two. It is not uncommon for apps to access keys that do not exist or that have already expired in the Redis server, to deal with these -cases Aedis provides support for `std::optional`. To use it, +cases Boost.Redis provides support for `std::optional`. To use it, wrap your type around `std::optional` like this ```cpp @@ -507,7 +507,7 @@ req.push("EXEC"); use the following response type ```cpp -using aedis::ignore; +using boost::redis::ignore; using exec_resp_type = std::tuple< @@ -517,11 +517,11 @@ using exec_resp_type = >; std::tuple< - aedis::ignore, // multi - aedis::ignore, // get - aedis::ignore, // lrange - aedis::ignore, // hgetall - exec_resp_type, // exec + boost::redis::ignore, // multi + boost::redis::ignore, // get + boost::redis::ignore, // lrange + boost::redis::ignore, // hgetall + exec_resp_type, // exec > resp; co_await conn->async_exec(req, adapt(resp)); @@ -534,7 +534,7 @@ For a complete example see cpp20_containers.cpp. As mentioned in the serialization section, it is common practice to serialize data before sending it to Redis e.g. as json strings. For performance and convenience reasons, we may also want to deserialize -responses directly in their final data structure. Aedis supports this +responses directly in their final data structure. Boost.Redis supports this use case by calling a user provided `from_bulk` function while parsing the response. For example @@ -561,7 +561,7 @@ will result in error. * RESP3 aggregates that contain nested aggregates can't be read in STL containers. * Transactions with a dynamic number of commands can't be read in a `std::tuple`. -To deal with these cases Aedis provides the `aedis::resp3::node` type +To deal with these cases Boost.Redis provides the `boost::redis::resp3::node` type abstraction, that is the most general form of an element in a response, be it a simple RESP3 type or the element of an aggregate. It is defined like this @@ -647,7 +647,7 @@ I also imposed some constraints on the implementations To reproduce these results run one of the echo-server programs in one terminal and the -[echo-server-client](https://github.com/mzimbres/aedis/blob/42880e788bec6020dd018194075a211ad9f339e8/benchmarks/cpp/asio/echo_server_client.cpp) +[echo-server-client](https://github.com/boostorg/redis/blob/42880e788bec6020dd018194075a211ad9f339e8/benchmarks/cpp/asio/echo_server_client.cpp) in another. ### Without Redis @@ -656,7 +656,7 @@ First I tested a pure TCP echo server, i.e. one that sends the messages directly to the client without interacting with Redis. The result can be seen below -![](https://mzimbres.github.io/aedis/tcp-echo-direct.png) +![](https://boostorg.github.io/redis/tcp-echo-direct.png) The tests were performed with a 1000 concurrent TCP connections on the localhost where latency is 0.07ms on average on my machine. On higher @@ -671,11 +671,11 @@ decrease. The code used in the benchmarks can be found at - * [Asio](https://github.com/mzimbres/aedis/blob/3fb018ccc6138d310ac8b73540391cdd8f2fdad6/benchmarks/cpp/asio/echo_server_direct.cpp): A variation of [this](https://github.com/chriskohlhoff/asio/blob/4915cfd8a1653c157a1480162ae5601318553eb8/asio/src/examples/cpp20/coroutines/echo_server.cpp) Asio example. - * [Libuv](https://github.com/mzimbres/aedis/tree/835a1decf477b09317f391eddd0727213cdbe12b/benchmarks/c/libuv): Taken from [here](https://github.com/libuv/libuv/blob/06948c6ee502862524f233af4e2c3e4ca876f5f6/docs/code/tcp-echo-server/main.c) Libuv example . - * [Tokio](https://github.com/mzimbres/aedis/tree/3fb018ccc6138d310ac8b73540391cdd8f2fdad6/benchmarks/rust/echo_server_direct): Taken from [here](https://docs.rs/tokio/latest/tokio/). - * [Nodejs](https://github.com/mzimbres/aedis/tree/3fb018ccc6138d310ac8b73540391cdd8f2fdad6/benchmarks/nodejs/echo_server_direct) - * [Go](https://github.com/mzimbres/aedis/blob/3fb018ccc6138d310ac8b73540391cdd8f2fdad6/benchmarks/go/echo_server_direct.go) + * [Asio](https://github.com/boostorg/redis/blob/3fb018ccc6138d310ac8b73540391cdd8f2fdad6/benchmarks/cpp/asio/echo_server_direct.cpp): A variation of [this](https://github.com/chriskohlhoff/asio/blob/4915cfd8a1653c157a1480162ae5601318553eb8/asio/src/examples/cpp20/coroutines/echo_server.cpp) Asio example. + * [Libuv](https://github.com/boostorg/redis/tree/835a1decf477b09317f391eddd0727213cdbe12b/benchmarks/c/libuv): Taken from [here](https://github.com/libuv/libuv/blob/06948c6ee502862524f233af4e2c3e4ca876f5f6/docs/code/tcp-echo-server/main.c) Libuv example . + * [Tokio](https://github.com/boostorg/redis/tree/3fb018ccc6138d310ac8b73540391cdd8f2fdad6/benchmarks/rust/echo_server_direct): Taken from [here](https://docs.rs/tokio/latest/tokio/). + * [Nodejs](https://github.com/boostorg/redis/tree/3fb018ccc6138d310ac8b73540391cdd8f2fdad6/benchmarks/nodejs/echo_server_direct) + * [Go](https://github.com/boostorg/redis/blob/3fb018ccc6138d310ac8b73540391cdd8f2fdad6/benchmarks/go/echo_server_direct.go) ### With Redis @@ -684,7 +684,7 @@ echoed by Redis and not by the echo-server itself, which acts as a proxy between the client and the Redis server. The results can be seen below -![](https://mzimbres.github.io/aedis/tcp-echo-over-redis.png) +![](https://boostorg.github.io/redis/tcp-echo-over-redis.png) The tests were performed on a network where latency is 35ms on average, otherwise it uses the same number of TCP connections @@ -708,17 +708,17 @@ in the graph, the reasons are The code used in the benchmarks can be found at - * [Aedis](https://github.com/mzimbres/aedis): [code](https://github.com/mzimbres/aedis/blob/3fb018ccc6138d310ac8b73540391cdd8f2fdad6/examples/echo_server.cpp) - * [node-redis](https://github.com/redis/node-redis): [code](https://github.com/mzimbres/aedis/tree/3fb018ccc6138d310ac8b73540391cdd8f2fdad6/benchmarks/nodejs/echo_server_over_redis) - * [go-redis](https://github.com/go-redis/redis): [code](https://github.com/mzimbres/aedis/blob/3fb018ccc6138d310ac8b73540391cdd8f2fdad6/benchmarks/go/echo_server_over_redis.go) + * [Boost.Redis](https://github.com/boostorg/redis): [code](https://github.com/boostorg/redis/blob/3fb018ccc6138d310ac8b73540391cdd8f2fdad6/examples/echo_server.cpp) + * [node-redis](https://github.com/redis/node-redis): [code](https://github.com/boostorg/redis/tree/3fb018ccc6138d310ac8b73540391cdd8f2fdad6/benchmarks/nodejs/echo_server_over_redis) + * [go-redis](https://github.com/go-redis/redis): [code](https://github.com/boostorg/redis/blob/3fb018ccc6138d310ac8b73540391cdd8f2fdad6/benchmarks/go/echo_server_over_redis.go) ### Conclusion -Redis clients have to support automatic pipelining to have competitive performance. For updates to this document follow https://github.com/mzimbres/aedis. +Redis clients have to support automatic pipelining to have competitive performance. For updates to this document follow https://github.com/boostorg/redis. ## Comparison -The main reason for why I started writing Aedis was to have a client +The main reason for why I started writing Boost.Redis was to have a client compatible with the Asio asynchronous model. As I made progresses I could also address what I considered weaknesses in other libraries. Due to time constraints I won't be able to give a detailed comparison with @@ -729,7 +729,7 @@ stars, namely * https://github.com/sewenew/redis-plus-plus -### Aedis vs Redis-plus-plus +### Boost.Redis vs Redis-plus-plus Before we start it is important to mention some of the things redis-plus-plus does not support @@ -799,7 +799,7 @@ Transactions also suffer from the very same problem. > NOTE: Creating a Transaction object is NOT cheap, since it > creates a new connection. -In Aedis there is no difference between sending one command, a +In Boost.Redis there is no difference between sending one command, a pipeline or a transaction because requests are decoupled from the IO objects. @@ -836,12 +836,12 @@ It is also not clear how are pipelines realised with this design ## Installation Download the latest release on -https://github.com/mzimbres/aedis/releases. Aedis is a header only +https://github.com/boostorg/redis/releases. Boost.Redis is a header only library, so you can starting using it right away by adding the `include` subdirectory to your project and including ```cpp -#include +#include ``` in no more than one source file in your applications. To build the @@ -852,10 +852,10 @@ BOOST_ROOT=/opt/boost_1_80_0 cmake --preset dev ``` ## Acknowledgement -Acknowledgement to people that helped shape Aedis +Acknowledgement to people that helped shape Boost.Redis * Richard Hodges ([madmongo1](https://github.com/madmongo1)): For very helpful support with Asio, the design of asynchronous programs, etc. -* Vinícius dos Santos Oliveira ([vinipsmaker](https://github.com/vinipsmaker)): For useful discussion about how Aedis consumes buffers in the read operation. +* Vinícius dos Santos Oliveira ([vinipsmaker](https://github.com/vinipsmaker)): For useful discussion about how Boost.Redis consumes buffers in the read operation. * Petr Dannhofer ([Eddie-cz](https://github.com/Eddie-cz)): For helping me understand how the `AUTH` and `HELLO` command can influence each other. * Mohammad Nejati ([ashtum](https://github.com/ashtum)): For pointing out scenarios where calls to `async_exec` should fail when the connection is lost. * Klemens Morgenstern ([klemens-morgenstern](https://github.com/klemens-morgenstern)): For useful discussion about timeouts, cancellation, synchronous interfaces and general help with Asio. diff --git a/cmake/AedisConfig.cmake.in b/cmake/BoostRedisConfig.cmake.in similarity index 100% rename from cmake/AedisConfig.cmake.in rename to cmake/BoostRedisConfig.cmake.in diff --git a/examples/common/aedis.cpp b/examples/common/boost_redis.cpp similarity index 85% rename from examples/common/aedis.cpp rename to examples/common/boost_redis.cpp index d3249966..dddc80f2 100644 --- a/examples/common/aedis.cpp +++ b/examples/common/boost_redis.cpp @@ -4,4 +4,4 @@ * accompanying file LICENSE.txt) */ -#include +#include diff --git a/examples/common/common.cpp b/examples/common/common.cpp index 5655c1cb..81914c67 100644 --- a/examples/common/common.cpp +++ b/examples/common/common.cpp @@ -15,9 +15,9 @@ namespace net = boost::asio; using namespace net::experimental::awaitable_operators; using resolver = net::use_awaitable_t<>::as_default_on_t; using timer_type = net::use_awaitable_t<>::as_default_on_t; -using aedis::resp3::request; -using aedis::adapt; -using aedis::operation; +using boost::redis::resp3::request; +using boost::redis::adapt; +using boost::redis::operation; namespace { diff --git a/examples/common/common.hpp b/examples/common/common.hpp index 783cda71..3efbcea5 100644 --- a/examples/common/common.hpp +++ b/examples/common/common.hpp @@ -8,7 +8,7 @@ #define AEDIS_EXAMPLES_COMMON_HPP #include -#include +#include #include #include #include @@ -18,7 +18,7 @@ #if defined(BOOST_ASIO_HAS_CO_AWAIT) -using connection = boost::asio::use_awaitable_t<>::as_default_on_t; +using connection = boost::asio::use_awaitable_t<>::as_default_on_t; auto connect( diff --git a/examples/cpp17_intro.cpp b/examples/cpp17_intro.cpp index 08f41a3f..f49426ed 100644 --- a/examples/cpp17_intro.cpp +++ b/examples/cpp17_intro.cpp @@ -6,14 +6,15 @@ #include #include -#include -#include +#include +#include namespace net = boost::asio; -namespace resp3 = aedis::resp3; -using aedis::resp3::request; -using aedis::adapt; -using aedis::operation; +namespace redis = boost::redis; +namespace resp3 = boost::redis::resp3; +using resp3::request; +using redis::adapt; +using redis::operation; void log(boost::system::error_code const& ec, char const* prefix) { @@ -38,13 +39,13 @@ auto main(int argc, char * argv[]) -> int req.push("QUIT"); // The response. - std::tuple resp; + std::tuple resp; net::io_context ioc; // IO objects. net::ip::tcp::resolver resv{ioc}; - aedis::connection conn{ioc}; + redis::connection conn{ioc}; // Resolve endpoints. net::ip::tcp::resolver::results_type endpoints; diff --git a/examples/cpp17_intro_sync.cpp b/examples/cpp17_intro_sync.cpp index d3b28c10..fca3e267 100644 --- a/examples/cpp17_intro_sync.cpp +++ b/examples/cpp17_intro_sync.cpp @@ -9,15 +9,16 @@ #include #include #include -#include +#include // Include this in no more than one .cpp file. -#include +#include namespace net = boost::asio; -namespace resp3 = aedis::resp3; -using aedis::adapt; -using connection = aedis::connection; +namespace redis = boost::redis; +namespace resp3 = redis::resp3; +using redis::adapt; +using connection = redis::connection; template auto exec(std::shared_ptr conn, resp3::request const& req, Adapter adapter) @@ -65,7 +66,7 @@ auto main(int argc, char * argv[]) -> int req.push("PING"); req.push("QUIT"); - std::tuple resp; + std::tuple resp; // Executes commands synchronously. exec(conn, req, adapt(resp)); diff --git a/examples/cpp17_low_level_sync.cpp b/examples/cpp17_low_level_sync.cpp index 87d93a76..565a638f 100644 --- a/examples/cpp17_low_level_sync.cpp +++ b/examples/cpp17_low_level_sync.cpp @@ -8,13 +8,13 @@ #include #include - -#include -#include +#include +#include namespace net = boost::asio; -namespace resp3 = aedis::resp3; -using aedis::adapter::adapt2; +namespace redis = boost::redis; +namespace resp3 = redis::resp3; +using redis::adapter::adapt2; auto main(int argc, char * argv[]) -> int { diff --git a/examples/cpp20_chat_room.cpp b/examples/cpp20_chat_room.cpp index 7a59cc33..2542aa57 100644 --- a/examples/cpp20_chat_room.cpp +++ b/examples/cpp20_chat_room.cpp @@ -10,16 +10,16 @@ namespace net = boost::asio; #if defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR) #include -#include +#include #include #include "common/common.hpp" -namespace resp3 = aedis::resp3; +namespace resp3 = boost::redis::resp3; using namespace net::experimental::awaitable_operators; using stream_descriptor = net::use_awaitable_t<>::as_default_on_t; using signal_set = net::use_awaitable_t<>::as_default_on_t; -using aedis::adapt; +using boost::redis::adapt; // Chat over Redis pubsub. To test, run this program from multiple // terminals and type messages to stdin. diff --git a/examples/cpp20_containers.cpp b/examples/cpp20_containers.cpp index bf94ac93..ef6ba137 100644 --- a/examples/cpp20_containers.cpp +++ b/examples/cpp20_containers.cpp @@ -7,16 +7,17 @@ #include #if defined(BOOST_ASIO_HAS_CO_AWAIT) #include -#include +#include #include #include #include "common/common.hpp" namespace net = boost::asio; -namespace resp3 = aedis::resp3; +namespace redis = boost::redis; +namespace resp3 = redis::resp3; using namespace net::experimental::awaitable_operators; -using aedis::adapt; +using redis::adapt; void print(std::map const& cont) { @@ -61,7 +62,7 @@ auto hgetall(std::shared_ptr conn) -> net::awaitable req.push("HGETALL", "hset-key"); // Responses as tuple elements. - std::tuple> resp; + std::tuple> resp; // Executes the request and reads the response. co_await conn->async_exec(req, adapt(resp)); @@ -80,10 +81,10 @@ auto transaction(std::shared_ptr conn) -> net::awaitable req.push("EXEC"); std::tuple< - aedis::ignore, // hello - aedis::ignore, // multi - aedis::ignore, // lrange - aedis::ignore, // hgetall + redis::ignore, // hello + redis::ignore, // multi + redis::ignore, // lrange + redis::ignore, // hgetall std::tuple>, std::optional>> // exec > resp; diff --git a/examples/cpp20_echo_server.cpp b/examples/cpp20_echo_server.cpp index 900b30ec..f148d2a2 100644 --- a/examples/cpp20_echo_server.cpp +++ b/examples/cpp20_echo_server.cpp @@ -7,16 +7,16 @@ #include #if defined(BOOST_ASIO_HAS_CO_AWAIT) #include -#include +#include #include "common/common.hpp" namespace net = boost::asio; -namespace resp3 = aedis::resp3; +namespace resp3 = boost::redis::resp3; using namespace net::experimental::awaitable_operators; using tcp_socket = net::use_awaitable_t<>::as_default_on_t; using tcp_acceptor = net::use_awaitable_t<>::as_default_on_t; using signal_set = net::use_awaitable_t<>::as_default_on_t; -using aedis::adapt; +using boost::redis::adapt; auto echo_server_session(tcp_socket socket, std::shared_ptr conn) -> net::awaitable { diff --git a/examples/cpp20_intro.cpp b/examples/cpp20_intro.cpp index 96ab53fb..a750ca62 100644 --- a/examples/cpp20_intro.cpp +++ b/examples/cpp20_intro.cpp @@ -6,13 +6,13 @@ #include #if defined(BOOST_ASIO_HAS_CO_AWAIT) -#include +#include #include "common/common.hpp" namespace net = boost::asio; -namespace resp3 = aedis::resp3; -using aedis::adapt; -using aedis::operation; +namespace resp3 = boost::redis::resp3; +using boost::redis::adapt; +using boost::redis::operation; auto run(std::shared_ptr conn, std::string host, std::string port) -> net::awaitable { diff --git a/examples/cpp20_intro_awaitable_ops.cpp b/examples/cpp20_intro_awaitable_ops.cpp index eabded77..1f060e23 100644 --- a/examples/cpp20_intro_awaitable_ops.cpp +++ b/examples/cpp20_intro_awaitable_ops.cpp @@ -7,13 +7,13 @@ #include #if defined(BOOST_ASIO_HAS_CO_AWAIT) #include -#include +#include #include "common/common.hpp" namespace net = boost::asio; -namespace resp3 = aedis::resp3; +namespace resp3 = boost::redis::resp3; using namespace net::experimental::awaitable_operators; -using aedis::adapt; +using boost::redis::adapt; // Called from the main function (see main.cpp) auto co_main(std::string host, std::string port) -> net::awaitable @@ -23,7 +23,7 @@ auto co_main(std::string host, std::string port) -> net::awaitable req.push("PING", "Hello world"); req.push("QUIT"); - std::tuple resp; + std::tuple resp; auto conn = std::make_shared(co_await net::this_coro::executor); co_await connect(conn, host, port); diff --git a/examples/cpp20_intro_tls.cpp b/examples/cpp20_intro_tls.cpp index 69525c31..0ab45991 100644 --- a/examples/cpp20_intro_tls.cpp +++ b/examples/cpp20_intro_tls.cpp @@ -13,15 +13,16 @@ #include #include -#include -#include +#include +#include namespace net = boost::asio; -namespace resp3 = aedis::resp3; +namespace redis = boost::redis; +namespace resp3 = boost::redis::resp3; using namespace net::experimental::awaitable_operators; using resolver = net::use_awaitable_t<>::as_default_on_t; -using aedis::adapt; -using connection = net::use_awaitable_t<>::as_default_on_t; +using redis::adapt; +using connection = net::use_awaitable_t<>::as_default_on_t; auto verify_certificate(bool, net::ssl::verify_context&) -> bool { @@ -36,7 +37,7 @@ net::awaitable co_main(std::string, std::string) req.push("PING"); req.push("QUIT"); - std::tuple resp; + std::tuple resp; // Resolve auto ex = co_await net::this_coro::executor; diff --git a/examples/cpp20_low_level_async.cpp b/examples/cpp20_low_level_async.cpp index 1d7ca686..7ca52a5f 100644 --- a/examples/cpp20_low_level_async.cpp +++ b/examples/cpp20_low_level_async.cpp @@ -6,15 +6,15 @@ #include #if defined(BOOST_ASIO_HAS_CO_AWAIT) -#include +#include #include #include namespace net = boost::asio; -namespace resp3 = aedis::resp3; +namespace resp3 = boost::redis::resp3; using resolver = net::use_awaitable_t<>::as_default_on_t; using tcp_socket = net::use_awaitable_t<>::as_default_on_t; -using aedis::adapter::adapt2; +using boost::redis::adapter::adapt2; using net::ip::tcp; auto co_main(std::string host, std::string port) -> net::awaitable diff --git a/examples/cpp20_resolve_with_sentinel.cpp b/examples/cpp20_resolve_with_sentinel.cpp index 8d3beb78..7c670ace 100644 --- a/examples/cpp20_resolve_with_sentinel.cpp +++ b/examples/cpp20_resolve_with_sentinel.cpp @@ -7,15 +7,15 @@ #include #if defined(BOOST_ASIO_HAS_CO_AWAIT) #include -#include +#include #include "common/common.hpp" namespace net = boost::asio; -namespace resp3 = aedis::resp3; +namespace resp3 = boost::redis::resp3; using namespace net::experimental::awaitable_operators; using endpoints = net::ip::tcp::resolver::results_type; -using aedis::adapt; +using boost::redis::adapt; auto redir(boost::system::error_code& ec) { return net::redirect_error(net::use_awaitable, ec); } @@ -36,7 +36,7 @@ auto resolve_master_address(std::vector
const& endpoints) -> net::await auto conn = std::make_shared(co_await net::this_coro::executor); - std::tuple>, aedis::ignore> addr; + std::tuple>, boost::redis::ignore> addr; for (auto ep : endpoints) { boost::system::error_code ec; co_await connect(conn, ep.host, ep.port); diff --git a/examples/cpp20_serialization.cpp b/examples/cpp20_serialization.cpp index 260b99a6..ed4dd15a 100644 --- a/examples/cpp20_serialization.cpp +++ b/examples/cpp20_serialization.cpp @@ -10,7 +10,7 @@ #define BOOST_JSON_NO_LIB #define BOOST_CONTAINER_NO_LIB #include -#include +#include #include #include #include @@ -23,10 +23,11 @@ #include namespace net = boost::asio; -namespace resp3 = aedis::resp3; +namespace redis = boost::redis; +namespace resp3 = redis::resp3; using namespace net::experimental::awaitable_operators; using namespace boost::json; -using aedis::adapt; +using redis::adapt; struct user { std::string name; @@ -74,10 +75,10 @@ auto tag_invoke(value_to_tag, value const& jv) return u; } -// Aedis serialization +// Serialization void to_bulk(std::pmr::string& to, user const& u) { - aedis::resp3::to_bulk(to, serialize(value_from(u))); + redis::resp3::to_bulk(to, serialize(value_from(u))); } void from_bulk(user& u, std::string_view sv, boost::system::error_code&) @@ -97,7 +98,7 @@ net::awaitable co_main(std::string host, std::string port) req.push("SMEMBERS", "sadd-key"); // Retrieves req.push("QUIT"); - std::tuple, std::string> resp; + std::tuple, std::string> resp; auto conn = std::make_shared(co_await net::this_coro::executor); diff --git a/examples/cpp20_subscriber.cpp b/examples/cpp20_subscriber.cpp index 2e90de10..21b88e7f 100644 --- a/examples/cpp20_subscriber.cpp +++ b/examples/cpp20_subscriber.cpp @@ -7,15 +7,15 @@ #include #if defined(BOOST_ASIO_HAS_CO_AWAIT) #include -#include +#include #include "common/common.hpp" namespace net = boost::asio; -namespace resp3 = aedis::resp3; +namespace resp3 = boost::redis::resp3; using namespace net::experimental::awaitable_operators; using steady_timer = net::use_awaitable_t<>::as_default_on_t; -using aedis::adapt; +using boost::redis::adapt; /* This example will subscribe and read pushes indefinitely. * diff --git a/include/aedis.hpp b/include/boost/redis.hpp similarity index 65% rename from include/aedis.hpp rename to include/boost/redis.hpp index 9ab171a6..9f8c8123 100644 --- a/include/aedis.hpp +++ b/include/boost/redis.hpp @@ -4,13 +4,13 @@ * accompanying file LICENSE.txt) */ -#ifndef AEDIS_HPP -#define AEDIS_HPP +#ifndef BOOST_REDIS_HPP +#define BOOST_REDIS_HPP -#include -#include -#include -#include +#include +#include +#include +#include /** @defgroup high-level-api Reference * @@ -22,4 +22,4 @@ * This page contains the documentation of the Aedis low-level API. */ -#endif // AEDIS_HPP +#endif // BOOST_REDIS_HPP diff --git a/include/aedis/adapt.hpp b/include/boost/redis/adapt.hpp similarity index 84% rename from include/aedis/adapt.hpp rename to include/boost/redis/adapt.hpp index 54aa1927..3c46a901 100644 --- a/include/aedis/adapt.hpp +++ b/include/boost/redis/adapt.hpp @@ -4,13 +4,12 @@ * accompanying file LICENSE.txt) */ -#ifndef AEDIS_ADAPT_HPP -#define AEDIS_ADAPT_HPP - -#include -#include -#include +#ifndef BOOST_REDIS_ADAPT_HPP +#define BOOST_REDIS_ADAPT_HPP +#include +#include +#include #include #include @@ -19,7 +18,7 @@ #include #include -namespace aedis { +namespace boost::redis { /** @brief Tag used to ignore responses. * @ingroup high-level-api @@ -27,7 +26,7 @@ namespace aedis { * For example * * @code - * std::tuple resp; + * std::tuple resp; * @endcode * * will cause only the second tuple type to be parsed, the others @@ -42,7 +41,7 @@ class ignore_adapter { public: void operator()( - std::size_t, resp3::node const&, boost::system::error_code&) { } + std::size_t, resp3::node const&, system::error_code&) { } [[nodiscard]] auto get_supported_response_size() const noexcept @@ -53,8 +52,8 @@ template class static_adapter { private: static constexpr auto size = std::tuple_size::value; - using adapter_tuple = boost::mp11::mp_transform; - using variant_type = boost::mp11::mp_rename; + using adapter_tuple = mp11::mp_transform; + using variant_type = mp11::mp_rename; using adapters_array_type = std::array; adapters_array_type adapters_; @@ -73,7 +72,7 @@ public: operator()( std::size_t i, resp3::node const& nd, - boost::system::error_code& ec) + system::error_code& ec) { using std::visit; // I am usure whether this should be an error or an assertion. @@ -102,7 +101,7 @@ public: operator()( std::size_t, resp3::node const& nd, - boost::system::error_code& ec) + system::error_code& ec) { adapter_(nd, ec); } @@ -143,7 +142,7 @@ class wrapper { public: explicit wrapper(Adapter adapter) : adapter_{adapter} {} - void operator()(resp3::node const& node, boost::system::error_code& ec) + void operator()(resp3::node const& node, system::error_code& ec) { return adapter_(0, node, ec); } [[nodiscard]] @@ -192,6 +191,6 @@ auto adapt(T& t) noexcept return detail::response_traits::adapt(t); } -} // aedis +} // boost::redis -#endif // AEDIS_ADAPT_HPP +#endif // BOOST_REDIS_ADAPT_HPP diff --git a/include/aedis/adapter/adapt.hpp b/include/boost/redis/adapter/adapt.hpp similarity index 89% rename from include/aedis/adapter/adapt.hpp rename to include/boost/redis/adapter/adapt.hpp index 09729898..30aacbcc 100644 --- a/include/aedis/adapter/adapt.hpp +++ b/include/boost/redis/adapter/adapt.hpp @@ -4,12 +4,12 @@ * accompanying file LICENSE.txt) */ -#ifndef AEDIS_ADAPTER_ADAPT_HPP -#define AEDIS_ADAPTER_ADAPT_HPP +#ifndef BOOST_REDIS_ADAPTER_ADAPT_HPP +#define BOOST_REDIS_ADAPTER_ADAPT_HPP -#include +#include -namespace aedis::adapter { +namespace boost::redis::adapter { template using adapter_t = typename detail::adapter_t; @@ -75,6 +75,6 @@ template auto adapt2(T& t) noexcept { return detail::response_traits::adapt(t); } -} // aedis::adapter +} // boost::redis::adapter -#endif // AEDIS_ADAPTER_ADAPT_HPP +#endif // BOOST_REDIS_ADAPTER_ADAPT_HPP diff --git a/include/aedis/adapter/detail/adapters.hpp b/include/boost/redis/adapter/detail/adapters.hpp similarity index 88% rename from include/aedis/adapter/detail/adapters.hpp rename to include/boost/redis/adapter/detail/adapters.hpp index 957bd770..b106258e 100644 --- a/include/aedis/adapter/detail/adapters.hpp +++ b/include/boost/redis/adapter/detail/adapters.hpp @@ -4,15 +4,14 @@ * accompanying file LICENSE.txt) */ -#ifndef AEDIS_ADAPTER_ADAPTERS_HPP -#define AEDIS_ADAPTER_ADAPTERS_HPP - -#include -#include -#include -#include -#include +#ifndef BOOST_REDIS_ADAPTER_ADAPTERS_HPP +#define BOOST_REDIS_ADAPTER_ADAPTERS_HPP +#include +#include +#include +#include +#include #include #include @@ -29,12 +28,12 @@ #include #include -namespace aedis::adapter::detail { +namespace boost::redis::adapter::detail { // Serialization. template -auto from_bulk(T& i, std::string_view sv, boost::system::error_code& ec) -> typename std::enable_if::value, void>::type +auto from_bulk(T& i, std::string_view sv, system::error_code& ec) -> typename std::enable_if::value, void>::type { auto const res = std::from_chars(sv.data(), sv.data() + std::size(sv), i); if (res.ec != std::errc()) @@ -42,13 +41,13 @@ auto from_bulk(T& i, std::string_view sv, boost::system::error_code& ec) -> type } inline -void from_bulk(bool& t, std::string_view sv, boost::system::error_code&) +void from_bulk(bool& t, std::string_view sv, system::error_code&) { t = *sv.data() == 't'; } inline -void from_bulk(double& d, std::string_view sv, boost::system::error_code& ec) +void from_bulk(double& d, std::string_view sv, system::error_code& ec) { auto const res = std::from_chars(sv.data(), sv.data() + std::size(sv), d); if (res.ec != std::errc()) @@ -60,7 +59,7 @@ void from_bulk( std::basic_string& s, std::string_view sv, - boost::system::error_code&) + system::error_code&) { s.append(sv.data(), sv.size()); } @@ -68,7 +67,7 @@ from_bulk( //================================================ inline -void set_on_resp3_error(resp3::type t, boost::system::error_code& ec) +void set_on_resp3_error(resp3::type t, system::error_code& ec) { switch (t) { case resp3::type::simple_error: ec = error::resp3_simple_error; return; @@ -85,7 +84,7 @@ private: public: explicit general_aggregate(Result* c = nullptr): result_(c) {} - void operator()(resp3::node const& n, boost::system::error_code&) + void operator()(resp3::node const& n, system::error_code&) { result_->push_back({n.data_type, n.aggregate_size, n.depth, std::string{std::cbegin(n.value), std::cend(n.value)}}); } @@ -99,7 +98,7 @@ private: public: explicit general_simple(Node* t = nullptr) : result_(t) {} - void operator()(resp3::node const& n, boost::system::error_code& ec) + void operator()(resp3::node const& n, system::error_code& ec) { result_->data_type = n.data_type; result_->aggregate_size = n.aggregate_size; @@ -118,7 +117,7 @@ public: operator()( Result& result, resp3::node const& n, - boost::system::error_code& ec) + system::error_code& ec) { set_on_resp3_error(n.data_type, ec); if (ec) @@ -146,7 +145,7 @@ public: operator()( Result& result, resp3::node const& nd, - boost::system::error_code& ec) + system::error_code& ec) { set_on_resp3_error(nd.data_type, ec); if (ec) @@ -185,7 +184,7 @@ public: operator()( Result& result, resp3::node const& nd, - boost::system::error_code& ec) + system::error_code& ec) { set_on_resp3_error(nd.data_type, ec); if (ec) @@ -227,7 +226,7 @@ public: operator()( Result& result, resp3::node const& nd, - boost::system::error_code& ec) + system::error_code& ec) { set_on_resp3_error(nd.data_type, ec); if (ec) @@ -255,7 +254,7 @@ public: operator()( Result& result, resp3::node const& nd, - boost::system::error_code& ec) + system::error_code& ec) { set_on_resp3_error(nd.data_type, ec); if (ec) @@ -294,7 +293,7 @@ struct list_impl { operator()( Result& result, resp3::node const& nd, - boost::system::error_code& ec) + system::error_code& ec) { set_on_resp3_error(nd.data_type, ec); if (ec) @@ -369,7 +368,7 @@ public: void operator()( resp3::node const& nd, - boost::system::error_code& ec) + system::error_code& ec) { BOOST_ASSERT(result_); impl_(*result_, nd, ec); @@ -388,7 +387,7 @@ public: void operator()( resp3::node const& nd, - boost::system::error_code& ec) + system::error_code& ec) { if (nd.data_type == resp3::type::null) return; @@ -402,6 +401,6 @@ public: } }; -} // aedis::adapter:.detail +} // boost::redis::adapter::detail -#endif // AEDIS_ADAPTER_ADAPTERS_HPP +#endif // BOOST_REDIS_ADAPTER_ADAPTERS_HPP diff --git a/include/aedis/adapter/detail/response_traits.hpp b/include/boost/redis/adapter/detail/response_traits.hpp similarity index 89% rename from include/aedis/adapter/detail/response_traits.hpp rename to include/boost/redis/adapter/detail/response_traits.hpp index 8d3f5629..d547a548 100644 --- a/include/aedis/adapter/detail/response_traits.hpp +++ b/include/boost/redis/adapter/detail/response_traits.hpp @@ -4,14 +4,13 @@ * accompanying file LICENSE.txt) */ -#ifndef AEDIS_ADAPTER_RESPONSE_TRAITS_HPP -#define AEDIS_ADAPTER_RESPONSE_TRAITS_HPP - -#include -#include -#include -#include +#ifndef BOOST_REDIS_ADAPTER_RESPONSE_TRAITS_HPP +#define BOOST_REDIS_ADAPTER_RESPONSE_TRAITS_HPP +#include +#include +#include +#include #include #include @@ -19,7 +18,7 @@ #include #include -namespace aedis::adapter::detail { +namespace boost::redis::adapter::detail { using ignore = std::decay_t; @@ -94,8 +93,8 @@ class static_aggregate_adapter { private: using adapters_array_type = std::array< - boost::mp11::mp_rename< - boost::mp11::mp_transform< + mp11::mp_rename< + mp11::mp_transform< adapter_t, Tuple>, std::variant>, std::tuple_size::value>; @@ -128,7 +127,7 @@ public: void operator()( resp3::node const& nd, - boost::system::error_code& ec) + system::error_code& ec) { using std::visit; @@ -153,6 +152,6 @@ struct response_traits> static auto adapt(response_type& r) noexcept { return adapter_type{&r}; } }; -} // aedis::adapter::detail +} // boost::redis::adapter::detail -#endif // AEDIS_ADAPTER_RESPONSE_TRAITS_HPP +#endif // BOOST_REDIS_ADAPTER_RESPONSE_TRAITS_HPP diff --git a/include/aedis/connection.hpp b/include/boost/redis/connection.hpp similarity index 87% rename from include/aedis/connection.hpp rename to include/boost/redis/connection.hpp index 7ad8f610..da7487d6 100644 --- a/include/aedis/connection.hpp +++ b/include/boost/redis/connection.hpp @@ -4,17 +4,16 @@ * accompanying file LICENSE.txt) */ -#ifndef AEDIS_CONNECTION_HPP -#define AEDIS_CONNECTION_HPP - -#include +#ifndef BOOST_REDIS_CONNECTION_HPP +#define BOOST_REDIS_CONNECTION_HPP +#include #include #include #include -namespace aedis { +namespace boost::redis { /** @brief A connection to the Redis server. * @ingroup high-level-api @@ -59,7 +58,7 @@ public: /// Contructs from a context. explicit basic_connection( - boost::asio::io_context& ioc, + asio::io_context& ioc, std::pmr::memory_resource* resource = std::pmr::get_default_resource()) : basic_connection(ioc.get_executor(), resource) { } @@ -71,8 +70,8 @@ public: void reset_stream() { if (stream_.is_open()) { - boost::system::error_code ignore; - stream_.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ignore); + system::error_code ignore; + stream_.shutdown(asio::ip::tcp::socket::shutdown_both, ignore); stream_.close(ignore); } } @@ -95,14 +94,14 @@ public: * The completion token must have the following signature * * @code - * void f(boost::system::error_code); + * void f(system::error_code); * @endcode * * This function will complete when the connection is lost. If the - * error is boost::asio::error::eof this function will complete + * error is asio::error::eof this function will complete * without error. */ - template > + template > auto async_run(CompletionToken token = CompletionToken{}) { return base_type::async_run(std::move(token)); @@ -125,7 +124,7 @@ public: * have the following signature * * @code - * void f(boost::system::error_code, std::size_t); + * void f(system::error_code, std::size_t); * @endcode * * Where the second parameter is the size of the response in @@ -133,7 +132,7 @@ public: */ template < class Adapter = detail::response_traits::adapter_type, - class CompletionToken = boost::asio::default_completion_token_t> + class CompletionToken = asio::default_completion_token_t> auto async_exec( resp3::request const& req, Adapter adapter = adapt(), @@ -155,7 +154,7 @@ public: * have the following signature * * @code - * void f(boost::system::error_code, std::size_t); + * void f(system::error_code, std::size_t); * @endcode * * Where the second parameter is the size of the push in @@ -163,7 +162,7 @@ public: */ template < class Adapter = detail::response_traits::adapter_type, - class CompletionToken = boost::asio::default_completion_token_t> + class CompletionToken = asio::default_completion_token_t> auto async_receive( Adapter adapter = adapt(), CompletionToken token = CompletionToken{}) @@ -210,11 +209,11 @@ private: AsyncReadWriteStream stream_; }; -/** \brief A connection that uses a boost::asio::ip::tcp::socket. +/** \brief A connection that uses a asio::ip::tcp::socket. * \ingroup high-level-api */ -using connection = basic_connection; +using connection = basic_connection; -} // aedis +} // boost::redis -#endif // AEDIS_CONNECTION_HPP +#endif // BOOST_REDIS_CONNECTION_HPP diff --git a/include/aedis/detail/connection_base.hpp b/include/boost/redis/detail/connection_base.hpp similarity index 88% rename from include/aedis/detail/connection_base.hpp rename to include/boost/redis/detail/connection_base.hpp index 45ffca85..9b41fed2 100644 --- a/include/aedis/detail/connection_base.hpp +++ b/include/boost/redis/detail/connection_base.hpp @@ -4,14 +4,13 @@ * accompanying file LICENSE.txt) */ -#ifndef AEDIS_CONNECTION_BASE_HPP -#define AEDIS_CONNECTION_BASE_HPP - -#include -#include -#include -#include +#ifndef BOOST_REDIS_CONNECTION_BASE_HPP +#define BOOST_REDIS_CONNECTION_BASE_HPP +#include +#include +#include +#include #include #include #include @@ -27,7 +26,7 @@ #include #include -namespace aedis::detail { +namespace boost::redis::detail { /** Base class for high level Redis asynchronous connections. * @@ -138,9 +137,9 @@ public: { BOOST_ASSERT_MSG(req.size() <= adapter.get_supported_response_size(), "Request and response have incompatible sizes."); - return boost::asio::async_compose + return asio::async_compose < CompletionToken - , void(boost::system::error_code, std::size_t) + , void(system::error_code, std::size_t) >(detail::exec_op{&derived(), &req, adapter}, token, writer_timer_); } @@ -149,18 +148,18 @@ public: { auto f = detail::make_adapter_wrapper(adapter); - return boost::asio::async_compose + return asio::async_compose < CompletionToken - , void(boost::system::error_code, std::size_t) + , void(system::error_code, std::size_t) >(detail::receive_op{&derived(), f}, token, channel_); } template auto async_run(CompletionToken token) { - return boost::asio::async_compose + return asio::async_compose < CompletionToken - , void(boost::system::error_code) + , void(system::error_code) >(detail::run_op{&derived()}, token, writer_timer_); } @@ -169,9 +168,9 @@ public: private: using clock_type = std::chrono::steady_clock; - using clock_traits_type = boost::asio::wait_traits; - using timer_type = boost::asio::basic_waitable_timer; - using channel_type = boost::asio::experimental::channel; + using clock_traits_type = asio::wait_traits; + using timer_type = asio::basic_waitable_timer; + using channel_type = asio::experimental::channel; auto derived() -> Derived& { return static_cast(*this); } @@ -283,9 +282,9 @@ private: template auto async_wait_receive(CompletionToken token) { - return boost::asio::async_compose + return asio::async_compose < CompletionToken - , void(boost::system::error_code) + , void(system::error_code) >(wait_receive_op{&derived()}, token, channel_); } @@ -319,32 +318,32 @@ private: } auto make_dynamic_buffer() - { return boost::asio::dynamic_buffer(read_buffer_, max_read_size_); } + { return asio::dynamic_buffer(read_buffer_, max_read_size_); } template auto reader(CompletionToken&& token) { - return boost::asio::async_compose + return asio::async_compose < CompletionToken - , void(boost::system::error_code) + , void(system::error_code) >(detail::reader_op{&derived()}, token, writer_timer_); } template auto writer(CompletionToken&& token) { - return boost::asio::async_compose + return asio::async_compose < CompletionToken - , void(boost::system::error_code) + , void(system::error_code) >(detail::writer_op{&derived()}, token, writer_timer_); } template auto async_exec_read(Adapter adapter, std::size_t cmds, CompletionToken token) { - return boost::asio::async_compose + return asio::async_compose < CompletionToken - , void(boost::system::error_code, std::size_t) + , void(system::error_code, std::size_t) >(detail::exec_read_op{&derived(), adapter, cmds}, token, writer_timer_); } @@ -390,6 +389,6 @@ private: std::size_t max_read_size_ = (std::numeric_limits::max)(); }; -} // aedis +} // boost::redis::detail -#endif // AEDIS_CONNECTION_BASE_HPP +#endif // BOOST_REDIS_CONNECTION_BASE_HPP diff --git a/include/aedis/detail/connection_ops.hpp b/include/boost/redis/detail/connection_ops.hpp similarity index 82% rename from include/aedis/detail/connection_ops.hpp rename to include/boost/redis/detail/connection_ops.hpp index 5237833c..285e50d9 100644 --- a/include/aedis/detail/connection_ops.hpp +++ b/include/boost/redis/detail/connection_ops.hpp @@ -4,17 +4,16 @@ * accompanying file LICENSE.txt) */ -#ifndef AEDIS_CONNECTION_OPS_HPP -#define AEDIS_CONNECTION_OPS_HPP - -#include -#include -#include -#include -#include -#include -#include +#ifndef BOOST_REDIS_CONNECTION_OPS_HPP +#define BOOST_REDIS_CONNECTION_OPS_HPP +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -25,25 +24,25 @@ #include #include -namespace aedis::detail { +namespace boost::redis::detail { template struct wait_receive_op { Conn* conn; - boost::asio::coroutine coro{}; + asio::coroutine coro{}; template void - operator()(Self& self , boost::system::error_code ec = {}) + operator()(Self& self , system::error_code ec = {}) { BOOST_ASIO_CORO_REENTER (coro) { BOOST_ASIO_CORO_YIELD - conn->channel_.async_send(boost::system::error_code{}, 0, std::move(self)); + conn->channel_.async_send(system::error_code{}, 0, std::move(self)); AEDIS_CHECK_OP0(;); BOOST_ASIO_CORO_YIELD - conn->channel_.async_send(boost::system::error_code{}, 0, std::move(self)); + conn->channel_.async_send(system::error_code{}, 0, std::move(self)); AEDIS_CHECK_OP0(;); self.complete({}); @@ -58,12 +57,12 @@ struct exec_read_op { std::size_t cmds = 0; std::size_t read_size = 0; std::size_t index = 0; - boost::asio::coroutine coro{}; + asio::coroutine coro{}; template void operator()( Self& self - , boost::system::error_code ec = {} + , system::error_code ec = {} , std::size_t n = 0) { BOOST_ASIO_CORO_REENTER (coro) @@ -79,7 +78,7 @@ struct exec_read_op { // some data in the read bufer. if (conn->read_buffer_.empty()) { BOOST_ASIO_CORO_YIELD - boost::asio::async_read_until( + asio::async_read_until( conn->next_layer(), conn->make_dynamic_buffer(), "\r\n", std::move(self)); @@ -100,7 +99,7 @@ struct exec_read_op { resp3::async_read( conn->next_layer(), conn->make_dynamic_buffer(), - [i = index, adpt = adapter] (resp3::node const& nd, boost::system::error_code& ec) mutable { adpt(i, nd, ec); }, + [i = index, adpt = adapter] (resp3::node const& nd, system::error_code& ec) mutable { adpt(i, nd, ec); }, std::move(self)); ++index; @@ -123,12 +122,12 @@ struct receive_op { Conn* conn; Adapter adapter; std::size_t read_size = 0; - boost::asio::coroutine coro{}; + asio::coroutine coro{}; template void operator()( Self& self - , boost::system::error_code ec = {} + , system::error_code ec = {} , std::size_t n = 0) { BOOST_ASIO_CORO_REENTER (coro) @@ -142,7 +141,7 @@ struct receive_op { if (ec || is_cancelled(self)) { conn->cancel(operation::run); conn->cancel(operation::receive); - self.complete(!!ec ? ec : boost::asio::error::operation_aborted, {}); + self.complete(!!ec ? ec : asio::error::operation_aborted, {}); return; } @@ -167,12 +166,12 @@ struct exec_op { Adapter adapter{}; std::shared_ptr info = nullptr; std::size_t read_size = 0; - boost::asio::coroutine coro{}; + asio::coroutine coro{}; template void operator()( Self& self - , boost::system::error_code ec = {} + , system::error_code ec = {} , std::size_t n = 0) { BOOST_ASIO_CORO_REENTER (coro) @@ -183,13 +182,13 @@ struct exec_op { return self.complete(error::not_connected, 0); } - info = std::allocate_shared(boost::asio::get_associated_allocator(self), *req, conn->get_executor()); + info = std::allocate_shared(asio::get_associated_allocator(self), *req, conn->get_executor()); conn->add_request_info(info); EXEC_OP_WAIT: BOOST_ASIO_CORO_YIELD info->async_wait(std::move(self)); - BOOST_ASSERT(ec == boost::asio::error::operation_aborted); + BOOST_ASSERT(ec == asio::error::operation_aborted); if (info->stop_requested()) { // Don't have to call remove_request as it has already @@ -199,7 +198,7 @@ EXEC_OP_WAIT: if (is_cancelled(self)) { if (info->is_written()) { - using c_t = boost::asio::cancellation_type; + using c_t = asio::cancellation_type; auto const c = self.get_cancellation_state().cancelled(); if ((c & c_t::terminal) != c_t::none) { // Cancellation requires closing the connection @@ -255,13 +254,13 @@ EXEC_OP_WAIT: template struct run_op { Conn* conn = nullptr; - boost::asio::coroutine coro{}; + asio::coroutine coro{}; template void operator()( Self& self , std::array order = {} - , boost::system::error_code ec0 = {} - , boost::system::error_code ec1 = {}) + , system::error_code ec0 = {} + , system::error_code ec1 = {}) { BOOST_ASIO_CORO_REENTER (coro) { @@ -269,15 +268,15 @@ struct run_op { conn->read_buffer_.clear(); BOOST_ASIO_CORO_YIELD - boost::asio::experimental::make_parallel_group( + asio::experimental::make_parallel_group( [this](auto token) { return conn->reader(token);}, [this](auto token) { return conn->writer(token);} ).async_wait( - boost::asio::experimental::wait_for_one(), + asio::experimental::wait_for_one(), std::move(self)); if (is_cancelled(self)) { - self.complete(boost::asio::error::operation_aborted); + self.complete(asio::error::operation_aborted); return; } @@ -293,21 +292,21 @@ struct run_op { template struct writer_op { Conn* conn; - boost::asio::coroutine coro{}; + asio::coroutine coro{}; template void operator()( Self& self - , boost::system::error_code ec = {} + , system::error_code ec = {} , std::size_t n = 0) { - boost::ignore_unused(n); + ignore_unused(n); BOOST_ASIO_CORO_REENTER (coro) for (;;) { while (!conn->reqs_.empty() && !conn->is_waiting_response() && conn->write_buffer_.empty()) { conn->coalesce_requests(); BOOST_ASIO_CORO_YIELD - boost::asio::async_write(conn->next_layer(), boost::asio::buffer(conn->write_buffer_), std::move(self)); + asio::async_write(conn->next_layer(), asio::buffer(conn->write_buffer_), std::move(self)); AEDIS_CHECK_OP0(conn->cancel(operation::run);); conn->on_write(); @@ -337,24 +336,24 @@ struct writer_op { template struct reader_op { Conn* conn; - boost::asio::coroutine coro{}; + asio::coroutine coro{}; template void operator()( Self& self - , boost::system::error_code ec = {} + , system::error_code ec = {} , std::size_t n = 0) { - boost::ignore_unused(n); + ignore_unused(n); BOOST_ASIO_CORO_REENTER (coro) for (;;) { BOOST_ASIO_CORO_YIELD - boost::asio::async_read_until( + asio::async_read_until( conn->next_layer(), conn->make_dynamic_buffer(), "\r\n", std::move(self)); - if (ec == boost::asio::error::eof) { + if (ec == asio::error::eof) { conn->cancel(operation::run); return self.complete({}); // EOFINAE: EOF is not an error. } @@ -396,13 +395,13 @@ struct reader_op { if (!conn->is_open() || ec || is_cancelled(self)) { conn->cancel(operation::run); - self.complete(boost::asio::error::basic_errors::operation_aborted); + self.complete(asio::error::basic_errors::operation_aborted); return; } } } }; -} // aedis::detail +} // boost::redis::detail -#endif // AEDIS_CONNECTION_OPS_HPP +#endif // BOOST_REDIS_CONNECTION_OPS_HPP diff --git a/include/aedis/error.hpp b/include/boost/redis/error.hpp similarity index 84% rename from include/aedis/error.hpp rename to include/boost/redis/error.hpp index 9004bdb3..b154dc56 100644 --- a/include/aedis/error.hpp +++ b/include/boost/redis/error.hpp @@ -4,12 +4,12 @@ * accompanying file LICENSE.txt) */ -#ifndef AEDIS_ERROR_HPP -#define AEDIS_ERROR_HPP +#ifndef BOOST_REDIS_ERROR_HPP +#define BOOST_REDIS_ERROR_HPP #include -namespace aedis { +namespace boost::redis { /** \brief Generic errors. * \ingroup high-level-api @@ -70,15 +70,15 @@ enum class error * \param e Error code. * \ingroup any */ -auto make_error_code(error e) -> boost::system::error_code; +auto make_error_code(error e) -> system::error_code; -} // aedis +} // boost::redis namespace std { template<> -struct is_error_code_enum<::aedis::error> : std::true_type {}; +struct is_error_code_enum<::boost::redis::error> : std::true_type {}; } // std -#endif // AEDIS_ERROR_HPP +#endif // BOOST_REDIS_ERROR_HPP diff --git a/include/aedis/impl/error.ipp b/include/boost/redis/impl/error.ipp similarity index 80% rename from include/aedis/impl/error.ipp rename to include/boost/redis/impl/error.ipp index 81dab781..76e58770 100644 --- a/include/aedis/impl/error.ipp +++ b/include/boost/redis/impl/error.ipp @@ -4,19 +4,19 @@ * accompanying file LICENSE.txt) */ -#include +#include #include -namespace aedis { +namespace boost::redis { namespace detail { -struct error_category_impl : boost::system::error_category { +struct error_category_impl : system::error_category { virtual ~error_category_impl() = default; auto name() const noexcept -> char const* override { - return "aedis"; + return "boost.redis"; } auto message(int ev) const -> std::string override @@ -38,12 +38,12 @@ struct error_category_impl : boost::system::error_category { case error::not_a_double: return "Not a double."; case error::resp3_null: return "Got RESP3 null."; case error::not_connected: return "Not connected."; - default: BOOST_ASSERT(false); return "Aedis error."; + default: BOOST_ASSERT(false); return "Boost.Redis error."; } } }; -auto category() -> boost::system::error_category const& +auto category() -> system::error_category const& { static error_category_impl instance; return instance; @@ -51,9 +51,9 @@ auto category() -> boost::system::error_category const& } // detail -auto make_error_code(error e) -> boost::system::error_code +auto make_error_code(error e) -> system::error_code { - return boost::system::error_code{static_cast(e), detail::category()}; + return system::error_code{static_cast(e), detail::category()}; } -} // aedis +} // boost::redis::detail diff --git a/include/aedis/operation.hpp b/include/boost/redis/operation.hpp similarity index 72% rename from include/aedis/operation.hpp rename to include/boost/redis/operation.hpp index 7c8496c3..99d4f2a9 100644 --- a/include/aedis/operation.hpp +++ b/include/boost/redis/operation.hpp @@ -4,16 +4,16 @@ * accompanying file LICENSE.txt) */ -#ifndef AEDIS_OPERATION_HPP -#define AEDIS_OPERATION_HPP +#ifndef BOOST_REDIS_OPERATION_HPP +#define BOOST_REDIS_OPERATION_HPP -namespace aedis { +namespace boost::redis { /** \brief Connection operations that can be cancelled. * \ingroup high-level-api * * The operations listed below can be passed to the - * `aedis::connection::cancel` member function. + * `boost::redis::connection::cancel` member function. */ enum class operation { /// Refers to `connection::async_exec` operations. @@ -24,6 +24,6 @@ enum class operation { receive, }; -} // aedis +} // boost::redis -#endif // AEDIS_OPERATION_HPP +#endif // BOOST_REDIS_OPERATION_HPP diff --git a/include/aedis/resp3/detail/impl/parser.ipp b/include/boost/redis/resp3/detail/impl/parser.ipp similarity index 93% rename from include/aedis/resp3/detail/impl/parser.ipp rename to include/boost/redis/resp3/detail/impl/parser.ipp index 654ea14e..e740936a 100644 --- a/include/aedis/resp3/detail/impl/parser.ipp +++ b/include/boost/redis/resp3/detail/impl/parser.ipp @@ -4,16 +4,15 @@ * accompanying file LICENSE.txt) */ -#include -#include - +#include +#include #include #include -namespace aedis::resp3::detail { +namespace boost::redis::resp3::detail { -void to_int(int_type& i, std::string_view sv, boost::system::error_code& ec) +void to_int(int_type& i, std::string_view sv, system::error_code& ec) { auto const res = std::from_chars(sv.data(), sv.data() + std::size(sv), i); if (res.ec != std::errc()) @@ -29,7 +28,7 @@ auto parser::consume( char const* data, std::size_t n, - boost::system::error_code& ec) -> std::pair + system::error_code& ec) -> std::pair { node_type ret; if (bulk_expected()) { @@ -153,4 +152,4 @@ parser::consume( return std::make_pair(ret, n); } -} // aedis::resp3::detail +} // boost::redis::resp3::detail diff --git a/include/aedis/resp3/detail/parser.hpp b/include/boost/redis/resp3/detail/parser.hpp similarity index 89% rename from include/aedis/resp3/detail/parser.hpp rename to include/boost/redis/resp3/detail/parser.hpp index 3431d988..a324d806 100644 --- a/include/aedis/resp3/detail/parser.hpp +++ b/include/boost/redis/resp3/detail/parser.hpp @@ -4,17 +4,17 @@ * accompanying file LICENSE.txt) */ -#ifndef AEDIS_RESP3_PARSER_HPP -#define AEDIS_RESP3_PARSER_HPP +#ifndef BOOST_REDIS_RESP3_PARSER_HPP +#define BOOST_REDIS_RESP3_PARSER_HPP -#include +#include #include #include #include #include -namespace aedis::resp3::detail { +namespace boost::redis::resp3::detail { using int_type = std::uint64_t; @@ -64,6 +64,6 @@ public: { return bulk_length_; } }; -} // detail::resp3::aedis +} // boost::redis::detail::resp3 -#endif // AEDIS_RESP3_PARSER_HPP +#endif // BOOST_REDIS_RESP3_PARSER_HPP diff --git a/include/aedis/resp3/detail/read_ops.hpp b/include/boost/redis/resp3/detail/read_ops.hpp similarity index 76% rename from include/aedis/resp3/detail/read_ops.hpp rename to include/boost/redis/resp3/detail/read_ops.hpp index cc8f4e42..9f850fec 100644 --- a/include/aedis/resp3/detail/read_ops.hpp +++ b/include/boost/redis/resp3/detail/read_ops.hpp @@ -4,11 +4,10 @@ * accompanying file LICENSE.txt) */ -#ifndef AEDIS_RESP3_READ_OPS_HPP -#define AEDIS_RESP3_READ_OPS_HPP - -#include +#ifndef BOOST_REDIS_RESP3_READ_OPS_HPP +#define BOOST_REDIS_RESP3_READ_OPS_HPP +#include #include #include #include @@ -17,33 +16,33 @@ #include -namespace aedis::detail +namespace boost::redis::detail { template auto is_cancelled(T const& self) { - return self.get_cancellation_state().cancelled() != boost::asio::cancellation_type_t::none; + return self.get_cancellation_state().cancelled() != asio::cancellation_type_t::none; } } #define AEDIS_CHECK_OP0(X)\ - if (ec || aedis::detail::is_cancelled(self)) {\ + if (ec || redis::detail::is_cancelled(self)) {\ X\ - self.complete(!!ec ? ec : boost::asio::error::operation_aborted);\ + self.complete(!!ec ? ec : asio::error::operation_aborted);\ return;\ } #define AEDIS_CHECK_OP1(X)\ - if (ec || aedis::detail::is_cancelled(self)) {\ + if (ec || redis::detail::is_cancelled(self)) {\ X\ - self.complete(!!ec ? ec : boost::asio::error::operation_aborted, {});\ + self.complete(!!ec ? ec : asio::error::operation_aborted, {});\ return;\ } -namespace aedis::resp3::detail { +namespace boost::redis::resp3::detail { struct ignore_response { - void operator()(node nd, boost::system::error_code& ec) + void operator()(node nd, system::error_code& ec) { switch (nd.data_type) { case resp3::type::simple_error: ec = error::resp3_simple_error; return; @@ -65,7 +64,7 @@ private: ResponseAdapter adapter_; std::size_t consumed_ = 0; std::size_t buffer_size_ = 0; - boost::asio::coroutine coro_{}; + asio::coroutine coro_{}; public: parse_op(AsyncReadStream& stream, DynamicBuffer buf, ResponseAdapter adapter) @@ -76,13 +75,13 @@ public: template void operator()( Self& self - , boost::system::error_code ec = {} + , system::error_code ec = {} , std::size_t n = 0) { BOOST_ASIO_CORO_REENTER (coro_) for (;;) { if (!parser_.bulk_expected()) { BOOST_ASIO_CORO_YIELD - boost::asio::async_read_until(stream_, buf_, "\r\n", std::move(self)); + asio::async_read_until(stream_, buf_, "\r\n", std::move(self)); AEDIS_CHECK_OP1(;); } else { // On a bulk read we can't read until delimiter since the @@ -97,10 +96,10 @@ public: buf_.grow(parser_.bulk_length() + 2 - buffer_size_); BOOST_ASIO_CORO_YIELD - boost::asio::async_read( + asio::async_read( stream_, buf_.data(buffer_size_, parser_.bulk_length() + 2 - buffer_size_), - boost::asio::transfer_all(), + asio::transfer_all(), std::move(self)); AEDIS_CHECK_OP1(;); } @@ -129,6 +128,6 @@ public: } }; -} // aedis::resp3::detail +} // boost::redis::resp3::detail -#endif // AEDIS_RESP3_READ_OPS_HPP +#endif // BOOST_REDIS_RESP3_READ_OPS_HPP diff --git a/include/aedis/resp3/impl/request.ipp b/include/boost/redis/resp3/impl/request.ipp similarity index 77% rename from include/aedis/resp3/impl/request.ipp rename to include/boost/redis/resp3/impl/request.ipp index 1ff230f2..455d4459 100644 --- a/include/aedis/resp3/impl/request.ipp +++ b/include/boost/redis/resp3/impl/request.ipp @@ -4,11 +4,11 @@ * accompanying file LICENSE.txt) */ -#include +#include #include -namespace aedis::resp3::detail { +namespace boost::redis::resp3::detail { auto has_response(std::string_view cmd) -> bool { @@ -18,4 +18,4 @@ auto has_response(std::string_view cmd) -> bool return false; } -} // aedis::resp3::detail +} // boost:redis::resp3::detail diff --git a/include/aedis/resp3/impl/type.ipp b/include/boost/redis/resp3/impl/type.ipp similarity index 97% rename from include/aedis/resp3/impl/type.ipp rename to include/boost/redis/resp3/impl/type.ipp index cb40ffaf..d80cd855 100644 --- a/include/aedis/resp3/impl/type.ipp +++ b/include/boost/redis/resp3/impl/type.ipp @@ -4,10 +4,10 @@ * accompanying file LICENSE.txt) */ -#include +#include #include -namespace aedis::resp3 { +namespace boost::redis::resp3 { auto to_string(type t) -> char const* { @@ -107,4 +107,4 @@ auto to_type(char c) -> type } } -} // aedis::resp3 +} // boost::redis::resp3 diff --git a/include/aedis/resp3/node.hpp b/include/boost/redis/resp3/node.hpp similarity index 87% rename from include/aedis/resp3/node.hpp rename to include/boost/redis/resp3/node.hpp index a3d4bcd5..befe59d3 100644 --- a/include/aedis/resp3/node.hpp +++ b/include/boost/redis/resp3/node.hpp @@ -4,19 +4,19 @@ * accompanying file LICENSE.txt) */ -#ifndef AEDIS_RESP3_NODE_HPP -#define AEDIS_RESP3_NODE_HPP +#ifndef BOOST_REDIS_RESP3_NODE_HPP +#define BOOST_REDIS_RESP3_NODE_HPP -#include +#include -namespace aedis::resp3 { +namespace boost::redis::resp3 { /** \brief A node in the response tree. * \ingroup high-level-api * * RESP3 can contain recursive data structures: A map of sets of * vector of etc. As it is parsed each element is passed to user - * callbacks (push parser), the `aedis::adapt` function. The signature of this + * callbacks (push parser), the `boost::redis::adapt` function. The signature of this * callback is `f(resp3::node const& a, node const& b) && a.value == b.value; }; -} // aedis::resp3 +} // boost::redis::resp3 -#endif // AEDIS_RESP3_NODE_HPP +#endif // BOOST_REDIS_RESP3_NODE_HPP diff --git a/include/aedis/resp3/read.hpp b/include/boost/redis/resp3/read.hpp similarity index 84% rename from include/aedis/resp3/read.hpp rename to include/boost/redis/resp3/read.hpp index 6f346d7a..5d4ea635 100644 --- a/include/aedis/resp3/read.hpp +++ b/include/boost/redis/resp3/read.hpp @@ -4,18 +4,17 @@ * accompanying file LICENSE.txt) */ -#ifndef AEDIS_RESP3_READ_HPP -#define AEDIS_RESP3_READ_HPP - -#include -#include -#include +#ifndef BOOST_REDIS_RESP3_READ_HPP +#define BOOST_REDIS_RESP3_READ_HPP +#include +#include +#include #include #include #include -namespace aedis::resp3 { +namespace boost::redis::resp3 { /** \brief Reads a complete response to a command sychronously. * \ingroup low-level-api @@ -57,14 +56,14 @@ read( SyncReadStream& stream, DynamicBuffer buf, ResponseAdapter adapter, - boost::system::error_code& ec) -> std::size_t + system::error_code& ec) -> std::size_t { detail::parser p; std::size_t n = 0; std::size_t consumed = 0; do { if (!p.bulk_expected()) { - n = boost::asio::read_until(stream, buf, "\r\n", ec); + n = asio::read_until(stream, buf, "\r\n", ec); if (ec) return 0; @@ -74,7 +73,7 @@ read( if (s < (l + 2)) { auto const to_read = l + 2 - s; buf.grow(to_read); - n = boost::asio::read(stream, buf.data(s, to_read), ec); + n = asio::read(stream, buf.data(s, to_read), ec); if (ec) return 0; } @@ -113,11 +112,11 @@ read( DynamicBuffer buf, ResponseAdapter adapter = ResponseAdapter{}) { - boost::system::error_code ec; + system::error_code ec; auto const n = resp3::read(stream, buf, adapter, ec); if (ec) - BOOST_THROW_EXCEPTION(boost::system::system_error{ec}); + BOOST_THROW_EXCEPTION(system::system_error{ec}); return n; } @@ -153,7 +152,7 @@ read( * following signature * * @code - * void(boost::system::error_code, std::size_t); + * void(system::error_code, std::size_t); * @endcode * * \remark This function calls buf.consume() in each chunk of data @@ -164,23 +163,23 @@ template < class AsyncReadStream, class DynamicBuffer, class ResponseAdapter = detail::ignore_response, - class CompletionToken = boost::asio::default_completion_token_t + class CompletionToken = asio::default_completion_token_t > auto async_read( AsyncReadStream& stream, DynamicBuffer buffer, ResponseAdapter adapter = ResponseAdapter{}, CompletionToken&& token = - boost::asio::default_completion_token_t{}) + asio::default_completion_token_t{}) { - return boost::asio::async_compose + return asio::async_compose < CompletionToken - , void(boost::system::error_code, std::size_t) + , void(system::error_code, std::size_t) >(detail::parse_op {stream, buffer, adapter}, token, stream); } -} // aedis::resp3 +} // boost::redis::resp3 -#endif // AEDIS_RESP3_READ_HPP +#endif // BOOST_REDIS_RESP3_READ_HPP diff --git a/include/aedis/resp3/request.hpp b/include/boost/redis/resp3/request.hpp similarity index 93% rename from include/aedis/resp3/request.hpp rename to include/boost/redis/resp3/request.hpp index 2b435f5d..05fed8d3 100644 --- a/include/aedis/resp3/request.hpp +++ b/include/boost/redis/resp3/request.hpp @@ -4,10 +4,10 @@ * accompanying file LICENSE.txt) */ -#ifndef AEDIS_RESP3_REQUEST_HPP -#define AEDIS_RESP3_REQUEST_HPP +#ifndef BOOST_REDIS_RESP3_REQUEST_HPP +#define BOOST_REDIS_RESP3_REQUEST_HPP -#include +#include #include #include @@ -19,7 +19,7 @@ // NOTE: For some commands like hset it would be a good idea to assert // the value type is a pair. -namespace aedis::resp3 { +namespace boost::redis::resp3 { constexpr char const* separator = "\r\n"; @@ -70,7 +70,7 @@ struct add_bulk_impl { template static void add(Request& to, T const& from) { - using namespace aedis::resp3; + using namespace boost::redis::resp3; to_bulk(to, from); } }; @@ -82,7 +82,7 @@ struct add_bulk_impl> { { auto f = [&](auto const&... vs) { - using namespace aedis::resp3; + using namespace boost::redis::resp3; (to_bulk(to, vs), ...); }; @@ -95,7 +95,7 @@ struct add_bulk_impl> { template static void add(Request& to, std::pair const& from) { - using namespace aedis::resp3; + using namespace boost::redis::resp3; to_bulk(to, from.first); to_bulk(to, from.second); } @@ -171,7 +171,7 @@ public: /// Request configuration options. struct config { /** \brief If `true` - * `aedis::connection::async_exec` will complete with error if the + * `boost::redis::connection::async_exec` will complete with error if the * connection is lost. Affects only requests that haven't been * sent yet. */ @@ -184,21 +184,21 @@ public: bool coalesce = true; /** \brief If `true` the request will complete with - * aedis::error::not_connected if `async_exec` is called before + * boost::redis::error::not_connected if `async_exec` is called before * the connection with Redis was established. */ bool cancel_if_not_connected = false; - /** \brief If `false` `aedis::connection::async_exec` will not + /** \brief If `false` `boost::redis::connection::async_exec` will not * automatically cancel this request if the connection is lost. * Affects only requests that have been written to the socket - * but remained unresponded when `aedis::connection::async_run` + * but remained unresponded when `boost::redis::connection::async_run` * completed. */ bool cancel_if_unresponded = true; /** \brief If this request has a `HELLO` command and this flag is - * `true`, the `aedis::connection` will move it to the front of + * `true`, the `boost::redis::connection` will move it to the front of * the queue of awaiting requests. This makes it possible to * send `HELLO` and authenticate before other commands are sent. */ @@ -400,6 +400,6 @@ private: bool has_hello_priority_ = false; }; -} // aedis::resp3 +} // boost::redis::redis::resp3 -#endif // AEDIS_RESP3_SERIALIZER_HPP +#endif // BOOST_REDIS_RESP3_REQUEST_HPP diff --git a/include/aedis/resp3/type.hpp b/include/boost/redis/resp3/type.hpp similarity index 91% rename from include/aedis/resp3/type.hpp rename to include/boost/redis/resp3/type.hpp index 5d5d613a..340082c0 100644 --- a/include/aedis/resp3/type.hpp +++ b/include/boost/redis/resp3/type.hpp @@ -4,14 +4,14 @@ * accompanying file LICENSE.txt) */ -#ifndef AEDIS_RESP3_TYPE_HPP -#define AEDIS_RESP3_TYPE_HPP +#ifndef BOOST_REDIS_RESP3_TYPE_HPP +#define BOOST_REDIS_RESP3_TYPE_HPP #include #include #include -namespace aedis::resp3 { +namespace boost::redis::resp3 { /** \brief RESP3 data types. \ingroup high-level-api @@ -84,6 +84,6 @@ auto to_code(type t) -> char; // Converts a wire-format RESP3 type (char) to a resp3 type. auto to_type(char c) -> type; -} // aedis::resp3 +} // boost::redis::resp3 -#endif // AEDIS_RESP3_TYPE_HPP +#endif // BOOST_REDIS_RESP3_TYPE_HPP diff --git a/include/aedis/resp3/write.hpp b/include/boost/redis/resp3/write.hpp similarity index 61% rename from include/aedis/resp3/write.hpp rename to include/boost/redis/resp3/write.hpp index 39db5f79..c0a4e671 100644 --- a/include/aedis/resp3/write.hpp +++ b/include/boost/redis/resp3/write.hpp @@ -4,12 +4,12 @@ * accompanying file LICENSE.txt) */ -#ifndef AEDIS_RESP3_WRITE_HPP -#define AEDIS_RESP3_WRITE_HPP +#ifndef BOOST_REDIS_RESP3_WRITE_HPP +#define BOOST_REDIS_RESP3_WRITE_HPP #include -namespace aedis::resp3 { +namespace boost::redis::resp3 { /** \brief Writes a request synchronously. * \ingroup low-level-api @@ -23,7 +23,7 @@ template< > auto write(SyncWriteStream& stream, Request const& req) { - return boost::asio::write(stream, boost::asio::buffer(req.payload())); + return asio::write(stream, asio::buffer(req.payload())); } template< @@ -33,9 +33,9 @@ template< auto write( SyncWriteStream& stream, Request const& req, - boost::system::error_code& ec) + system::error_code& ec) { - return boost::asio::write(stream, boost::asio::buffer(req.payload()), ec); + return asio::write(stream, asio::buffer(req.payload()), ec); } /** \brief Writes a request asynchronously. @@ -48,17 +48,17 @@ auto write( template< class AsyncWriteStream, class Request, - class CompletionToken = boost::asio::default_completion_token_t + class CompletionToken = asio::default_completion_token_t > auto async_write( AsyncWriteStream& stream, Request const& req, CompletionToken&& token = - boost::asio::default_completion_token_t{}) + asio::default_completion_token_t{}) { - return boost::asio::async_write(stream, boost::asio::buffer(req.payload()), token); + return asio::async_write(stream, asio::buffer(req.payload()), token); } -} // aedis::resp3 +} // boost::redis::resp3 -#endif // AEDIS_RESP3_WRITE_HPP +#endif // BOOST_REDIS_RESP3_WRITE_HPP diff --git a/include/aedis/src.hpp b/include/boost/redis/src.hpp similarity index 50% rename from include/aedis/src.hpp rename to include/boost/redis/src.hpp index 2eeddd83..21392c57 100644 --- a/include/aedis/src.hpp +++ b/include/boost/redis/src.hpp @@ -4,7 +4,7 @@ * accompanying file LICENSE.txt) */ -#include -#include -#include -#include +#include +#include +#include +#include diff --git a/include/aedis/ssl/connection.hpp b/include/boost/redis/ssl/connection.hpp similarity index 63% rename from include/aedis/ssl/connection.hpp rename to include/boost/redis/ssl/connection.hpp index d95e3354..d2c2b0c9 100644 --- a/include/aedis/ssl/connection.hpp +++ b/include/boost/redis/ssl/connection.hpp @@ -4,17 +4,16 @@ * accompanying file LICENSE.txt) */ -#ifndef AEDIS_SSL_CONNECTION_HPP -#define AEDIS_SSL_CONNECTION_HPP - -#include +#ifndef BOOST_REDIS_SSL_CONNECTION_HPP +#define BOOST_REDIS_SSL_CONNECTION_HPP +#include #include #include #include -namespace aedis::ssl { +namespace boost::redis::ssl { template class basic_connection; @@ -31,13 +30,13 @@ class basic_connection; * */ template -class basic_connection> : - private aedis::detail::connection_base< - typename boost::asio::ssl::stream::executor_type, - basic_connection>> { +class basic_connection> : + private redis::detail::connection_base< + typename asio::ssl::stream::executor_type, + basic_connection>> { public: /// Type of the next layer - using next_layer_type = boost::asio::ssl::stream; + using next_layer_type = asio::ssl::stream; /// Executor type. using executor_type = typename next_layer_type::executor_type; @@ -47,16 +46,16 @@ public: struct rebind_executor { /// The socket type when rebound to the specified executor. - using other = basic_connection::other>>; + using other = basic_connection::other>>; }; - using base_type = aedis::detail::connection_base>>; + using base_type = redis::detail::connection_base>>; /// Constructor explicit basic_connection( executor_type ex, - boost::asio::ssl::context& ctx, + asio::ssl::context& ctx, std::pmr::memory_resource* resource = std::pmr::get_default_resource()) : base_type{ex, resource} , stream_{ex, ctx} @@ -65,8 +64,8 @@ public: /// Constructor explicit basic_connection( - boost::asio::io_context& ioc, - boost::asio::ssl::context& ctx, + asio::io_context& ioc, + asio::ssl::context& ctx, std::pmr::memory_resource* resource = std::pmr::get_default_resource()) : basic_connection(ioc.get_executor(), ctx, resource) { } @@ -75,7 +74,7 @@ public: auto get_executor() {return stream_.get_executor();} /// Reset the underlying stream. - void reset_stream(boost::asio::ssl::context& ctx) + void reset_stream(asio::ssl::context& ctx) { stream_ = next_layer_type{stream_.get_executor(), ctx}; } @@ -88,9 +87,9 @@ public: /** @brief Establishes a connection with the Redis server asynchronously. * - * See aedis::connection::async_run for more information. + * See redis::connection::async_run for more information. */ - template > + template > auto async_run(CompletionToken token = CompletionToken{}) { return base_type::async_run(std::move(token)); @@ -98,11 +97,11 @@ public: /** @brief Executes a command on the Redis server asynchronously. * - * See aedis::connection::async_exec for more information. + * See redis::connection::async_exec for more information. */ template < - class Adapter = aedis::detail::response_traits::adapter_type, - class CompletionToken = boost::asio::default_completion_token_t> + class Adapter = redis::detail::response_traits::adapter_type, + class CompletionToken = asio::default_completion_token_t> auto async_exec( resp3::request const& req, Adapter adapter = adapt(), @@ -113,11 +112,11 @@ public: /** @brief Receives server side pushes asynchronously. * - * See aedis::connection::async_receive for detailed information. + * See redis::connection::async_receive for detailed information. */ template < - class Adapter = aedis::detail::response_traits::adapter_type, - class CompletionToken = boost::asio::default_completion_token_t> + class Adapter = redis::detail::response_traits::adapter_type, + class CompletionToken = asio::default_completion_token_t> auto async_receive( Adapter adapter = adapt(), CompletionToken token = CompletionToken{}) @@ -127,7 +126,7 @@ public: /** @brief Cancel operations. * - * See aedis::connection::cancel for more information. + * See redis::connection::cancel for more information. */ auto cancel(operation op) -> std::size_t { return base_type::cancel(op); } @@ -141,13 +140,13 @@ public: private: using this_type = basic_connection; - template friend class aedis::detail::connection_base; - template friend struct aedis::detail::exec_op; - template friend struct aedis::detail::exec_read_op; + template friend class redis::detail::connection_base; + template friend struct redis::detail::exec_op; + template friend struct redis::detail::exec_read_op; template friend struct detail::receive_op; - template friend struct aedis::detail::run_op; - template friend struct aedis::detail::writer_op; - template friend struct aedis::detail::reader_op; + template friend struct redis::detail::run_op; + template friend struct redis::detail::writer_op; + template friend struct redis::detail::reader_op; template friend struct detail::wait_receive_op; auto is_open() const noexcept { return stream_.next_layer().is_open(); } @@ -159,8 +158,8 @@ private: /** \brief A connection that uses a boost::asio::ssl::stream. * \ingroup high-level-api */ -using connection = basic_connection>; +using connection = basic_connection>; -} // aedis::ssl +} // boost::redis::ssl -#endif // AEDIS_SSL_CONNECTION_HPP +#endif // BOOST_REDIS_SSL_CONNECTION_HPP diff --git a/tests/conn_echo_stress.cpp b/tests/conn_echo_stress.cpp index 4fb651aa..084ea03f 100644 --- a/tests/conn_echo_stress.cpp +++ b/tests/conn_echo_stress.cpp @@ -10,16 +10,16 @@ #include #define BOOST_TEST_MODULE low level #include -#include -#include +#include +#include #include "common.hpp" #include "../examples/common/common.hpp" namespace net = boost::asio; -namespace resp3 = aedis::resp3; +namespace resp3 = boost::redis::resp3; using error_code = boost::system::error_code; -using aedis::operation; -using aedis::adapt; +using boost::redis::operation; +using boost::redis::adapt; auto push_consumer(std::shared_ptr conn, int expected) -> net::awaitable { @@ -41,7 +41,7 @@ auto echo_session(std::shared_ptr conn, std::string id, int n) -> ne auto ex = co_await net::this_coro::executor; resp3::request req; - std::tuple resp; + std::tuple resp; for (auto i = 0; i < n; ++i) { auto const msg = id + "/" + std::to_string(i); diff --git a/tests/conn_exec.cpp b/tests/conn_exec.cpp index 8e679dbb..2de65c56 100644 --- a/tests/conn_exec.cpp +++ b/tests/conn_exec.cpp @@ -11,8 +11,8 @@ #define BOOST_TEST_MODULE low level #include -#include -#include +#include +#include #include "common.hpp" @@ -20,10 +20,10 @@ // been already writen. namespace net = boost::asio; -namespace resp3 = aedis::resp3; +namespace resp3 = boost::redis::resp3; using error_code = boost::system::error_code; -using connection = aedis::connection; -using aedis::adapt; +using connection = boost::redis::connection; +using boost::redis::adapt; BOOST_AUTO_TEST_CASE(hello_priority) { @@ -90,7 +90,7 @@ BOOST_AUTO_TEST_CASE(wrong_response_data_type) req.push("QUIT"); // Wrong data type. - std::tuple resp; + std::tuple resp; net::io_context ioc; auto const endpoints = resolve(); @@ -98,7 +98,7 @@ BOOST_AUTO_TEST_CASE(wrong_response_data_type) net::connect(conn.next_layer(), endpoints); conn.async_exec(req, adapt(resp), [](auto ec, auto){ - BOOST_CHECK_EQUAL(ec, aedis::error::not_a_number); + BOOST_CHECK_EQUAL(ec, boost::redis::error::not_a_number); }); conn.async_run([](auto ec){ BOOST_CHECK_EQUAL(ec, boost::asio::error::basic_errors::operation_aborted); @@ -117,7 +117,7 @@ BOOST_AUTO_TEST_CASE(cancel_request_if_not_connected) net::io_context ioc; auto conn = std::make_shared(ioc); conn->async_exec(req, adapt(), [](auto ec, auto){ - BOOST_CHECK_EQUAL(ec, aedis::error::not_connected); + BOOST_CHECK_EQUAL(ec, boost::redis::error::not_connected); }); ioc.run(); diff --git a/tests/conn_exec_cancel.cpp b/tests/conn_exec_cancel.cpp index 6f7b5914..8ea8eea7 100644 --- a/tests/conn_exec_cancel.cpp +++ b/tests/conn_exec_cancel.cpp @@ -11,8 +11,8 @@ #include #define BOOST_TEST_MODULE low level #include -#include -#include +#include +#include #include "common.hpp" #include "../examples/common/common.hpp" @@ -22,11 +22,11 @@ // separately here. namespace net = boost::asio; -namespace resp3 = aedis::resp3; +namespace resp3 = boost::redis::resp3; using error_code = boost::system::error_code; using namespace net::experimental::awaitable_operators; -using aedis::operation; -using aedis::adapt; +using boost::redis::operation; +using boost::redis::adapt; auto async_ignore_explicit_cancel_of_req_written() -> net::awaitable { diff --git a/tests/conn_exec_retry.cpp b/tests/conn_exec_retry.cpp index e110d328..632bad80 100644 --- a/tests/conn_exec_retry.cpp +++ b/tests/conn_exec_retry.cpp @@ -11,16 +11,16 @@ #define BOOST_TEST_MODULE low level #include -#include -#include +#include +#include #include "common.hpp" namespace net = boost::asio; -namespace resp3 = aedis::resp3; +namespace resp3 = boost::redis::resp3; using error_code = boost::system::error_code; -using connection = aedis::connection; -using aedis::adapt; +using connection = boost::redis::connection; +using boost::redis::adapt; BOOST_AUTO_TEST_CASE(request_retry_false) { @@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE(request_retry_false) // although it has cancel_on_connection_lost = false. The reason // being is has already been written so // cancel_on_connection_lost does not apply. - conn.cancel(aedis::operation::run); + conn.cancel(boost::redis::operation::run); }); auto const endpoints = resolve(); @@ -110,7 +110,7 @@ BOOST_AUTO_TEST_CASE(request_retry_true) // should cause the thrid request to not complete with error // since it has cancel_if_unresponded = true and cancellation commes // after it was written. - conn.cancel(aedis::operation::run); + conn.cancel(boost::redis::operation::run); }); auto const endpoints = resolve(); diff --git a/tests/conn_push.cpp b/tests/conn_push.cpp index 748c3f72..20d917cb 100644 --- a/tests/conn_push.cpp +++ b/tests/conn_push.cpp @@ -13,16 +13,16 @@ #define BOOST_TEST_MODULE low level #include -#include -#include +#include +#include #include "common.hpp" namespace net = boost::asio; -using aedis::resp3::request; -using aedis::adapt; -using aedis::operation; -using connection = aedis::connection; +using boost::redis::resp3::request; +using boost::redis::adapt; +using boost::redis::operation; +using connection = boost::redis::connection; using error_code = boost::system::error_code; using net::experimental::as_tuple; @@ -39,7 +39,7 @@ BOOST_AUTO_TEST_CASE(push_filtered_out) req.push("SUBSCRIBE", "channel"); req.push("QUIT"); - std::tuple resp; + std::tuple resp; conn.async_exec(req, adapt(resp), [](auto ec, auto){ BOOST_TEST(!ec); }); @@ -75,7 +75,7 @@ void receive_wrong_syntax(request const& req) conn.async_receive(adapt(), [&](auto ec, auto){ BOOST_TEST(!ec); - conn.cancel(aedis::operation::run); + conn.cancel(boost::redis::operation::run); }); ioc.run(); @@ -100,9 +100,9 @@ net::awaitable push_consumer1(connection& conn, bool& push_received) struct adapter_error { void operator()( - std::size_t, aedis::resp3::node const&, boost::system::error_code& ec) + std::size_t, boost::redis::resp3::node const&, boost::system::error_code& ec) { - ec = aedis::error::incompatible_size; + ec = boost::redis::error::incompatible_size; } [[nodiscard]] @@ -124,7 +124,7 @@ BOOST_AUTO_TEST_CASE(test_push_adapter) req.push("PING"); conn.async_receive(adapter_error{}, [](auto ec, auto) { - BOOST_CHECK_EQUAL(ec, aedis::error::incompatible_size); + BOOST_CHECK_EQUAL(ec, boost::redis::error::incompatible_size); }); conn.async_exec(req, adapt(), [](auto ec, auto){ diff --git a/tests/conn_quit.cpp b/tests/conn_quit.cpp index 24dcf883..3aa13395 100644 --- a/tests/conn_quit.cpp +++ b/tests/conn_quit.cpp @@ -11,17 +11,17 @@ #define BOOST_TEST_MODULE low level #include -#include -#include +#include +#include #include "common.hpp" namespace net = boost::asio; -using aedis::adapt; -using aedis::resp3::request; -using connection = aedis::connection; +using boost::redis::adapt; +using boost::redis::resp3::request; +using connection = boost::redis::connection; using error_code = boost::system::error_code; -using operation = aedis::operation; +using operation = boost::redis::operation; // Test if quit causes async_run to exit. BOOST_AUTO_TEST_CASE(test_quit_no_coalesce) diff --git a/tests/conn_quit_coalesce.cpp b/tests/conn_quit_coalesce.cpp index 7e9f2b89..8cb8bba7 100644 --- a/tests/conn_quit_coalesce.cpp +++ b/tests/conn_quit_coalesce.cpp @@ -11,17 +11,17 @@ #define BOOST_TEST_MODULE low level #include -#include -#include +#include +#include #include "common.hpp" namespace net = boost::asio; -using aedis::adapt; -using aedis::resp3::request; -using connection = aedis::connection; +using boost::redis::adapt; +using boost::redis::resp3::request; +using connection = boost::redis::connection; using error_code = boost::system::error_code; -using operation = aedis::operation; +using operation = boost::redis::operation; BOOST_AUTO_TEST_CASE(test_quit_coalesce) { diff --git a/tests/conn_reconnect.cpp b/tests/conn_reconnect.cpp index 752209a7..c7580354 100644 --- a/tests/conn_reconnect.cpp +++ b/tests/conn_reconnect.cpp @@ -11,15 +11,15 @@ #define BOOST_TEST_MODULE low level #include -#include -#include +#include +#include #include "common.hpp" #include "../examples/common/common.hpp" namespace net = boost::asio; -namespace resp3 = aedis::resp3; +namespace resp3 = boost::redis::resp3; -using aedis::adapt; +using boost::redis::adapt; using error_code = boost::system::error_code; #include diff --git a/tests/conn_run_cancel.cpp b/tests/conn_run_cancel.cpp index 394c0be3..695bcb74 100644 --- a/tests/conn_run_cancel.cpp +++ b/tests/conn_run_cancel.cpp @@ -13,16 +13,16 @@ #define BOOST_TEST_MODULE low level #include -#include -#include +#include +#include #include "common.hpp" namespace net = boost::asio; -using aedis::resp3::request; -using aedis::operation; -using aedis::adapt; -using connection = aedis::connection; +using boost::redis::resp3::request; +using boost::redis::operation; +using boost::redis::adapt; +using connection = boost::redis::connection; using error_code = boost::system::error_code; using net::experimental::as_tuple; diff --git a/tests/conn_tls.cpp b/tests/conn_tls.cpp index 2a3ae71e..6cef9c6a 100644 --- a/tests/conn_tls.cpp +++ b/tests/conn_tls.cpp @@ -11,16 +11,16 @@ #define BOOST_TEST_MODULE low level #include -#include -#include -#include +#include +#include +#include #include "common.hpp" namespace net = boost::asio; -using aedis::adapt; -using aedis::resp3::request; -using connection = aedis::ssl::connection; +using boost::redis::adapt; +using boost::redis::resp3::request; +using connection = boost::redis::ssl::connection; struct endpoint { std::string host; diff --git a/tests/issue_50.cpp b/tests/issue_50.cpp index bb405841..6f3d2324 100644 --- a/tests/issue_50.cpp +++ b/tests/issue_50.cpp @@ -6,16 +6,16 @@ #include #if defined(BOOST_ASIO_HAS_CO_AWAIT) -#include +#include #include #include "../examples/common/common.hpp" namespace net = boost::asio; -namespace resp3 = aedis::resp3; +namespace resp3 = boost::redis::resp3; using namespace net::experimental::awaitable_operators; using steady_timer = net::use_awaitable_t<>::as_default_on_t; -using aedis::adapt; +using boost::redis::adapt; // Push consumer auto receiver(std::shared_ptr conn) -> net::awaitable diff --git a/tests/low_level.cpp b/tests/low_level.cpp index 5cb85bb5..3d80c6fc 100644 --- a/tests/low_level.cpp +++ b/tests/low_level.cpp @@ -19,23 +19,23 @@ #define BOOST_TEST_MODULE low level #include -#include -#include +#include +#include // TODO: Test with empty strings. namespace std { -auto operator==(aedis::ignore, aedis::ignore) noexcept {return true;} -auto operator!=(aedis::ignore, aedis::ignore) noexcept {return false;} +auto operator==(boost::redis::ignore, boost::redis::ignore) noexcept {return true;} +auto operator!=(boost::redis::ignore, boost::redis::ignore) noexcept {return false;} } namespace net = boost::asio; -namespace resp3 = aedis::resp3; +namespace resp3 = boost::redis::resp3; using test_stream = boost::beast::test::stream; -using aedis::adapter::adapt2; -using node_type = aedis::resp3::node; +using boost::redis::adapter::adapt2; +using node_type = boost::redis::resp3::node; using vec_node_type = std::vector; using vec_type = std::vector; using op_vec_type = std::optional>; @@ -175,11 +175,11 @@ std::optional op_bool_ok = true; // TODO: Test a streamed string that is not finished with a string of // size 0 but other command comes in. std::vector streamed_string_e1 -{ {aedis::resp3::type::streamed_string, 0, 1, ""} -, {aedis::resp3::type::streamed_string_part, 1, 1, "Hell"} -, {aedis::resp3::type::streamed_string_part, 1, 1, "o wor"} -, {aedis::resp3::type::streamed_string_part, 1, 1, "d"} -, {aedis::resp3::type::streamed_string_part, 1, 1, ""} +{ {boost::redis::resp3::type::streamed_string, 0, 1, ""} +, {boost::redis::resp3::type::streamed_string_part, 1, 1, "Hell"} +, {boost::redis::resp3::type::streamed_string_part, 1, 1, "o wor"} +, {boost::redis::resp3::type::streamed_string_part, 1, 1, "d"} +, {boost::redis::resp3::type::streamed_string_part, 1, 1, ""} }; std::vector streamed_string_e2 { {resp3::type::streamed_string, 0UL, 1UL, {}}, {resp3::type::streamed_string_part, 1UL, 1UL, {}} }; @@ -368,37 +368,37 @@ std::vector const attr_e1b #define S18d "$0\r\n\r\n" #define NUMBER_TEST_CONDITIONS(test) \ - test(ex, make_expected(S01a, std::optional{}, aedis::error::unexpected_bool_value)); \ + test(ex, make_expected(S01a, std::optional{}, boost::redis::error::unexpected_bool_value)); \ test(ex, make_expected(S01b, bool{false})); \ test(ex, make_expected(S01b, node_type{resp3::type::boolean, 1UL, 0UL, {"f"}})); \ test(ex, make_expected(S01c, bool{true})); \ test(ex, make_expected(S01c, node_type{resp3::type::boolean, 1UL, 0UL, {"t"}})); \ test(ex, make_expected(S01c, op_bool_ok)); \ - test(ex, make_expected(S01c, std::map{}, aedis::error::expects_resp3_map)); \ - test(ex, make_expected(S01c, std::set{}, aedis::error::expects_resp3_set)); \ - test(ex, make_expected(S01c, std::unordered_map{}, aedis::error::expects_resp3_map)); \ - test(ex, make_expected(S01c, std::unordered_set{}, aedis::error::expects_resp3_set)); \ + test(ex, make_expected(S01c, std::map{}, boost::redis::error::expects_resp3_map)); \ + test(ex, make_expected(S01c, std::set{}, boost::redis::error::expects_resp3_set)); \ + test(ex, make_expected(S01c, std::unordered_map{}, boost::redis::error::expects_resp3_map)); \ + test(ex, make_expected(S01c, std::unordered_set{}, boost::redis::error::expects_resp3_set)); \ test(ex, make_expected(S02a, streamed_string_e2)); \ - test(ex, make_expected(S03a, int{}, aedis::error::expects_resp3_simple_type));\ - test(ex, make_expected(S03a, std::optional{}, aedis::error::expects_resp3_simple_type));; \ - test(ex, make_expected(S02b, int{}, aedis::error::not_a_number)); \ + test(ex, make_expected(S03a, int{}, boost::redis::error::expects_resp3_simple_type));\ + test(ex, make_expected(S03a, std::optional{}, boost::redis::error::expects_resp3_simple_type));; \ + test(ex, make_expected(S02b, int{}, boost::redis::error::not_a_number)); \ test(ex, make_expected(S02b, std::string{"Hello word"})); \ test(ex, make_expected(S02b, streamed_string_e1)); \ - test(ex, make_expected(S02c, std::string{}, aedis::error::not_a_number)); \ + test(ex, make_expected(S02c, std::string{}, boost::redis::error::not_a_number)); \ test(ex, make_expected(S04a, std::tuple{11})); \ test(ex, make_expected(S05a, node_type{resp3::type::number, 1UL, 0UL, {"-3"}})); \ test(ex, make_expected(S05b, int{11})); \ test(ex, make_expected(S05b, op_int_ok)); \ - test(ex, make_expected(S05b, std::list{}, aedis::error::expects_resp3_aggregate)); \ - test(ex, make_expected(S05b, std::map{}, aedis::error::expects_resp3_map)); \ - test(ex, make_expected(S05b, std::set{}, aedis::error::expects_resp3_set)); \ - test(ex, make_expected(S05b, std::unordered_map{}, aedis::error::expects_resp3_map)); \ - test(ex, make_expected(S05b, std::unordered_set{}, aedis::error::expects_resp3_set)); \ - test(ex, make_expected(s05c, array_type2{}, aedis::error::expects_resp3_aggregate));\ + test(ex, make_expected(S05b, std::list{}, boost::redis::error::expects_resp3_aggregate)); \ + test(ex, make_expected(S05b, std::map{}, boost::redis::error::expects_resp3_map)); \ + test(ex, make_expected(S05b, std::set{}, boost::redis::error::expects_resp3_set)); \ + test(ex, make_expected(S05b, std::unordered_map{}, boost::redis::error::expects_resp3_map)); \ + test(ex, make_expected(S05b, std::unordered_set{}, boost::redis::error::expects_resp3_set)); \ + test(ex, make_expected(s05c, array_type2{}, boost::redis::error::expects_resp3_aggregate));\ test(ex, make_expected(s05c, node_type{resp3::type::number, 1UL, 0UL, {"3"}})); \ - test(ex, make_expected(S06a, array_type{}, aedis::error::resp3_null));\ - test(ex, make_expected(S06a, int{0}, aedis::error::resp3_null)); \ - test(ex, make_expected(S06a, map_type{}, aedis::error::resp3_null));\ + test(ex, make_expected(S06a, array_type{}, boost::redis::error::resp3_null));\ + test(ex, make_expected(S06a, int{0}, boost::redis::error::resp3_null)); \ + test(ex, make_expected(S06a, map_type{}, boost::redis::error::resp3_null));\ test(ex, make_expected(S06a, op_type_01{}));\ test(ex, make_expected(S06a, op_type_02{}));\ test(ex, make_expected(S06a, op_type_03{}));\ @@ -408,11 +408,11 @@ std::vector const attr_e1b test(ex, make_expected(S06a, op_type_07{}));\ test(ex, make_expected(S06a, op_type_08{}));\ test(ex, make_expected(S06a, op_type_09{}));\ - test(ex, make_expected(S06a, std::list{}, aedis::error::resp3_null));\ - test(ex, make_expected(S06a, std::vector{}, aedis::error::resp3_null));\ + test(ex, make_expected(S06a, std::list{}, boost::redis::error::resp3_null));\ + test(ex, make_expected(S06a, std::vector{}, boost::redis::error::resp3_null));\ test(ex, make_expected(S07a, push_e1a)); \ test(ex, make_expected(S07b, push_e1b)); \ - test(ex, make_expected(S04b, map_type{}, aedis::error::expects_resp3_map));\ + test(ex, make_expected(S04b, map_type{}, boost::redis::error::expects_resp3_map));\ test(ex, make_expected(S03b, map_e1f));\ test(ex, make_expected(S03b, map_e1g));\ test(ex, make_expected(S03b, map_e1k));\ @@ -431,13 +431,13 @@ std::vector const attr_e1b test(ex, make_expected(S04e, array_e1f));\ test(ex, make_expected(S04e, array_e1g));\ test(ex, make_expected(S04e, array_e1h));\ - test(ex, make_expected(S04e, array_type2{}, aedis::error::incompatible_size));\ - test(ex, make_expected(S04e, tuple_int_2{}, aedis::error::incompatible_size));\ - test(ex, make_expected(S04f, array_type2{}, aedis::error::nested_aggregate_not_supported));\ - test(ex, make_expected(S04g, vec_node_type{}, aedis::error::exceeeds_max_nested_depth));\ + test(ex, make_expected(S04e, array_type2{}, boost::redis::error::incompatible_size));\ + test(ex, make_expected(S04e, tuple_int_2{}, boost::redis::error::incompatible_size));\ + test(ex, make_expected(S04f, array_type2{}, boost::redis::error::nested_aggregate_not_supported));\ + test(ex, make_expected(S04g, vec_node_type{}, boost::redis::error::exceeeds_max_nested_depth));\ test(ex, make_expected(S04h, array_e1d));\ test(ex, make_expected(S04h, array_e1e));\ - test(ex, make_expected(S04i, set_type{}, aedis::error::expects_resp3_set)); \ + test(ex, make_expected(S04i, set_type{}, boost::redis::error::expects_resp3_set)); \ test(ex, make_expected(S09a, set_e1c)); \ test(ex, make_expected(S09a, set_e1d)); \ test(ex, make_expected(S09a, set_e1f)); \ @@ -447,34 +447,34 @@ std::vector const attr_e1b test(ex, make_expected(S09a, set_type{"apple", "one", "orange", "three", "two"})); \ test(ex, make_expected(S04d, std::tuple{set_e1c})); \ test(ex, make_expected(S09b, std::vector{ {resp3::type::set, 0UL, 0UL, {}} })); \ - test(ex, make_expected(S10a, aedis::ignore{}, aedis::error::resp3_simple_error)); \ - test(ex, make_expected(S10a, node_type{resp3::type::simple_error, 1UL, 0UL, {"Error"}}, aedis::error::resp3_simple_error)); \ - test(ex, make_expected(S10b, node_type{resp3::type::simple_error, 1UL, 0UL, {""}}, aedis::error::resp3_simple_error)); \ + test(ex, make_expected(S10a, boost::redis::ignore{}, boost::redis::error::resp3_simple_error)); \ + test(ex, make_expected(S10a, node_type{resp3::type::simple_error, 1UL, 0UL, {"Error"}}, boost::redis::error::resp3_simple_error)); \ + test(ex, make_expected(S10b, node_type{resp3::type::simple_error, 1UL, 0UL, {""}}, boost::redis::error::resp3_simple_error)); \ test(ex, make_expected(S03c, map_type{}));\ test(ex, make_expected(S11a, node_type{resp3::type::doublean, 1UL, 0UL, {"1.23"}}));\ test(ex, make_expected(S11b, node_type{resp3::type::doublean, 1UL, 0UL, {"inf"}}));\ test(ex, make_expected(S11c, node_type{resp3::type::doublean, 1UL, 0UL, {"-inf"}}));\ test(ex, make_expected(S11d, double{1.23}));\ - test(ex, make_expected(S11e, double{0}, aedis::error::not_a_double));\ - test(ex, make_expected(S12a, node_type{resp3::type::blob_error, 1UL, 0UL, {"SYNTAX invalid syntax"}}, aedis::error::resp3_blob_error));\ - test(ex, make_expected(S12b, node_type{resp3::type::blob_error, 1UL, 0UL, {}}, aedis::error::resp3_blob_error));\ - test(ex, make_expected(S12c, aedis::ignore{}, aedis::error::resp3_blob_error));\ + test(ex, make_expected(S11e, double{0}, boost::redis::error::not_a_double));\ + test(ex, make_expected(S12a, node_type{resp3::type::blob_error, 1UL, 0UL, {"SYNTAX invalid syntax"}}, boost::redis::error::resp3_blob_error));\ + test(ex, make_expected(S12b, node_type{resp3::type::blob_error, 1UL, 0UL, {}}, boost::redis::error::resp3_blob_error));\ + test(ex, make_expected(S12c, boost::redis::ignore{}, boost::redis::error::resp3_blob_error));\ test(ex, make_expected(S13a, node_type{resp3::type::verbatim_string, 1UL, 0UL, {"txt:Some string"}}));\ test(ex, make_expected(S13b, node_type{resp3::type::verbatim_string, 1UL, 0UL, {}}));\ test(ex, make_expected(S14a, node_type{resp3::type::big_number, 1UL, 0UL, {"3492890328409238509324850943850943825024385"}}));\ - test(ex, make_expected(S14b, int{}, aedis::error::empty_field));\ + test(ex, make_expected(S14b, int{}, boost::redis::error::empty_field));\ test(ex, make_expected(S15a, std::optional{"OK"}));\ test(ex, make_expected(S15a, std::string{"OK"}));\ test(ex, make_expected(S15b, std::optional{""}));\ test(ex, make_expected(S15b, std::string{""}));\ - test(ex, make_expected(S16a, int{}, aedis::error::invalid_data_type));\ - test(ex, make_expected(S05d, int{11}, aedis::error::not_a_number));\ - test(ex, make_expected(S03d, map_type{}, aedis::error::not_a_number));\ - test(ex, make_expected(S02d, std::string{}, aedis::error::not_a_number));\ - test(ex, make_expected(S17a, std::string{}, aedis::error::not_a_number));\ - test(ex, make_expected(S05e, int{}, aedis::error::empty_field));\ - test(ex, make_expected(S01d, std::optional{}, aedis::error::empty_field));\ - test(ex, make_expected(S11f, std::string{}, aedis::error::empty_field));\ + test(ex, make_expected(S16a, int{}, boost::redis::error::invalid_data_type));\ + test(ex, make_expected(S05d, int{11}, boost::redis::error::not_a_number));\ + test(ex, make_expected(S03d, map_type{}, boost::redis::error::not_a_number));\ + test(ex, make_expected(S02d, std::string{}, boost::redis::error::not_a_number));\ + test(ex, make_expected(S17a, std::string{}, boost::redis::error::not_a_number));\ + test(ex, make_expected(S05e, int{}, boost::redis::error::empty_field));\ + test(ex, make_expected(S01d, std::optional{}, boost::redis::error::empty_field));\ + test(ex, make_expected(S11f, std::string{}, boost::redis::error::empty_field));\ test(ex, make_expected(S17b, node_type{resp3::type::blob_string, 1UL, 0UL, {"hh"}}));\ test(ex, make_expected(S18c, node_type{resp3::type::blob_string, 1UL, 0UL, {"hhaa\aaaa\raaaaa\r\naaaaaaaaaa"}}));\ test(ex, make_expected(S18d, node_type{resp3::type::blob_string, 1UL, 0UL, {}}));\ @@ -507,7 +507,7 @@ BOOST_AUTO_TEST_CASE(ignore_adapter_simple_error) test_stream ts {ioc}; ts.append(S10a); resp3::read(ts, net::dynamic_buffer(rbuffer), adapt2(), ec); - BOOST_CHECK_EQUAL(ec, aedis::error::resp3_simple_error); + BOOST_CHECK_EQUAL(ec, boost::redis::error::resp3_simple_error); BOOST_TEST(!rbuffer.empty()); } @@ -520,7 +520,7 @@ BOOST_AUTO_TEST_CASE(ignore_adapter_blob_error) test_stream ts {ioc}; ts.append(S12a); resp3::read(ts, net::dynamic_buffer(rbuffer), adapt2(), ec); - BOOST_CHECK_EQUAL(ec, aedis::error::resp3_blob_error); + BOOST_CHECK_EQUAL(ec, boost::redis::error::resp3_blob_error); BOOST_TEST(!rbuffer.empty()); } @@ -538,41 +538,41 @@ BOOST_AUTO_TEST_CASE(ignore_adapter_no_error) } //----------------------------------------------------------------------------------- -void check_error(char const* name, aedis::error ev) +void check_error(char const* name, boost::redis::error ev) { - auto const ec = aedis::make_error_code(ev); + auto const ec = boost::redis::make_error_code(ev); auto const& cat = ec.category(); BOOST_TEST(std::string(ec.category().name()) == name); BOOST_TEST(!ec.message().empty()); BOOST_TEST(cat.equivalent( - static_cast::type>(ev), + static_cast::type>(ev), ec.category().default_error_condition( - static_cast::type>(ev)))); + static_cast::type>(ev)))); BOOST_TEST(cat.equivalent(ec, - static_cast::type>(ev))); + static_cast::type>(ev))); } BOOST_AUTO_TEST_CASE(error) { - check_error("aedis", aedis::error::invalid_data_type); - check_error("aedis", aedis::error::not_a_number); - check_error("aedis", aedis::error::exceeeds_max_nested_depth); - check_error("aedis", aedis::error::unexpected_bool_value); - check_error("aedis", aedis::error::empty_field); - check_error("aedis", aedis::error::expects_resp3_simple_type); - check_error("aedis", aedis::error::expects_resp3_aggregate); - check_error("aedis", aedis::error::expects_resp3_map); - check_error("aedis", aedis::error::expects_resp3_set); - check_error("aedis", aedis::error::nested_aggregate_not_supported); - check_error("aedis", aedis::error::resp3_simple_error); - check_error("aedis", aedis::error::resp3_blob_error); - check_error("aedis", aedis::error::incompatible_size); - check_error("aedis", aedis::error::not_a_double); - check_error("aedis", aedis::error::resp3_null); - check_error("aedis", aedis::error::not_connected); + check_error("boost.redis", boost::redis::error::invalid_data_type); + check_error("boost.redis", boost::redis::error::not_a_number); + check_error("boost.redis", boost::redis::error::exceeeds_max_nested_depth); + check_error("boost.redis", boost::redis::error::unexpected_bool_value); + check_error("boost.redis", boost::redis::error::empty_field); + check_error("boost.redis", boost::redis::error::expects_resp3_simple_type); + check_error("boost.redis", boost::redis::error::expects_resp3_aggregate); + check_error("boost.redis", boost::redis::error::expects_resp3_map); + check_error("boost.redis", boost::redis::error::expects_resp3_set); + check_error("boost.redis", boost::redis::error::nested_aggregate_not_supported); + check_error("boost.redis", boost::redis::error::resp3_simple_error); + check_error("boost.redis", boost::redis::error::resp3_blob_error); + check_error("boost.redis", boost::redis::error::incompatible_size); + check_error("boost.redis", boost::redis::error::not_a_double); + check_error("boost.redis", boost::redis::error::resp3_null); + check_error("boost.redis", boost::redis::error::not_connected); } -std::string get_type_as_str(aedis::resp3::type t) +std::string get_type_as_str(boost::redis::resp3::type t) { std::ostringstream ss; ss << t; @@ -581,30 +581,30 @@ std::string get_type_as_str(aedis::resp3::type t) BOOST_AUTO_TEST_CASE(type_string) { - BOOST_TEST(!get_type_as_str(aedis::resp3::type::array).empty()); - BOOST_TEST(!get_type_as_str(aedis::resp3::type::push).empty()); - BOOST_TEST(!get_type_as_str(aedis::resp3::type::set).empty()); - BOOST_TEST(!get_type_as_str(aedis::resp3::type::map).empty()); - BOOST_TEST(!get_type_as_str(aedis::resp3::type::attribute).empty()); - BOOST_TEST(!get_type_as_str(aedis::resp3::type::simple_string).empty()); - BOOST_TEST(!get_type_as_str(aedis::resp3::type::simple_error).empty()); - BOOST_TEST(!get_type_as_str(aedis::resp3::type::number).empty()); - BOOST_TEST(!get_type_as_str(aedis::resp3::type::doublean).empty()); - BOOST_TEST(!get_type_as_str(aedis::resp3::type::boolean).empty()); - BOOST_TEST(!get_type_as_str(aedis::resp3::type::big_number).empty()); - BOOST_TEST(!get_type_as_str(aedis::resp3::type::null).empty()); - BOOST_TEST(!get_type_as_str(aedis::resp3::type::blob_error).empty()); - BOOST_TEST(!get_type_as_str(aedis::resp3::type::verbatim_string).empty()); - BOOST_TEST(!get_type_as_str(aedis::resp3::type::blob_string).empty()); - BOOST_TEST(!get_type_as_str(aedis::resp3::type::streamed_string_part).empty()); - BOOST_TEST(!get_type_as_str(aedis::resp3::type::invalid).empty()); + BOOST_TEST(!get_type_as_str(boost::redis::resp3::type::array).empty()); + BOOST_TEST(!get_type_as_str(boost::redis::resp3::type::push).empty()); + BOOST_TEST(!get_type_as_str(boost::redis::resp3::type::set).empty()); + BOOST_TEST(!get_type_as_str(boost::redis::resp3::type::map).empty()); + BOOST_TEST(!get_type_as_str(boost::redis::resp3::type::attribute).empty()); + BOOST_TEST(!get_type_as_str(boost::redis::resp3::type::simple_string).empty()); + BOOST_TEST(!get_type_as_str(boost::redis::resp3::type::simple_error).empty()); + BOOST_TEST(!get_type_as_str(boost::redis::resp3::type::number).empty()); + BOOST_TEST(!get_type_as_str(boost::redis::resp3::type::doublean).empty()); + BOOST_TEST(!get_type_as_str(boost::redis::resp3::type::boolean).empty()); + BOOST_TEST(!get_type_as_str(boost::redis::resp3::type::big_number).empty()); + BOOST_TEST(!get_type_as_str(boost::redis::resp3::type::null).empty()); + BOOST_TEST(!get_type_as_str(boost::redis::resp3::type::blob_error).empty()); + BOOST_TEST(!get_type_as_str(boost::redis::resp3::type::verbatim_string).empty()); + BOOST_TEST(!get_type_as_str(boost::redis::resp3::type::blob_string).empty()); + BOOST_TEST(!get_type_as_str(boost::redis::resp3::type::streamed_string_part).empty()); + BOOST_TEST(!get_type_as_str(boost::redis::resp3::type::invalid).empty()); } BOOST_AUTO_TEST_CASE(type_convert) { - using aedis::resp3::to_code; - using aedis::resp3::to_type; - using aedis::resp3::type; + using boost::redis::resp3::to_code; + using boost::redis::resp3::to_type; + using boost::redis::resp3::type; #define CHECK_CASE(A) BOOST_CHECK_EQUAL(to_type(to_code(type::A)), type::A); CHECK_CASE(array); @@ -628,7 +628,7 @@ BOOST_AUTO_TEST_CASE(type_convert) BOOST_AUTO_TEST_CASE(adapter) { - using aedis::adapt; + using boost::redis::adapt; using resp3::type; boost::system::error_code ec; diff --git a/tests/request.cpp b/tests/request.cpp index fe7f6146..21740d65 100644 --- a/tests/request.cpp +++ b/tests/request.cpp @@ -10,10 +10,10 @@ #define BOOST_TEST_MODULE low level #include -#include -#include +#include +#include -using aedis::resp3::request; +using boost::redis::resp3::request; // TODO: Serialization.