Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
187 commits
Select commit Hold shift + click to select a range
d767db9
Initial impl
anarthal Feb 9, 2026
30339dd
semaphore
anarthal Feb 9, 2026
4815454
flow_controller
anarthal Feb 10, 2026
23e806c
exec
anarthal Feb 10, 2026
c4f979f
move flow_controller
anarthal Feb 10, 2026
6aeb922
receive2
anarthal Feb 10, 2026
f0671fa
Sentinel resolve
anarthal Feb 10, 2026
c22bffd
Finish prototype
anarthal Feb 10, 2026
6f91ae4
example
anarthal Feb 10, 2026
0953d3a
implement connect
anarthal Feb 10, 2026
c1cc27e
read and write
anarthal Feb 10, 2026
b623d14
connect_fsm to corosio
anarthal Feb 10, 2026
785216e
final touches
anarthal Feb 10, 2026
df473bd
rework main
anarthal Feb 12, 2026
2417d5c
Fixes
anarthal Feb 12, 2026
25ec65c
port 1st test
anarthal Feb 12, 2026
69fb961
test_conn_setup
anarthal Feb 12, 2026
a86626e
Remove old connection
anarthal Feb 12, 2026
7589bbb
trim asio includes
anarthal Feb 12, 2026
09b9497
run_coroutine_test => common
anarthal Feb 12, 2026
653819e
test timeout
anarthal Feb 12, 2026
0a5e4a1
Move to compiled
anarthal Feb 12, 2026
29fa87d
operation_aborted => canceled
anarthal Feb 12, 2026
7fc4de7
misc fixes
anarthal Feb 12, 2026
9d71bf6
test_conn_check_health
anarthal Feb 12, 2026
1646451
CMake and missing files
anarthal Feb 14, 2026
d7ddfda
Fix span member bug
anarthal Apr 14, 2026
aa3d8f3
Latest capy fixes
anarthal Apr 14, 2026
5f46eb3
Fix when_any changes
anarthal Apr 17, 2026
26cacb7
Fix timeout checking
anarthal Apr 21, 2026
5057e61
Use range connect
anarthal Apr 21, 2026
f0c8f1c
Rename to co_connection
anarthal Apr 21, 2026
c75863b
Rename exmaple and tests
anarthal Apr 21, 2026
af04ac3
executor ctors
anarthal Apr 21, 2026
508209b
test cleanup
anarthal Apr 21, 2026
d369c83
Fix test conn setup
anarthal Apr 21, 2026
bf1e366
test rename
anarthal Apr 21, 2026
4b64646
Merge branch 'develop' into feature/corosio
anarthal Apr 21, 2026
1524652
cleanup example
anarthal Apr 21, 2026
4132802
Recover old connection
anarthal Apr 21, 2026
da0faf2
src split
anarthal Apr 21, 2026
18436c7
split test utils
anarthal Apr 21, 2026
4167d5b
Recover Boost span
anarthal Apr 21, 2026
726128e
Recover Redis stream
anarthal Apr 21, 2026
59a93c8
Recover src
anarthal Apr 21, 2026
53adde2
Split connect_fsm
anarthal Apr 21, 2026
3c9f322
Recover read_buffer
anarthal Apr 21, 2026
9a8a34e
Use generic codes (1)
anarthal Apr 21, 2026
7830209
writr uses error conditions
anarthal Apr 21, 2026
d6968f4
Change reader too
anarthal Apr 21, 2026
4cc3873
Remove Asio dependency to detect UNIX sockets
anarthal Apr 21, 2026
1d258b1
Remove unused timer
anarthal Apr 21, 2026
d0cd02a
Remove Asio dependency regarding cancellations
anarthal Apr 21, 2026
de7e4eb
Remove obsolete write
anarthal Apr 21, 2026
e9e7d5d
Remove co_connection::cancel
anarthal Apr 21, 2026
3741cc6
Recover run_coroutine_test
anarthal Apr 21, 2026
dcfd5a0
proper cmake
anarthal Apr 21, 2026
dc6d1bb
use boost::redis::test
anarthal Apr 21, 2026
49f5108
use error conditions
anarthal Apr 21, 2026
3d05217
Proper condition logging
anarthal Apr 21, 2026
665262c
Use pimpl
anarthal Apr 23, 2026
6589d3c
cleanup co_connection
anarthal Apr 23, 2026
1c7d852
UNIX support
anarthal Apr 24, 2026
39ebad5
UNIX test
anarthal Apr 24, 2026
b70b512
recover test_exec_one_fsm
anarthal Apr 24, 2026
587ac50
Recover test_reader_fsm
anarthal Apr 24, 2026
1204f70
writer tests
anarthal Apr 24, 2026
0cb0643
recover a read error
anarthal Apr 24, 2026
0c285b0
Recover test_run_fsm
anarthal Apr 24, 2026
ed219e3
Recover test_sentinel_esolve
anarthal Apr 24, 2026
c889d4d
Recover test_exec_fsm
anarthal Apr 24, 2026
b1ff4dd
co_logging
anarthal Apr 24, 2026
375dccc
Recover all integ tests
anarthal Apr 24, 2026
be091f7
Sanitize tests
anarthal Apr 24, 2026
20b24fc
More cleanup
anarthal Apr 24, 2026
e07ebea
FSM invocation cleanup
anarthal Apr 24, 2026
6c97811
Rework push controller
anarthal Apr 24, 2026
7c2a652
Cleanup
anarthal Apr 25, 2026
4caa0cc
Copy test push
anarthal Apr 25, 2026
f6f9c00
Fix set_receive_response
anarthal Apr 25, 2026
807b936
Migrate test_co_push2
anarthal Apr 25, 2026
ff96a3d
Build fixes
anarthal Apr 25, 2026
b23ef9b
Fix receive bug
anarthal Apr 25, 2026
a7d8d0b
Improve test locality
anarthal Apr 25, 2026
a6ba309
Copy test_co_exec_cancel
anarthal Apr 25, 2026
b94d689
co_exec_cance
anarthal Apr 25, 2026
59d6556
Copy test_co_move
anarthal Apr 25, 2026
da98d7a
Migrate test_co_mve
anarthal Apr 25, 2026
ce93adc
Improve the test
anarthal Apr 25, 2026
3a0a8df
test_co_run_cancel
anarthal Apr 25, 2026
ec93ec2
Copy test_co_sentinel
anarthal Apr 25, 2026
851f922
Copy test_co_tls
anarthal Apr 25, 2026
9eed916
co_sentinel
anarthal Apr 25, 2026
ba26f06
co_tls
anarthal Apr 25, 2026
2a1210c
Improve TLS tests
anarthal Apr 25, 2026
77c31d3
Refactor duplicate fn
anarthal Apr 25, 2026
af641c0
cmake
anarthal Apr 25, 2026
5ece806
Recover asio example
anarthal Apr 25, 2026
2121771
Sanitize example cmake
anarthal Apr 25, 2026
4471636
Corosio subscriber
anarthal Apr 25, 2026
9c82bc7
Install tabs
anarthal Apr 25, 2026
202d7fd
Corosio subscriber docs
anarthal Apr 25, 2026
22e20ca
Copy the other examples
anarthal Apr 25, 2026
6e62a16
Initial impl
anarthal Apr 25, 2026
1927a2d
cmake and cleanup
anarthal Apr 25, 2026
09b1c7c
Containers example
anarthal Apr 25, 2026
cc92017
echo_server
anarthal Apr 25, 2026
73335d1
TLS intro
anarthal Apr 25, 2026
352e621
JSON example
anarthal Apr 25, 2026
0e2b8aa
sentinel example
anarthal Apr 25, 2026
85c467b
spdlog example
anarthal Apr 25, 2026
15b4712
exit 1 cleanup
anarthal Apr 25, 2026
9b18433
UNIX sockets example
anarthal Apr 25, 2026
55b4871
timeout example
anarthal Apr 25, 2026
7b9e7a2
Reference docs
anarthal Apr 25, 2026
8bd2dc6
Reference docs fixes
anarthal Apr 25, 2026
2cf8c82
Merge branch 'develop' into feature/corosio
anarthal Apr 25, 2026
f87babc
Add tagfiles extension
anarthal Apr 29, 2026
f1089c4
First flow_controller test
anarthal Apr 29, 2026
7065d3a
test plan
anarthal Apr 29, 2026
98123c5
take test 2
anarthal Apr 29, 2026
05b5a83
test take cancel
anarthal Apr 29, 2026
690aa01
try_put tests
anarthal Apr 29, 2026
0f5ddb7
more etsts
anarthal Apr 29, 2026
4ce0076
more etsts
anarthal Apr 29, 2026
2a0f9db
cleanup
anarthal Apr 29, 2026
49e1a67
Merge co_connect_fsm into connect
anarthal Apr 29, 2026
c253ef8
Impl friendlier to testing
anarthal Apr 29, 2026
d775384
test_co_connect
anarthal Apr 30, 2026
db1df53
test_tcp_tls_success
anarthal Apr 30, 2026
b972291
test_unix_success
anarthal Apr 30, 2026
41bfa90
test_tcp_connect_error
anarthal Apr 30, 2026
aced6d3
Finished test_co_connect test
anarthal Apr 30, 2026
c8753d8
README
anarthal Apr 30, 2026
62b05c3
index building
anarthal Apr 30, 2026
0ee4b47
Remove the tagfiles extension
anarthal Apr 30, 2026
c6caf77
Corosio discussion: index and compiler versions
anarthal Apr 30, 2026
e682441
requests_responses
anarthal Apr 30, 2026
aee9fa0
server pushes
anarthal Apr 30, 2026
b78717a
Cancellation docs
anarthal Apr 30, 2026
ddc3999
serialization
anarthal Apr 30, 2026
f10a585
authentication
anarthal Apr 30, 2026
07e3add
logging
anarthal Apr 30, 2026
8855f84
sentinel
anarthal Apr 30, 2026
b9f4117
examples
anarthal Apr 30, 2026
d8d0b80
Merge branch 'develop' into feature/corosio
anarthal Apr 30, 2026
d9531ae
Fix building
anarthal Apr 30, 2026
51e13b9
align
anarthal Apr 30, 2026
601e72e
fix test cmake
anarthal Apr 30, 2026
b34f45f
split co_connect
anarthal Apr 30, 2026
dcf1036
refactor stream 1
anarthal Apr 30, 2026
4f82e0d
split connect
anarthal Apr 30, 2026
ea2f1f0
further split
anarthal Apr 30, 2026
99687a5
fix the co_connect test
anarthal Apr 30, 2026
f4085e4
prevent endpoint cpying
anarthal Apr 30, 2026
885038e
comment
anarthal Apr 30, 2026
b8a3518
Simplify receive
anarthal Apr 30, 2026
19d607d
misc fixes
anarthal Apr 30, 2026
434baad
split cmake targets
anarthal Apr 30, 2026
40b430d
Fix example building
anarthal Apr 30, 2026
e2ea6bc
Add boost_redis_proto
anarthal Apr 30, 2026
fea0443
Mixing test and fix bug
anarthal Apr 30, 2026
8adced9
fmt
anarthal May 3, 2026
b904475
Merge branch 'develop' into feature/corosio
anarthal May 3, 2026
788912b
b2 support
anarthal May 3, 2026
49bc8dd
Add manual capy/corosio cloning to CI
anarthal May 3, 2026
59be2e7
Fix cloning
anarthal May 4, 2026
a08e18c
Sanitize test linking
anarthal May 5, 2026
bf96b19
Fix build error in move constructor in clang-19
anarthal May 5, 2026
64c22fc
Merge branch 'develop' into corosio
anarthal May 5, 2026
0dceac9
Test fixes
anarthal May 5, 2026
32f05f7
Remove capy dependency from writer_fsm test
anarthal May 5, 2026
4d5ef46
BOOST_REDIS_COROSIO_TESTS guards
anarthal May 5, 2026
80aa50a
CI guards
anarthal May 5, 2026
7b1a0f2
Fix bench build error
anarthal May 5, 2026
aa7684b
Fix unnecessary capy dependency
anarthal May 5, 2026
39ecd92
Proper guarding
anarthal May 5, 2026
133fbbe
CMake tests
anarthal May 5, 2026
d2189a1
remove -Werror for MSVC
anarthal May 5, 2026
7643d16
Loosen run() lifetime rules
anarthal May 5, 2026
6cfcfbe
workaround gcc-11 bug
anarthal May 5, 2026
9a66510
Replace segfaulting test
anarthal May 5, 2026
998a1d2
Fix doc building
anarthal May 5, 2026
e21b797
Fix package name
anarthal May 5, 2026
9cd7b32
Missing libs in b2
anarthal May 6, 2026
eec8ded
Missing cxxstd when building b2 distro
anarthal May 6, 2026
b9953ad
Merge branch 'develop' into corosio
anarthal May 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ jobs:
- name: Build a Boost distribution using B2
run: |
python3 tools/ci.py build-b2-distro \
--toolset ${{ matrix.toolset }}
--toolset ${{ matrix.toolset }} \
--cxxstd ${{ matrix.cxxstd }}

