mirror of
https://github.com/boostorg/redis.git
synced 2026-01-19 04:42:09 +00:00
Added boost.container.pmr to request.
This commit is contained in:
committed by
Marcelo Zimbres
parent
3816d1d358
commit
15e6883bc1
@@ -26,6 +26,7 @@ target_link_libraries(aedis
|
||||
Boost::asio
|
||||
Boost::assert
|
||||
Boost::config
|
||||
Boost::container
|
||||
Boost::core
|
||||
Boost::mp11
|
||||
Boost::optional
|
||||
@@ -42,7 +43,7 @@ write_basic_package_version_file(
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
)
|
||||
|
||||
find_package(Boost 1.79 REQUIRED)
|
||||
find_package(Boost 1.79 REQUIRED container)
|
||||
include_directories(${Boost_INCLUDE_DIRS})
|
||||
|
||||
find_package(OpenSSL REQUIRED)
|
||||
@@ -77,6 +78,8 @@ add_executable(test_conn_cancel_run tests/conn_cancel_run.cpp)
|
||||
add_executable(test_conn_cancel_exec tests/conn_cancel_exec.cpp)
|
||||
add_executable(test_conn_echo_stress tests/conn_echo_stress.cpp)
|
||||
|
||||
|
||||
|
||||
target_compile_features(chat_room PUBLIC cxx_std_20)
|
||||
target_compile_features(containers PUBLIC cxx_std_20)
|
||||
target_compile_features(echo_server PUBLIC cxx_std_20)
|
||||
@@ -100,8 +103,26 @@ target_compile_features(test_conn_cancel_run PUBLIC cxx_std_20)
|
||||
target_compile_features(test_conn_cancel_exec PUBLIC cxx_std_20)
|
||||
target_compile_features(test_conn_echo_stress PUBLIC cxx_std_20)
|
||||
|
||||
target_link_libraries(intro_tls OpenSSL::Crypto OpenSSL::SSL)
|
||||
target_link_libraries(test_conn_tls OpenSSL::Crypto OpenSSL::SSL)
|
||||
target_link_libraries(intro Boost::container)
|
||||
target_link_libraries(intro_tls OpenSSL::Crypto OpenSSL::SSL Boost::container)
|
||||
target_link_libraries(chat_room PUBLIC Boost::container)
|
||||
target_link_libraries(containers PUBLIC Boost::container)
|
||||
target_link_libraries(echo_server PUBLIC Boost::container)
|
||||
target_link_libraries(low_level_sync PUBLIC Boost::container)
|
||||
target_link_libraries(serialization PUBLIC Boost::container)
|
||||
target_link_libraries(subscriber PUBLIC Boost::container)
|
||||
target_link_libraries(subscriber_sentinel PUBLIC Boost::container)
|
||||
target_link_libraries(test_conn_cancel_exec PUBLIC Boost::container)
|
||||
target_link_libraries(test_conn_cancel_run PUBLIC Boost::container)
|
||||
target_link_libraries(test_conn_connect PUBLIC Boost::container)
|
||||
target_link_libraries(test_conn_push PUBLIC Boost::container)
|
||||
target_link_libraries(test_conn_quit PUBLIC Boost::container)
|
||||
target_link_libraries(test_conn_quit_coalesce PUBLIC Boost::container)
|
||||
target_link_libraries(test_conn_reconnect PUBLIC Boost::container)
|
||||
target_link_libraries(test_conn_reconnect PUBLIC Boost::container)
|
||||
target_link_libraries(test_conn_request PUBLIC Boost::container)
|
||||
target_link_libraries(test_conn_tls OpenSSL::Crypto OpenSSL::SSL Boost::container)
|
||||
|
||||
|
||||
# Tests
|
||||
#=======================================================================
|
||||
|
||||
@@ -57,7 +57,7 @@ user tag_invoke(value_to_tag<user>, value const& jv)
|
||||
}
|
||||
|
||||
// Serializes
|
||||
void to_bulk(std::string& to, user const& u)
|
||||
void to_bulk(boost::container::pmr::string& to, user const& u)
|
||||
{
|
||||
aedis::resp3::to_bulk(to, serialize(value_from(u)));
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <tuple>
|
||||
|
||||
#include <boost/hana.hpp>
|
||||
#include <boost/container/pmr/global_resource.hpp>
|
||||
#include <boost/container/pmr/string.hpp>
|
||||
#include <boost/utility/string_view.hpp>
|
||||
|
||||
#include <aedis/resp3/type.hpp>
|
||||
@@ -205,11 +207,18 @@ public:
|
||||
*
|
||||
* @param cfg Configuration options.
|
||||
*/
|
||||
explicit request(config cfg = config{false, true, false, true})
|
||||
: cfg_{cfg}
|
||||
explicit request(boost::container::pmr::memory_resource * resource)
|
||||
: payload_(resource), cfg_{false, true, false, true}
|
||||
{}
|
||||
|
||||
//// Returns the number of commands contained in this request.
|
||||
explicit request(config cfg = config{false, true, false, true},
|
||||
boost::container::pmr::memory_resource * resource =
|
||||
boost::container::pmr::get_default_resource())
|
||||
: payload_(resource), cfg_{cfg}
|
||||
{}
|
||||
|
||||
|
||||
//// Returns the number of commands contained in this request.
|
||||
[[nodiscard]] auto size() const noexcept -> std::size_t { return commands_;};
|
||||
|
||||
// Returns the request payload.
|
||||
@@ -380,7 +389,7 @@ public:
|
||||
[[nodiscard]] auto get_config() noexcept -> auto& {return cfg_; }
|
||||
|
||||
private:
|
||||
std::string payload_;
|
||||
boost::container::pmr::string payload_;
|
||||
std::size_t commands_ = 0;
|
||||
config cfg_;
|
||||
};
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/system/errc.hpp>
|
||||
|
||||
#include <boost/container/pmr/monotonic_buffer_resource.hpp>
|
||||
|
||||
#define BOOST_TEST_MODULE low level
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
|
||||
@@ -50,7 +52,10 @@ BOOST_AUTO_TEST_CASE(wrong_response_data_type)
|
||||
BOOST_AUTO_TEST_CASE(cancel_request_if_not_connected)
|
||||
{
|
||||
std::cout << boost::unit_test::framework::current_test_case().p_name << std::endl;
|
||||
request req;
|
||||
namespace pmr = boost::container::pmr;
|
||||
char buf[4096];
|
||||
pmr::monotonic_buffer_resource resource{buf, 4096};
|
||||
request req{&resource};
|
||||
req.get_config().cancel_if_not_connected = true;
|
||||
req.push("PING");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user