Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 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
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
15 changes: 13 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ if (BOOST_REDIS_MAIN_PROJECT)
json
endian
compat
url
filesystem
scope
capy
corosio
)

foreach(dep IN LISTS deps)
Expand All @@ -90,6 +95,9 @@ if (BOOST_REDIS_MAIN_PROJECT)
INTERFACE
Boost::system
Boost::asio
Boost::capy
Boost::corosio
Boost::corosio_openssl
Threads::Threads
OpenSSL::Crypto
OpenSSL::SSL
Expand Down Expand Up @@ -118,6 +126,9 @@ else()
Boost::mp11
Boost::system
Boost::throw_exception
Boost::capy
Boost::corosio
Boost::corosio_openssl
Threads::Threads
OpenSSL::Crypto
OpenSSL::SSL
Expand All @@ -130,7 +141,7 @@ if (BOOST_REDIS_MAIN_PROJECT)
endif()

# Most tests require a running Redis server, so we only run them if we're the main project
if(BOOST_REDIS_MAIN_PROJECT AND BUILD_TESTING)
# if(BOOST_REDIS_MAIN_PROJECT AND BUILD_TESTING)
# Tests and common utilities
add_subdirectory(test)

Expand All @@ -139,4 +150,4 @@ if(BOOST_REDIS_MAIN_PROJECT AND BUILD_TESTING)

# Examples
add_subdirectory(example)
endif()
# endif()
2 changes: 1 addition & 1 deletion benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

add_library(benchmarks_options INTERFACE)
target_link_libraries(benchmarks_options INTERFACE boost_redis_src)
target_link_libraries(benchmarks_options INTERFACE boost_redis_asio)
target_link_libraries(benchmarks_options INTERFACE boost_redis_project_options)
target_compile_features(benchmarks_options INTERFACE cxx_std_20)

Expand Down
2 changes: 1 addition & 1 deletion doc/modules/ROOT/pages/cancellation.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ error after sending the request, but before receiving a response?

In this situation there is no way to know if the request was processed by the server or not.
By default, the library will consider the request as failed,
and `async_exec` will complete with an `asio::error::operation_aborted`
and `async_exec` will complete with an `capy::error::canceled`
error code.

Some requests can be executed several times and result in the same outcome
Expand Down
67 changes: 67 additions & 0 deletions doc/modules/ROOT/pages/pushes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ The most common case is
https://redis.io/docs/latest/develop/pubsub/[Pub/Sub messages]
triggered by `PUBLISH`. The following example shows a typical receiver:

[tabs]
========
Asio::
+
--

[source,cpp]
----
auto receiver(std::shared_ptr<connection> conn) -> asio::awaitable<void>
Expand Down Expand Up @@ -62,6 +68,67 @@ auto receiver(std::shared_ptr<connection> conn) -> asio::awaitable<void>
}
}
----
--

Corosio::
+
--

[source,cpp]
----
capy::io_task<> receiver(co_connection& conn)
{
generic_flat_response resp;
conn.set_receive_response(resp);

// Subscribe to the channel 'mychannel'. You can add any number of channels here.
request req;
req.subscribe({"mychannel"});
auto [sub_ec] = co_await conn.exec(req);
if (sub_ec) {
std::cerr << "Error subscribing: " << sub_ec << std::endl;
co_return {};
}

// You're now subscribed to 'mychannel'. Pushes sent over this channel will be stored
// in resp. If the connection encounters a network error and reconnects to the server,
// it will automatically subscribe to 'mychannel' again. This is transparent to the user.
// You need to use the specialized request::subscribe() function (instead of request::push)
// to enable this behavior.

// Loop to read Redis push messages. The loop terminates when receive() reports an error
// (e.g. cancellation when the surrounding when_any cascade tears down the run loop).
while (true) {
// Wait for pushes
auto [ec] = co_await conn.receive();

// Check for errors and cancellations
if (ec) {
std::cerr << "Error during receive: " << ec << std::endl;
co_return {};
}

// This can happen if a SUBSCRIBE command errored (e.g. insufficient permissions)
if (resp.has_error()) {
std::cerr << "The receive response contains an error: " << resp.error().diagnostic
<< std::endl;
co_return {};
}

// The response must be consumed without suspending the
// coroutine i.e. without the use of async operations.
for (push_view elem : push_parser(resp.value())) {
std::cout << "Received message from channel " << elem.channel << ": " << elem.payload
<< "\n";
}

resp.value().clear();
}
}
----
--

