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

Including only necessary headers.

This commit is contained in:
Marcelo Zimbres
2023-03-14 14:08:55 +01:00
parent fd967204df
commit 90bcd621fb
43 changed files with 226 additions and 188 deletions

View File

@@ -527,7 +527,7 @@ void boost_redis_from_bulk(mystruct& obj, char const* p, std::size_t size, boost
These functions are accessed over ADL and therefore they must be
imported in the global namespace by the user. In the
[Examples](#Examples) section the reader can find examples showing how
[Examples](#examples) section the reader can find examples showing how
to serialize using json and [protobuf](https://protobuf.dev/).
<a name="examples"></a>

View File

@@ -5,7 +5,6 @@
*/
#include <iostream>
#include <boost/asio.hpp>
#include <boost/redis.hpp>
#include <boost/redis/src.hpp>

View File

@@ -4,14 +4,17 @@
* accompanying file LICENSE.txt)
*/
#include <boost/redis/operation.hpp>
#include <boost/redis/request.hpp>
#include <boost/redis/check_health.hpp>
#include <boost/redis/run.hpp>
#include <boost/asio/deferred.hpp>
#include <boost/asio/use_future.hpp>
#include <tuple>
#include <string>
#include <chrono>
#include <thread>
#include <iostream>
#include <boost/asio.hpp>
#include <boost/redis.hpp>
#include <boost/redis/check_health.hpp>
// Include this in no more than one .cpp file.
#include <boost/redis/src.hpp>

View File

@@ -4,16 +4,18 @@
* accompanying file LICENSE.txt)
*/
#include <boost/asio.hpp>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
#include <iostream>
namespace net = boost::asio;
#if defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
#include <boost/asio/experimental/awaitable_operators.hpp>
#include <boost/redis.hpp>
#include <boost/redis/run.hpp>
#include <boost/redis/check_health.hpp>
#include <boost/asio/use_awaitable.hpp>
#include <boost/asio/signal_set.hpp>
#include <boost/asio/posix/stream_descriptor.hpp>
#include <boost/asio/experimental/awaitable_operators.hpp>
#include <unistd.h>
#include <iostream>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
#if defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
namespace net = boost::asio;
using namespace net::experimental::awaitable_operators;
using stream_descriptor = net::use_awaitable_t<>::as_default_on_t<net::posix::stream_descriptor>;
using signal_set = net::use_awaitable_t<>::as_default_on_t<net::signal_set>;
@@ -21,7 +23,7 @@ using boost::redis::request;
using boost::redis::generic_response;
using boost::redis::async_check_health;
using boost::redis::async_run;
using connection = boost::asio::use_awaitable_t<>::as_default_on_t<boost::redis::connection>;
using connection = net::use_awaitable_t<>::as_default_on_t<boost::redis::connection>;
// Chat over Redis pubsub. To test, run this program from multiple
// terminals and type messages to stdin.

View File

@@ -4,13 +4,16 @@
* accompanying file LICENSE.txt)
*/
#include <boost/asio.hpp>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
#include <boost/redis.hpp>
#include <boost/redis/run.hpp>
#include <boost/asio/use_awaitable.hpp>
#include <boost/asio/detached.hpp>
#include <boost/asio/co_spawn.hpp>
#include <map>
#include <vector>
#include <iostream>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
namespace net = boost::asio;
namespace redis = boost::redis;
using boost::redis::request;

View File

@@ -4,11 +4,14 @@
* accompanying file LICENSE.txt)
*/
#include <boost/asio.hpp>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
#include <boost/asio/experimental/awaitable_operators.hpp>
#include <boost/redis.hpp>
#include <boost/redis/run.hpp>
#include <boost/redis/check_health.hpp>
#include <boost/asio/use_awaitable.hpp>
#include <boost/asio/signal_set.hpp>
#include <boost/asio/detached.hpp>
#include <boost/asio/experimental/awaitable_operators.hpp>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
namespace net = boost::asio;
using namespace net::experimental::awaitable_operators;

View File

@@ -4,11 +4,14 @@
* accompanying file LICENSE.txt)
*/
#include <boost/asio.hpp>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
#include <boost/redis.hpp>
#include <boost/redis/run.hpp>
#include <boost/asio/use_awaitable.hpp>
#include <boost/asio/co_spawn.hpp>
#include <boost/asio/detached.hpp>
#include <iostream>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
namespace net = boost::asio;
using boost::redis::request;
using boost::redis::response;