# No Redis server is available on this job, so integration tests are skipped.
# Unit tests are built and run via the CMake superproject build.
Expand Down Expand Up @@ -127,23 +128,23 @@ jobs:
cxxstd: '17'
build-type: 'Debug'
server: "redis:8.2.1-alpine"
corosio-tests: '0'
corosio-api: '0'

- toolset: gcc-11
install: g++-11
container: ubuntu:22.04
cxxstd: '20'
build-type: 'Debug'
server: "valkey/valkey:8.1.3-alpine"
corosio-tests: '0'
corosio-api: '0'

- toolset: gcc-11
install: g++-11
container: ubuntu:22.04
cxxstd: '20'
build-type: 'Release'
server: "redis:7.4.5-alpine"
corosio-tests: '0'
corosio-api: '0'

- toolset: gcc-12
install: g++-12
Expand All @@ -159,7 +160,7 @@ jobs:
cxxstd: '17'
build-type: 'Debug'
server: "valkey/valkey:8.1.3-alpine"
corosio-tests: '0'
corosio-api: '0'

- toolset: gcc-13
install: g++-13
Expand Down Expand Up @@ -189,7 +190,7 @@ jobs:
cxxstd: '17'
build-type: 'Debug'
server: "redis:7.4.5-alpine"
corosio-tests: '0'
corosio-api: '0'

