diff --git a/aedis/resp3/detail/impl/parser.ipp b/aedis/resp3/detail/impl/parser.ipp index 556efe69..02145e2e 100644 --- a/aedis/resp3/detail/impl/parser.ipp +++ b/aedis/resp3/detail/impl/parser.ipp @@ -5,6 +5,9 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ +#include +#include + #include #include @@ -12,7 +15,8 @@ namespace aedis { namespace resp3 { namespace detail { -std::size_t parse_uint(char const* data, std::size_t size, boost::system::error_code& ec) +std::size_t +parse_uint(char const* data, std::size_t size, boost::system::error_code& ec) { static constexpr boost::spirit::x3::uint_parser p{}; std::size_t ret; diff --git a/aedis/resp3/detail/parser.hpp b/aedis/resp3/detail/parser.hpp index cec6a125..e0b42b40 100644 --- a/aedis/resp3/detail/parser.hpp +++ b/aedis/resp3/detail/parser.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2019 - 2021 Marcelo Zimbres Silva (mzimbres at gmail dot com) +/* Copyright (c) 2019 Marcelo Zimbres Silva (mzimbres at gmail dot com) * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -8,13 +8,10 @@ #ifndef AEDIS_RESP3_PARSER_HPP #define AEDIS_RESP3_PARSER_HPP -#include -#include #include +#include #include -#include -#include #include #include diff --git a/aedis/resp3/detail/read_ops.hpp b/aedis/resp3/detail/read_ops.hpp index 7eef96d4..123bbb3b 100644 --- a/aedis/resp3/detail/read_ops.hpp +++ b/aedis/resp3/detail/read_ops.hpp @@ -107,42 +107,6 @@ public: } }; -template -class type_op { -private: - AsyncReadStream& stream_; - DynamicBuffer buf_; - boost::asio::coroutine coro_; - -public: - type_op(AsyncReadStream& stream, DynamicBuffer buf) - : stream_ {stream} - , buf_ {buf} - { } - - template - void operator()( Self& self - , boost::system::error_code ec = {} - , std::size_t n = 0) - { - reenter (coro_) { - - boost::ignore_unused(n); - if (buf_.size() == 0) { - yield boost::asio::async_read_until(stream_, buf_, "\r\n", std::move(self)); - if (ec) { - self.complete(ec, type::invalid); - return; - } - } - - auto const* data = (char const*)buf_.data(0, n).data(); - auto const type = to_type(*data); - self.complete(ec, type); - } - } -}; - #include } // detail diff --git a/aedis/resp3/read.hpp b/aedis/resp3/read.hpp index d1a66730..5916d753 100644 --- a/aedis/resp3/read.hpp +++ b/aedis/resp3/read.hpp @@ -191,50 +191,6 @@ auto async_read( stream); } -/** \brief Reads the RESP3 data type of the next incomming data. - * \ingroup any - * - * This function will read the RESP3 data type of the next Redis - * response. It is implemented in terms of one or more calls to @c - * asio::async_read_until and is known as a @a composed @a operation. - * Furthermore (Quoted from Beast docs) - * - * > The implementation may read additional bytes from the stream that - * > lie past the end of the message being read. These additional - * > bytes are stored in the dynamic buffer, which must be preserved - * > for subsequent reads. - * - * \param stream The stream from which to read. - * \param buffer A dynamic buffer (version 2). - * \param token The completion token. - * - * The completion handler will receive as a parameter the RESP3 data - * type of the next response and must have the following signature - * - * @code - * void(boost::system::error_code, type) - * @endcode - * - * \remark No data is consumed from the stream (as of x.consume()). - */ -template < - class AsyncReadStream, - class DynamicBuffer, - class CompletionToken = - boost::asio::default_completion_token_t - > -auto async_read_type( - AsyncReadStream& stream, - DynamicBuffer buffer, - CompletionToken&& token = - boost::asio::default_completion_token_t{}) -{ - return boost::asio::async_compose - < CompletionToken - , void(boost::system::error_code, type) - >(detail::type_op {stream, buffer}, token, stream); -} - } // resp3 } // aedis