View File

@@ -4,11 +4,11 @@
* accompanying file LICENSE.txt)
*/
#include <iostream>
#include <boost/asio.hpp>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
#include <boost/redis/run.hpp>
#include <boost/asio/use_awaitable.hpp>
#include <boost/asio/experimental/awaitable_operators.hpp>
#include <boost/redis.hpp>
#include <iostream>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
namespace net = boost::asio;
using namespace net::experimental::awaitable_operators;

View File

@@ -4,17 +4,17 @@
* accompanying file LICENSE.txt)
*/
#include <boost/redis/ssl/connection.hpp>
#include <boost/redis/ssl/connection.hpp>
#include <boost/asio/use_awaitable.hpp>
#include <boost/asio/experimental/awaitable_operators.hpp>
#include <boost/asio/ssl.hpp>
#include <boost/asio/connect.hpp>
#include <tuple>
#include <string>
#include <iostream>
#include <boost/asio.hpp>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
#include <boost/asio/experimental/awaitable_operators.hpp>
#include <boost/asio/ssl.hpp>
#include <boost/redis.hpp>
#include <boost/redis/ssl/connection.hpp>
namespace net = boost::asio;
namespace redis = boost::redis;

View File

@@ -4,17 +4,19 @@
* accompanying file LICENSE.txt)
*/
#include <boost/asio.hpp>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
#define BOOST_JSON_NO_LIB
#define BOOST_CONTAINER_NO_LIB
#include <boost/redis.hpp>
#include <boost/redis/run.hpp>
#include <boost/asio/use_awaitable.hpp>
#include <boost/asio/detached.hpp>
#include <boost/asio/co_spawn.hpp>
#include <boost/describe.hpp>
#include <string>
#include <iostream>
#include "json.hpp"
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
// Include this in no more than one .cpp file.
#define BOOST_JSON_NO_LIB
#define BOOST_CONTAINER_NO_LIB
#include <boost/json/src.hpp>
namespace net = boost::asio;

View File

@@ -4,9 +4,10 @@
* accompanying file LICENSE.txt)
*/
#include <boost/asio.hpp>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
#include <boost/redis.hpp>
#include <boost/redis/run.hpp>
#include <boost/asio/use_awaitable.hpp>
#include <boost/asio/co_spawn.hpp>
#include <boost/asio/detached.hpp>
#include <iostream>
#include "protobuf.hpp"
@@ -14,6 +15,8 @@
// generated by CMakeLists.txt.
#include "person.pb.h"
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
namespace net = boost::asio;
namespace redis = boost::redis;
using boost::redis::request;
@@ -21,7 +24,7 @@ using boost::redis::response;
using boost::redis::operation;
using boost::redis::ignore_t;
using boost::redis::async_run;
using connection = boost::asio::use_awaitable_t<>::as_default_on_t<boost::redis::connection>;
using connection = net::use_awaitable_t<>::as_default_on_t<boost::redis::connection>;
// The protobuf type described in examples/person.proto
using tutorial::person;

View File

@@ -4,11 +4,12 @@
* accompanying file LICENSE.txt)
*/
#include <iostream>
#include <boost/asio.hpp>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
#include <boost/redis/run.hpp>
#include <boost/asio/use_awaitable.hpp>
#include <boost/asio/redirect_error.hpp>
#include <boost/asio/experimental/awaitable_operators.hpp>
#include <boost/redis.hpp>
#include <iostream>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
namespace net = boost::asio;
using namespace net::experimental::awaitable_operators;

View File

