2
0
mirror of https://github.com/boostorg/redis.git synced 2026-01-19 04:42:09 +00:00

Removes unused function.

This commit is contained in:
Marcelo Zimbres
2022-04-25 22:00:16 +02:00
parent 0e8e31f310
commit d1e7ec6f03
4 changed files with 7 additions and 86 deletions

View File

@@ -5,6 +5,9 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/home/x3.hpp>
#include <aedis/resp3/detail/parser.hpp>
#include <aedis/resp3/type.hpp>
@@ -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<std::size_t, 10> p{};
std::size_t ret;

View File

@@ -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 <string_view>
#include <system_error>
#include <limits>
#include <system_error>
#include <boost/assert.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/home/x3.hpp>
#include <boost/utility/string_view.hpp>
#include <aedis/resp3/error.hpp>

View File

@@ -107,42 +107,6 @@ public:
}
};
template <class AsyncReadStream, class DynamicBuffer>
class type_op {
private:
AsyncReadStream& stream_;
DynamicBuffer buf_;
boost::asio::coroutine coro_;
public:
type_op(AsyncReadStream& stream, DynamicBuffer buf)
: stream_ {stream}
, buf_ {buf}
{ }
template <class Self>
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 <boost/asio/unyield.hpp>
} // detail

View File

@@ -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<typename AsyncReadStream::executor_type>
>
auto async_read_type(
AsyncReadStream& stream,
DynamicBuffer buffer,
CompletionToken&& token =
boost::asio::default_completion_token_t<typename AsyncReadStream::executor_type>{})
{
return boost::asio::async_compose
< CompletionToken
, void(boost::system::error_code, type)
>(detail::type_op<AsyncReadStream, DynamicBuffer> {stream, buffer}, token, stream);
}
} // resp3
} // aedis