========

Summary of the steps:

Expand Down
2 changes: 2 additions & 0 deletions doc/modules/ROOT/pages/reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ xref:reference:boost/redis/connection.adoc[`connection`]

xref:reference:boost/redis/basic_connection.adoc[`basic_connection`]

xref:reference:boost/redis/co_connection.adoc[`co_connection`]

xref:reference:boost/redis/address.adoc[`address`]

xref:reference:boost/redis/role.adoc[`role`]
Expand Down
1 change: 1 addition & 0 deletions doc/mrdocs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
#define BOOST_ALLOW_DEPRECATED // avoid mrdocs errors with the BOOST_DEPRECATED macro

#include <boost/redis.hpp>
#include <boost/redis/co_connection.hpp>
10 changes: 10 additions & 0 deletions doc/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions doc/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"dependencies": {
"@asciidoctor/tabs": "^1.0.0-beta.6",
"@cppalliance/antora-cpp-reference-extension": "^0.1.0",
"antora": "^3.1.10"
}
Expand Down
2 changes: 2 additions & 0 deletions doc/redis-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ asciidoc:
attributes:
# Scrolling problems appear without this
page-pagination: ''
extensions:
- '@asciidoctor/tabs'

content:
sources:
Expand Down
29 changes: 19 additions & 10 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
add_library(examples_main STATIC main.cpp)
target_link_libraries(examples_main PRIVATE boost_redis_project_options)
target_link_libraries(examples_main PUBLIC boost_redis_asio)

function(make_example EXAMPLE_NAME)
add_executable(${EXAMPLE_NAME} ${EXAMPLE_NAME}.cpp)
target_link_libraries(${EXAMPLE_NAME} PRIVATE boost_redis_src)
target_link_libraries(${EXAMPLE_NAME} PRIVATE boost_redis_project_options)
if (ARGN)
target_link_libraries(${EXAMPLE_NAME} PRIVATE ${ARGN})
endif()
Expand All @@ -15,20 +13,30 @@ function(make_testable_example EXAMPLE_NAME)
add_test(${EXAMPLE_NAME} ${EXAMPLE_NAME} $ENV{BOOST_REDIS_TEST_SERVER} 6379)
endfunction()

make_testable_example(cpp17_intro)
make_testable_example(cpp17_intro_sync)
make_testable_example(cpp17_intro boost_redis_asio)
make_testable_example(cpp17_intro_sync boost_redis_asio)

make_testable_example(cpp20_intro examples_main)
make_testable_example(corosio_intro boost_redis_corosio)
make_testable_example(cpp20_containers examples_main)
make_testable_example(corosio_containers boost_redis_corosio)
make_testable_example(cpp20_json examples_main Boost::json Boost::container_hash)
make_testable_example(corosio_json boost_redis_corosio Boost::json Boost::container_hash)
make_testable_example(cpp20_unix_sockets examples_main)
make_testable_example(corosio_unix_sockets boost_redis_corosio)
make_testable_example(cpp20_timeouts examples_main)
make_testable_example(corosio_timeouts boost_redis_corosio)
make_testable_example(cpp20_sentinel examples_main)
make_testable_example(corosio_sentinel boost_redis_corosio)

make_example(cpp20_subscriber examples_main)
make_example(cpp20_streams examples_main)
make_example(cpp20_echo_server examples_main)
make_example(cpp20_intro_tls examples_main)
make_example(cpp20_subscriber examples_main)
make_example(corosio_subscriber boost_redis_corosio)
make_example(cpp20_streams examples_main)
make_example(corosio_streams boost_redis_corosio)
make_example(cpp20_echo_server examples_main)
make_example(corosio_echo_server boost_redis_corosio)
make_example(cpp20_intro_tls examples_main)
make_example(corosio_intro_tls boost_redis_corosio)

# We test the protobuf example only on gcc.
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
Expand All @@ -48,7 +56,8 @@ endif()
# We build and test the spdlog integration example only if the library is found
find_package(spdlog)
if (spdlog_FOUND)
make_testable_example(cpp17_spdlog spdlog::spdlog)
make_testable_example(cpp17_spdlog spdlog::spdlog)
make_testable_example(corosio_spdlog spdlog::spdlog boost_redis_corosio)
else()
message(STATUS "Skipping the spdlog example because the spdlog package couldn't be found")
endif()
Loading
Loading