@@ -4,12 +4,13 @@
* accompanying file LICENSE.txt)
*/
#include <iostream>
#include <boost/asio.hpp>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
#include <boost/asio/experimental/awaitable_operators.hpp>
#include <boost/redis.hpp>
#include <boost/redis/run.hpp>
#include <boost/redis/check_health.hpp>
#include <boost/asio/use_awaitable.hpp>
#include <boost/asio/experimental/awaitable_operators.hpp>
#include <iostream>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
namespace net = boost::asio;
using namespace net::experimental::awaitable_operators;
@@ -18,7 +19,7 @@ using boost::redis::request;
using boost::redis::async_run;
using boost::redis::generic_response;
using boost::redis::async_check_health;
using connection = boost::asio::use_awaitable_t<>::as_default_on_t<boost::redis::connection>;
using connection = net::use_awaitable_t<>::as_default_on_t<boost::redis::connection>;
/* This example will subscribe and read pushes indefinitely.
*

View File

@@ -7,7 +7,9 @@
#ifndef BOOST_REDIS_JSON_HPP
#define BOOST_REDIS_JSON_HPP
#include <boost/json.hpp>
#include <boost/json/serialize.hpp>
#include <boost/json/parse.hpp>
#include <boost/json/value_from.hpp>
#include <boost/redis/resp3/serialization.hpp>
namespace boost::redis::json

View File

@@ -4,12 +4,13 @@
* accompanying file LICENSE.txt)
*/
#include <boost/asio.hpp>
#include "start.hpp"
#include <boost/asio/awaitable.hpp>
#include <string>
#include <iostream>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
#include "start.hpp"
extern boost::asio::awaitable<void> co_main(std::string, std::string);
auto main(int argc, char * argv[]) -> int

View File

@@ -4,10 +4,13 @@
* accompanying file LICENSE.txt)
*/
#include "start.hpp"
#include <boost/asio.hpp>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
#include <boost/asio/use_awaitable.hpp>
#include <boost/asio/co_spawn.hpp>
#include <boost/asio/io_context.hpp>
#include <iostream>
#include "start.hpp"
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
namespace net = boost::asio;

View File

@@ -7,7 +7,7 @@
#ifndef BOOST_REDIS_EXAMPLES_START_HPP
#define BOOST_REDIS_EXAMPLES_START_HPP
#include <boost/asio.hpp>
#include <boost/asio/awaitable.hpp>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)

View File

@@ -8,6 +8,7 @@
#define BOOST_REDIS_ADAPTER_IGNORE_HPP
#include <boost/redis/resp3/node.hpp>
#include <boost/redis/error.hpp>
#include <boost/system/error_code.hpp>
#include <string>

View File

@@ -15,6 +15,7 @@
#include <boost/asio/experimental/promise.hpp>
#include <boost/asio/experimental/use_promise.hpp>
#include <boost/asio/steady_timer.hpp>
#include <boost/asio/compose.hpp>
#include <memory>
#include <chrono>
#include <optional>

View File