- toolset: gcc-15
install: g++-15
Expand All @@ -213,23 +214,23 @@ jobs:
cxxstd: '20'
build-type: 'Debug'
server: "redis:7.4.5-alpine"
corosio-tests: '0'
corosio-api: '0'

- toolset: clang-12
install: clang-12
container: ubuntu:22.04
cxxstd: '20'
build-type: 'Debug'
server: "redis:8.2.1-alpine"
corosio-tests: '0'
corosio-api: '0'

- toolset: clang-13
install: clang-13
container: ubuntu:22.04
cxxstd: '20'
build-type: 'Debug'
server: "valkey/valkey:8.1.3-alpine"
corosio-tests: '0'
corosio-api: '0'

# clang-14 is the default in Ubuntu 22.04
- toolset: clang-14
Expand All @@ -238,7 +239,7 @@ jobs:
cxxstd: '20'
build-type: 'Debug'
server: "redis:7.4.5-alpine"
corosio-tests: '0'
corosio-api: '0'

- toolset: clang-14
install: 'clang-14 libc++-14-dev libc++abi-14-dev'
Expand All @@ -248,7 +249,7 @@ jobs:
cxxflags: '-stdlib=libc++'
ldflags: '-lc++'
server: "redis:8.2.1-alpine"
corosio-tests: '0'
corosio-api: '0'

