mirror of
https://github.com/boostorg/redis.git
synced 2026-01-19 04:42:09 +00:00
Adjust code base to new changes
This commit is contained in:
committed by
Marcelo Zimbres
parent
84fa39918f
commit
b1420d3d1d
@@ -33,7 +33,7 @@ using boost::asio::redirect_error;
|
||||
using boost::asio::use_awaitable;
|
||||
using boost::redis::config;
|
||||
using boost::redis::connection;
|
||||
using boost::redis::generic_response;
|
||||
using boost::redis::generic_flat_response;
|
||||
using boost::redis::ignore;
|
||||
using boost::redis::request;
|
||||
using boost::system::error_code;
|
||||
@@ -47,7 +47,7 @@ auto receiver(std::shared_ptr<connection> conn) -> awaitable<void>
|
||||
request req;
|
||||
req.push("SUBSCRIBE", "channel");
|
||||
|
||||
generic_response resp;
|
||||
generic_flat_response resp;
|
||||
conn->set_receive_response(resp);
|
||||
|
||||
while (conn->will_reconnect()) {
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace net = boost::asio;
|
||||
using boost::redis::config;
|
||||
using boost::redis::generic_response;
|
||||
using boost::redis::generic_flat_response;
|
||||
using boost::redis::operation;
|
||||
using boost::redis::request;
|
||||
using boost::redis::connection;
|
||||
@@ -33,7 +33,7 @@ auto stream_reader(std::shared_ptr<connection> conn) -> net::awaitable<void>
|
||||
{
|
||||
std::string redisStreamKey_;
|
||||
request req;
|
||||
generic_response resp;
|
||||
generic_flat_response resp;
|
||||
|
||||
std::string stream_id{"$"};
|
||||
std::string const field = "myfield";
|
||||
@@ -51,7 +51,7 @@ auto stream_reader(std::shared_ptr<connection> conn) -> net::awaitable<void>
|
||||
// The following approach was taken in order to be able to
|
||||
// deal with the responses, as generated by redis in the case
|
||||
// that there are multiple stream 'records' within a single
|
||||
// generic_response. The nesting and number of values in
|
||||
// generic_flat_response. The nesting and number of values in
|
||||
// resp.value() are different, depending on the contents
|
||||
// of the stream in redis. Uncomment the above commented-out
|
||||
// code for examples while running the XADD command.
|
||||
|
||||
@@ -138,26 +138,6 @@ void boost_redis_from_bulk(T& t, resp3::basic_node<String> const& node, system::
|
||||
from_bulk_impl<T>::apply(t, node, ec);
|
||||
}
|
||||
|
||||
//================================================
|
||||
|
||||
template <typename T>
|
||||
inline auto prepare_done(T*) noexcept
|
||||
{
|
||||
return [] { };
|
||||
}
|
||||
|
||||
template <>
|
||||
inline auto prepare_done(generic_flat_response* resp) noexcept
|
||||
{
|
||||
return [resp] {
|
||||
if (resp->has_value()) {
|
||||
resp->value().set_view();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//================================================
|
||||
|
||||
template <class Result>
|
||||
class general_aggregate {
|
||||
private:
|
||||
@@ -205,6 +185,15 @@ public:
|
||||
explicit general_aggregate(result<flat_response_value>* c = nullptr)
|
||||
: result_(c)
|
||||
{ }
|
||||
|
||||
void on_init() { }
|
||||
void on_done()
|
||||
{
|
||||
if (result_->has_value()) {
|
||||
result_->value().set_view();
|
||||
}
|
||||
}
|
||||
|
||||
template <class String>
|
||||
void operator()(resp3::basic_node<String> const& nd, system::error_code&)
|
||||
{
|
||||
|
||||
@@ -64,6 +64,7 @@ public:
|
||||
std::vector<resp3::offset_node> const& view() const { return view_; }
|
||||
std::vector<resp3::offset_node>& view() { return view_; }
|
||||
|
||||
private:
|
||||
void set_view()
|
||||
{
|
||||
for (auto& node : view_) {
|
||||
@@ -74,7 +75,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename T>
|
||||
friend class adapter::detail::general_aggregate;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user