@@ -8,6 +8,7 @@
#define BOOST_REDIS_CONNECTION_OPS_HPP
#include <boost/redis/adapter/adapt.hpp>
#include <boost/redis/detail/helper.hpp>
#include <boost/redis/error.hpp>
#include <boost/redis/resp3/type.hpp>
#include <boost/redis/detail/read.hpp>
@@ -37,11 +38,11 @@ struct wait_receive_op {
{
BOOST_ASIO_CORO_YIELD
conn->channel_.async_send(system::error_code{}, 0, std::move(self));
AEDIS_CHECK_OP0(;);
BOOST_REDIS_CHECK_OP0(;);
BOOST_ASIO_CORO_YIELD
conn->channel_.async_send(system::error_code{}, 0, std::move(self));
AEDIS_CHECK_OP0(;);
BOOST_REDIS_CHECK_OP0(;);
self.complete({});
}
@@ -80,7 +81,7 @@ struct exec_read_op {
conn->next_layer(),
conn->make_dynamic_buffer(),
"\r\n", std::move(self));
AEDIS_CHECK_OP1(conn->cancel(operation::run););
BOOST_REDIS_CHECK_OP1(conn->cancel(operation::run););
}
// If the next request is a push we have to handle it to
@@ -88,7 +89,7 @@ struct exec_read_op {
if (resp3::to_type(conn->read_buffer_.front()) == resp3::type::push) {
BOOST_ASIO_CORO_YIELD
conn->async_wait_receive(std::move(self));
AEDIS_CHECK_OP1(conn->cancel(operation::run););
BOOST_REDIS_CHECK_OP1(conn->cancel(operation::run););
continue;
}
//-----------------------------------
@@ -102,7 +103,7 @@ struct exec_read_op {
++index;
AEDIS_CHECK_OP1(conn->cancel(operation::run););
BOOST_REDIS_CHECK_OP1(conn->cancel(operation::run););
read_size += n;
@@ -132,7 +133,7 @@ struct receive_op {
{
BOOST_ASIO_CORO_YIELD
conn->channel_.async_receive(std::move(self));
AEDIS_CHECK_OP1(;);
BOOST_REDIS_CHECK_OP1(;);
BOOST_ASIO_CORO_YIELD
redis::detail::async_read(conn->next_layer(), conn->make_dynamic_buffer(), adapter, std::move(self));
@@ -147,7 +148,7 @@ struct receive_op {
BOOST_ASIO_CORO_YIELD
conn->channel_.async_receive(std::move(self));
AEDIS_CHECK_OP1(;);
BOOST_REDIS_CHECK_OP1(;);
self.complete({}, read_size);
return;
@@ -228,7 +229,7 @@ EXEC_OP_WAIT:
BOOST_ASSERT(conn->reqs_.front() != nullptr);
BOOST_ASIO_CORO_YIELD
conn->async_exec_read(adapter, conn->reqs_.front()->get_number_of_commands(), std::move(self));
AEDIS_CHECK_OP1(;);
BOOST_REDIS_CHECK_OP1(;);
read_size = n;
@@ -302,7 +303,7 @@ struct writer_op {
while (conn->coalesce_requests()) {
BOOST_ASIO_CORO_YIELD
asio::async_write(conn->next_layer(), asio::buffer(conn->write_buffer_), std::move(self));
AEDIS_CHECK_OP0(conn->cancel(operation::run););
BOOST_REDIS_CHECK_OP0(conn->cancel(operation::run););
conn->on_write();
@@ -353,7 +354,7 @@ struct reader_op {
return self.complete({}); // EOFINAE: EOF is not an error.
}
AEDIS_CHECK_OP0(conn->cancel(operation::run););
BOOST_REDIS_CHECK_OP0(conn->cancel(operation::run););
// We handle unsolicited events in the following way
//

View File

@@ -0,0 +1,37 @@
/* Copyright (c) 2018-2022 Marcelo Zimbres Silva (mzimbres@gmail.com)
*
* Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE.txt)
*/
#ifndef BOOST_REDIS_HELPER_HPP
#define BOOST_REDIS_HELPER_HPP
#include <boost/asio/cancellation_type.hpp>
namespace boost::redis::detail
{
template <class T>
auto is_cancelled(T const& self)
{
return self.get_cancellation_state().cancelled() != asio::cancellation_type_t::none;
}
#define BOOST_REDIS_CHECK_OP0(X)\
if (ec || redis::detail::is_cancelled(self)) {\
X\
self.complete(!!ec ? ec : asio::error::operation_aborted);\
return;\
}
#define BOOST_REDIS_CHECK_OP1(X)\
if (ec || redis::detail::is_cancelled(self)) {\
X\
self.complete(!!ec ? ec : asio::error::operation_aborted, {});\
return;\
}
} // boost::redis::detail
#endif // BOOST_REDIS_HELPER_HPP

View File

@@ -8,6 +8,7 @@
#define BOOST_REDIS_READ_OPS_HPP
#include <boost/redis/resp3/parser.hpp>
#include <boost/redis/detail/helper.hpp>
#include <boost/assert.hpp>
#include <boost/asio/read.hpp>
#include <boost/asio/read_until.hpp>
@@ -18,26 +19,6 @@
namespace boost::redis::detail
{
template <class T>
auto is_cancelled(T const& self)
{
return self.get_cancellation_state().cancelled() != asio::cancellation_type_t::none;
}
#define AEDIS_CHECK_OP0(X)\
if (ec || redis::detail::is_cancelled(self)) {\
X\
self.complete(!!ec ? ec : asio::error::operation_aborted);\
return;\
}
#define AEDIS_CHECK_OP1(X)\
if (ec || redis::detail::is_cancelled(self)) {\
X\
self.complete(!!ec ? ec : asio::error::operation_aborted, {});\
return;\
}
template <
class AsyncReadStream,
class DynamicBuffer,
@@ -68,7 +49,7 @@ public:
if (!parser_.bulk_expected()) {
BOOST_ASIO_CORO_YIELD
asio::async_read_until(stream_, buf_, "\r\n", std::move(self));
AEDIS_CHECK_OP1(;);
BOOST_REDIS_CHECK_OP1(;);
} else {
// On a bulk read we can't read until delimiter since the
// payload may contain the delimiter itself so we have to
@@ -87,7 +68,7 @@ public:
buf_.data(buffer_size_, parser_.bulk_length() + 2 - buffer_size_),
asio::transfer_all(),
std::move(self));
AEDIS_CHECK_OP1(;);
BOOST_REDIS_CHECK_OP1(;);
}
n = parser_.bulk_length() + 2;

View File

@@ -8,12 +8,13 @@
#define BOOST_REDIS_RUNNER_HPP
// Has to included before promise.hpp to build on msvc.
#include <boost/redis/detail/read_ops.hpp>
#include <boost/redis/detail/helper.hpp>
#include <boost/redis/error.hpp>
#include <boost/asio/compose.hpp>
#include <boost/asio/steady_timer.hpp>
#include <boost/asio/consign.hpp>
#include <boost/asio/connect.hpp>
#include <boost/asio/coroutine.hpp>
#include <boost/asio/experimental/parallel_group.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <memory>
@@ -144,16 +145,16 @@ struct runner_op {
runner->timer_.expires_after(resolve_timeout);
BOOST_ASIO_CORO_YIELD
runner->async_resolve(host, port, std::move(self));
AEDIS_CHECK_OP0(;)
BOOST_REDIS_CHECK_OP0(;)
runner->timer_.expires_after(connect_timeout);
BOOST_ASIO_CORO_YIELD
runner->async_connect(conn->next_layer(), std::move(self));
AEDIS_CHECK_OP0(;)
BOOST_REDIS_CHECK_OP0(;)
BOOST_ASIO_CORO_YIELD
conn->async_run(std::move(self));
AEDIS_CHECK_OP0(;)
BOOST_REDIS_CHECK_OP0(;)
self.complete({});
}
}

View File

@@ -8,7 +8,7 @@
#define BOOST_REDIS_RESP3_PARSER_HPP
#include <boost/redis/resp3/node.hpp>
#include <boost/system/error_code.hpp>
#include <array>
#include <limits>
#include <string_view>
@@ -48,7 +48,7 @@ public:
consume(
char const* data,
std::size_t n,
boost::system::error_code& ec) -> std::pair<node_type, std::size_t>;
system::error_code& ec) -> std::pair<node_type, std::size_t>;
// Returns true when the parser is done with the current message.
[[nodiscard]] auto done() const noexcept

View File

@@ -7,6 +7,7 @@
#ifndef BOOST_REDIS_RESP3_TYPE_HPP
#define BOOST_REDIS_RESP3_TYPE_HPP
#include <boost/assert.hpp>
#include <ostream>
#include <vector>
#include <string>

View File

@@ -25,6 +25,7 @@ namespace boost::redis {
* 2. Connects to one of the endpoints from 1.
* 3. Calls async_run on the underlying connection.
*
* @param conn A connection to Redis.
* @param host Redis host to connect to.
* @param port Redis port to connect to.
* @param resolve_timeout Time the resolve operation is allowed to take.

View File

@@ -10,6 +10,7 @@
#include <boost/redis/detail/connection_base.hpp>
#include <boost/redis/response.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/ssl/stream.hpp>
#include <chrono>
#include <memory>

View File

@@ -1,6 +1,8 @@
#pragma once
#include <boost/asio.hpp>
#include <boost/system/error_code.hpp>
#include <boost/asio/redirect_error.hpp>
#include <boost/asio/use_awaitable.hpp>
#ifdef BOOST_ASIO_HAS_CO_AWAIT
namespace net = boost::asio;

View File

@@ -4,18 +4,14 @@
* accompanying file LICENSE.txt)
*/
#include <iostream>
#include <boost/asio.hpp>
#include <boost/redis/run.hpp>
#include <boost/redis/check_health.hpp>
#include <boost/system/errc.hpp>
#define BOOST_TEST_MODULE check-health
#include <boost/test/included/unit_test.hpp>
#include <boost/redis.hpp>
#include <boost/redis/check_health.hpp>
#include <boost/redis/src.hpp>
#include <iostream>
#include "common.hpp"
#include <boost/redis/src.hpp>
namespace net = boost::asio;
using error_code = boost::system::error_code;

View File

@@ -4,16 +4,18 @@
* accompanying file LICENSE.txt)
*/
#include <iostream>
#include <boost/asio.hpp>
#ifdef BOOST_ASIO_HAS_CO_AWAIT
#include <boost/redis/run.hpp>
#include <boost/asio/co_spawn.hpp>
#include <boost/asio/detached.hpp>
#include <boost/system/errc.hpp>
#define BOOST_TEST_MODULE echo-stress
#include <boost/test/included/unit_test.hpp>
#include <boost/redis.hpp>
#include <boost/redis/src.hpp>
#include <iostream>
#include "common.hpp"
#include "../examples/start.hpp"
#include <boost/redis/src.hpp>
#ifdef BOOST_ASIO_HAS_CO_AWAIT
namespace net = boost::asio;
using error_code = boost::system::error_code;

View File

@@ -4,17 +4,13 @@
* accompanying file LICENSE.txt)
*/
#include <iostream>
#include <boost/asio.hpp>
#include <boost/redis/run.hpp>
#include <boost/system/errc.hpp>
#define BOOST_TEST_MODULE conn-exec
#include <boost/test/included/unit_test.hpp>
#include <boost/redis.hpp>
#include <boost/redis/src.hpp>
#include <iostream>
#include "common.hpp"
#include <boost/redis/src.hpp>
// TODO: Test whether HELLO won't be inserted passt commands that have
// been already writen.

View File

@@ -4,17 +4,17 @@
* accompanying file LICENSE.txt)
*/
#include <iostream>
#include <boost/asio.hpp>
#ifdef BOOST_ASIO_HAS_CO_AWAIT
#include <boost/redis/run.hpp>
#include <boost/system/errc.hpp>
#include <boost/asio/experimental/awaitable_operators.hpp>
#define BOOST_TEST_MODULE conn-exec-cancel
#include <boost/test/included/unit_test.hpp>
#include <boost/redis.hpp>
#include <boost/redis/src.hpp>
#include "common.hpp"
#include "../examples/start.hpp"
#include <iostream>
#include <boost/redis/src.hpp>
#ifdef BOOST_ASIO_HAS_CO_AWAIT
// NOTE1: Sends hello separately. I have observed that if hello and
// blpop are sent toguether, Redis will send the response of hello

View File

@@ -4,17 +4,13 @@
* accompanying file LICENSE.txt)
*/
#include <iostream>
#include <boost/asio.hpp>
#include <boost/redis/run.hpp>
#include <boost/system/errc.hpp>
#define BOOST_TEST_MODULE conn-exec-error
#include <boost/test/included/unit_test.hpp>
#include <boost/redis.hpp>
#include <boost/redis/src.hpp>
#include "common.hpp"
#include <boost/redis/src.hpp>
#include <iostream>
namespace net = boost::asio;
namespace redis = boost::redis;

View File

@@ -4,21 +4,20 @@
* accompanying file LICENSE.txt)
*/
#include <iostream>
#include <boost/asio.hpp>
#ifdef BOOST_ASIO_HAS_CO_AWAIT
#include <boost/redis/run.hpp>
#include <boost/system/errc.hpp>
#include <boost/asio/detached.hpp>
#include <boost/asio/co_spawn.hpp>
#include <boost/asio/experimental/as_tuple.hpp>
#define BOOST_TEST_MODULE conn-push
#include <boost/test/included/unit_test.hpp>
#include <boost/redis.hpp>
#include <boost/redis/src.hpp>
#include <iostream>
#include "common.hpp"
#include <boost/redis/src.hpp>
#ifdef BOOST_ASIO_HAS_CO_AWAIT
namespace net = boost::asio;
namespace resp3 = boost::redis::resp3;
using boost::redis::operation;
using connection = boost::redis::connection;