- toolset: clang-14
install: 'clang-14 libc++-14-dev libc++abi-14-dev'
Expand All @@ -265,7 +266,7 @@ jobs:
cxxstd: '20'
build-type: 'Debug'
server: "redis:7.4.5-alpine"
corosio-tests: '0'
corosio-api: '0'

- toolset: clang-16
install: clang-16
Expand All @@ -274,7 +275,7 @@ jobs:
build-type: 'Debug'
cxxflags: '-DBOOST_ASIO_DISABLE_LOCAL_SOCKETS=1' # If a system has no UNIX socket support, we build correctly
server: "redis:8.2.1-alpine"
corosio-tests: '0'
corosio-api: '0'

- toolset: clang-17
install: clang-17
Expand Down Expand Up @@ -392,7 +393,8 @@ jobs:
- name: Build a Boost distribution using B2
run: |
docker exec builder /boost-redis/tools/ci.py build-b2-distro \
--toolset ${{ matrix.toolset }}
--toolset ${{ matrix.toolset }} \
--cxxstd ${{ matrix.cxxstd }}

# The CMake superproject build also drives the project tests, including
# integration tests against the Redis server set up above.
Expand All @@ -402,6 +404,7 @@ jobs:
--build-type ${{ matrix.build-type }} \
--cxxstd ${{ matrix.cxxstd }} \
--toolset ${{ matrix.toolset }} \
--corosio-api ${{ matrix.corosio-api == '' && '1' || matrix.corosio-api }} \
"--cxxflags=${{ matrix.cxxflags }} -Werror" \
"--ldflags=${{ matrix.ldflags }}"

