Skip to content

Commit

Permalink
Removes unused function.
Browse files Browse the repository at this point in the history
  • Loading branch information
mzimbres committed Apr 25, 2022
1 parent 0e8e31f commit d1e7ec6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 86 deletions.
6 changes: 5 additions & 1 deletion aedis/resp3/detail/impl/parser.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
* 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>

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;
Expand Down
7 changes: 2 additions & 5 deletions aedis/resp3/detail/parser.hpp
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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>
Expand Down
36 changes: 0 additions & 36 deletions aedis/resp3/detail/read_ops.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,42 +107,6 @@ class parse_op {
}
};

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
Expand Down
44 changes: 0 additions & 44 deletions aedis/resp3/read.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit d1e7ec6

Please sign in to comment.