View File

@@ -4,16 +4,13 @@
* accompanying file LICENSE.txt)
*/
#include <iostream>
#include <boost/asio.hpp>
#include <boost/redis/run.hpp>
#include <boost/system/errc.hpp>
#define BOOST_TEST_MODULE conn-quit
#include <boost/test/included/unit_test.hpp>
#include <boost/redis.hpp>
#include <boost/redis/src.hpp>
#include "common.hpp"
#include <iostream>
#include <boost/redis/src.hpp>
namespace net = boost::asio;

View File

@@ -4,17 +4,16 @@
* accompanying file LICENSE.txt)
*/
#include <iostream>
#include <boost/asio.hpp>
#ifdef BOOST_ASIO_HAS_CO_AWAIT
#include <boost/redis/run.hpp>
#include <boost/asio/detached.hpp>
#define BOOST_TEST_MODULE conn-reconnect
#include <boost/test/included/unit_test.hpp>
#include <boost/redis.hpp>
#include <boost/redis/src.hpp>
#include <iostream>
#include "common.hpp"
#include "../examples/start.hpp"
#include <boost/redis/src.hpp>
#ifdef BOOST_ASIO_HAS_CO_AWAIT
namespace net = boost::asio;
using error_code = boost::system::error_code;

View File

@@ -4,18 +4,17 @@
* accompanying file LICENSE.txt)
*/
#include <iostream>
#include <boost/asio.hpp>
#ifdef BOOST_ASIO_HAS_CO_AWAIT
#include <boost/redis/run.hpp>
#include <boost/asio/detached.hpp>
#include <boost/system/errc.hpp>
#include <boost/asio/experimental/as_tuple.hpp>
#define BOOST_TEST_MODULE conn-run-cancel
#include <boost/test/included/unit_test.hpp>
#include <boost/redis.hpp>
#include <boost/redis/src.hpp>
#include <iostream>
#include "common.hpp"
#include <boost/redis/src.hpp>
#ifdef BOOST_ASIO_HAS_CO_AWAIT
namespace net = boost::asio;