Expand All @@ -411,6 +414,7 @@ jobs:
--build-type ${{ matrix.build-type }} \
--cxxstd ${{ matrix.cxxstd }} \
--toolset ${{ matrix.toolset }} \
--corosio-api ${{ matrix.corosio-api == '' && '1' || matrix.corosio-api }} \
"--cxxflags=${{ matrix.cxxflags }} -Werror" \
"--ldflags=${{ matrix.ldflags }}"

Expand All @@ -420,6 +424,7 @@ jobs:
--build-type ${{ matrix.build-type }} \
--cxxstd ${{ matrix.cxxstd }} \
--toolset ${{ matrix.toolset }} \
--corosio-api ${{ matrix.corosio-api == '' && '1' || matrix.corosio-api }} \
"--cxxflags=${{ matrix.cxxflags }} -Werror" \
"--ldflags=${{ matrix.ldflags }}"

Expand All @@ -429,6 +434,7 @@ jobs:
--build-type ${{ matrix.build-type }} \
--cxxstd ${{ matrix.cxxstd }} \
--toolset ${{ matrix.toolset }} \
--corosio-api ${{ matrix.corosio-api == '' && '1' || matrix.corosio-api }} \
"--cxxflags=${{ matrix.cxxflags }} -Werror" \
"--ldflags=${{ matrix.ldflags }}"

Expand Down
56 changes: 47 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ cmake_minimum_required(VERSION 3.8...4.2)

project(boost_redis VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)

# Library
add_library(boost_redis INTERFACE)
add_library(Boost::redis ALIAS boost_redis)
target_include_directories(boost_redis INTERFACE include)
target_compile_features(boost_redis INTERFACE cxx_std_17)

# Dependencies
# Boost dependencies should be already available.
# If other dependencies are not found, we bail out
Expand All @@ -22,24 +16,56 @@ if(NOT OpenSSL_FOUND)
return()
endif()