View File

@@ -4,17 +4,14 @@
* accompanying file LICENSE.txt)
*/
#include <iostream>
#include <boost/asio.hpp>
#include <boost/redis/run.hpp>
#include <boost/asio/ssl.hpp>
#define BOOST_TEST_MODULE conn-tls
#include <boost/test/included/unit_test.hpp>
#include <boost/redis.hpp>
#include <boost/redis/ssl/connection.hpp>
#include <boost/redis/src.hpp>
#include <iostream>
#include "common.hpp"
#include <boost/redis/src.hpp>
namespace net = boost::asio;

View File

@@ -4,12 +4,13 @@
* accompanying file LICENSE.txt)
*/
#include <boost/redis/detail/read.hpp>
#include <boost/redis/detail/write.hpp>
#include <boost/redis/adapter/adapt.hpp>
#include <boost/asio/connect.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <string>
#include <iostream>
#include <boost/asio/connect.hpp>
#include <boost/redis.hpp>
#include <boost/redis/detail/write.hpp>
#include <boost/redis/src.hpp>
namespace net = boost::asio;

View File

@@ -4,12 +4,15 @@
* accompanying file LICENSE.txt)
*/
#include <boost/asio.hpp>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
#include <boost/redis.hpp>
#include <boost/redis/adapter/adapt.hpp>
#include <boost/redis/detail/read.hpp>
#include <boost/redis/detail/write.hpp>
#include <boost/asio/use_awaitable.hpp>
#include <boost/asio/connect.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <string>
#include <iostream>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
namespace net = boost::asio;
namespace redis = boost::redis;