# This is generated by boostdep
target_link_libraries(boost_redis
# Allow explicit control over the Corosio API.
# TODO: this is temporary, until Capy gets into Boost.
# https://github.com/cppalliance/capy/issues/274
option(BOOST_REDIS_COROSIO_API OFF "Whether to build the Corosio API")

# Library (common)
add_library(boost_redis_proto INTERFACE)
add_library(Boost::redis_proto ALIAS boost_redis_proto)
target_include_directories(boost_redis_proto INTERFACE include)
target_compile_features(boost_redis_proto INTERFACE cxx_std_17)
target_link_libraries(boost_redis_proto
INTERFACE
Boost::asio
Boost::assert
Boost::core
Boost::mp11
Boost::system
Boost::throw_exception
)

# Library (Asio)
add_library(boost_redis INTERFACE)
add_library(Boost::redis ALIAS boost_redis)
target_link_libraries(boost_redis
INTERFACE
Boost::redis_proto
Boost::asio
Threads::Threads
OpenSSL::Crypto
OpenSSL::SSL
)

# Library (Corosio)
if (BOOST_REDIS_COROSIO_API)
add_library(boost_redis_corosio INTERFACE)
add_library(Boost::redis_corosio ALIAS boost_redis_corosio)
target_compile_features(boost_redis_corosio INTERFACE cxx_std_20)
target_link_libraries(boost_redis_corosio
INTERFACE
Boost::redis_proto
Boost::capy
Boost::corosio
Boost::corosio_openssl
)
endif()

# Don't run integration testing unless explicitly requested, since these require a running server
option(BOOST_REDIS_INTEGRATION_TESTS OFF "Whether to build and run integration tests or not")
mark_as_advanced(BOOST_REDIS_INTEGRATION_TESTS)


# Examples and tests
if(BUILD_TESTING)
# Custom target tests; required by the Boost superproject
Expand All @@ -59,3 +85,15 @@ if(BUILD_TESTING)
add_subdirectory(example)
endif()
endif()

if(BOOST_SUPERPROJECT_VERSION AND NOT CMAKE_VERSION VERSION_LESS 3.13)
set(_boost_redis_install_targets boost_redis boost_redis_proto)
if (BOOST_REDIS_COROSIO_API)
list(APPEND _boost_redis_install_targets boost_redis_corosio)
endif()
boost_install(
TARGETS ${_boost_redis_install_targets}
VERSION ${BOOST_SUPERPROJECT_VERSION}
HEADER_DIRECTORY include
)
endif()
62 changes: 59 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Boost.Redis

Boost.Redis is a high-level [Redis](https://redis.io/) client library built on top of
Boost.Redis is a high-level [Redis](https://redis.io/) client library for
[Boost.Asio](https://www.boost.org/doc/libs/latest/doc/html/boost_asio.html)
and [Corosio](https://github.com/cppalliance/corosio/)
that implements the Redis protocol
[RESP3](https://github.com/redis/redis-specifications/blob/master/protocol/RESP3.md).

Expand All @@ -12,18 +13,24 @@ Full documentation is [here](https://www.boost.org/doc/libs/master/libs/redis/in
The requirements for using Boost.Redis are:

* Boost 1.84 or higher. Boost.Redis is included in Boost installations since Boost 1.84.
* C++17 or higher. Supported compilers include gcc 11 and later, clang 11 and later, and Visual Studio 16 (2019) and later.
* When using Asio, C++17 or higher. Supported compilers include gcc 11 and later, clang 11 and later, and MSVC 14.20 and later.
* When using Corosio, C++20 or higher. Supported compilers include gcc 12 and later, clang 17 and later, MSVC 14.34 and later.
* Redis 6 or higher (must support RESP3).
* OpenSSL.

The documentation assumes basic-level knowledge about [Redis](https://redis.io/docs/) and [Boost.Asio](https://www.boost.org/doc/libs/latest/doc/html/boost_asio.html).
The documentation assumes basic-level knowledge about [Redis](https://redis.io/docs/) and either Boost.Asio or Corosio.

## Building the library

To use the library it is necessary to include the following:

```cpp
// If using the Asio API
#include <boost/redis/src.hpp>

// If using the Corosio API
#include <boost/redis/src/proto.hpp>
#include <boost/redis/src/corosio.hpp>
```

in exactly one source file in your applications. Otherwise, the library is header-only.
Expand Down Expand Up @@ -77,6 +84,55 @@ The roles played by the `async_run` and `async_exec` functions are:
be called from multiple places in your code concurrently.
* `connection::async_run`: keeps the connection healthy. It takes care of hostname resolution, session establishment, health-checks, reconnection and coordination of low-level read and write operations. It should be called only once per connection, regardless of the number of requests to execute.

The Corosio API works similarly:

```cpp
#include <boost/redis/co_connection.hpp>
#include <boost/redis/config.hpp>

#include <boost/capy/ex/run_async.hpp>
#include <boost/capy/io_task.hpp>
#include <boost/capy/task.hpp>
#include <boost/capy/when_any.hpp>
#include <boost/corosio/io_context.hpp>

#include <exception>
#include <iostream>

namespace capy = boost::capy;
using namespace boost::redis;
namespace corosio = boost::corosio;

capy::io_task<> run_request(co_connection& conn)
{
// A request containing only a ping command.
request req;
req.push("PING", "Hello world");

// Response where the PONG response will be stored.
response<std::string> resp;

// Executes the request.
auto [ec] = co_await conn.exec(req, resp);
if (ec) {
std::cout << "Error executing PING: " << ec << std::endl;
} else {
std::cout << "PING value: " << std::get<0>(resp).value() << std::endl;
}

co_return {};
}

capy::task<void> co_main()
{
// Create a connection
co_connection conn{co_await capy::this_coro::executor};

// Run the connection and the PING request, in parallel
co_await capy::when_any(run_request(conn), conn.run(config{}));
}
```

## Server pushes

Redis servers can also send a variety of pushes to the client. Some of
Expand Down
4 changes: 3 additions & 1 deletion benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@

add_library(boost_redis_benchmarks_options INTERFACE)
target_link_libraries(boost_redis_benchmarks_options INTERFACE boost_redis_src)
target_link_libraries(boost_redis_benchmarks_options INTERFACE boost_redis_asio_src)
target_link_libraries(boost_redis_benchmarks_options INTERFACE boost_redis_project_options)
target_compile_features(boost_redis_benchmarks_options INTERFACE cxx_std_20)

add_executable(boost_redis_echo_server_client cpp/asio/echo_server_client.cpp)
target_link_libraries(boost_redis_echo_server_client PRIVATE boost_redis_benchmarks_options)
add_dependencies(tests boost_redis_echo_server_client)

add_executable(boost_redis_echo_server_direct cpp/asio/echo_server_direct.cpp)
target_link_libraries(boost_redis_echo_server_direct PRIVATE boost_redis_benchmarks_options)
add_dependencies(tests boost_redis_echo_server_direct)
24 changes: 19 additions & 5 deletions build.jam
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,36 @@

require-b2 5.2 ;

constant boost_dependencies :
/boost/asio//boost_asio
constant boost_dependencies_proto :
/boost/assert//boost_assert
/boost/core//boost_core
/boost/mp11//boost_mp11
/boost/system//boost_system
/boost/throw_exception//boost_throw_exception ;
/boost/throw_exception//boost_throw_exception
;

constant boost_dependencies_asio :
/boost/redis//boost_redis_proto
/boost/asio//boost_asio
;

constant boost_dependencies_corosio :
/boost/redis//boost_redis_proto
/boost/capy//boost_capy
/boost/corosio//boost_corosio
/boost/corosio//boost_corosio_openssl
;

project /boost/redis
: common-requirements
<include>include
;

explicit
[ alias boost_redis : : : : <library>$(boost_dependencies) ]
[ alias all : boost_redis test ]
[ alias boost_redis_proto : : : : <library>$(boost_dependencies_proto) ]
[ alias boost_redis : : : : <library>$(boost_dependencies_asio) ]
[ alias boost_redis_corosio : : : : <library>$(boost_dependencies_corosio) ]
[ alias all : boost_redis_proto boost_redis boost_redis_corosio test ]
;

call-if : boost-library redis
Expand Down
Loading
Loading