View File

@@ -5,17 +5,17 @@
*/
// Must come before any asio header, otherwise build fails on msvc.
#include <boost/redis/run.hpp>
#include <boost/redis/check_health.hpp>
#include <boost/asio/as_tuple.hpp>
#include <boost/asio/experimental/awaitable_operators.hpp>
#include <tuple>
#include <iostream>
#include <boost/asio.hpp>
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
#include <boost/redis.hpp>
#include <boost/redis/check_health.hpp>
#include <boost/asio/experimental/awaitable_operators.hpp>
#include "../examples/start.hpp"
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
namespace net = boost::asio;
using namespace net::experimental::awaitable_operators;
using steady_timer = net::use_awaitable_t<>::as_default_on_t<net::steady_timer>;

View File

@@ -4,11 +4,10 @@
* accompanying file LICENSE.txt)
*/
#include <map>
#include <iostream>
#include <optional>
#include <sstream>
#include <boost/redis/request.hpp>
#include <boost/redis/response.hpp>
#include <boost/redis/adapter/adapt.hpp>
#include <boost/redis/detail/read.hpp>
#include <boost/system/errc.hpp>
#include <boost/asio/awaitable.hpp>
#include <boost/asio/redirect_error.hpp>
@@ -18,8 +17,11 @@
#include <boost/beast/_experimental/test/stream.hpp>
#define BOOST_TEST_MODULE low level
#include <boost/test/included/unit_test.hpp>
#include <map>
#include <iostream>
#include <optional>
#include <sstream>
#include <boost/redis.hpp>
#include <boost/redis/src.hpp>
// TODO: Test with empty strings.

View File

@@ -4,12 +4,10 @@
* accompanying file LICENSE.txt)
*/
#include <boost/redis/run.hpp>
#define BOOST_TEST_MODULE run
#include <boost/test/included/unit_test.hpp>
#include <iostream>
#include <boost/asio.hpp>
#include <boost/redis.hpp>
#include <boost/redis/src.hpp>
namespace net = boost::asio;