Skip to content

Commit 75f91f3

Browse files
committed
v1.3.1 and build fixes.
1 parent b9a2356 commit 75f91f3

File tree

5 files changed

+35
-64
lines changed

5 files changed

+35
-64
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
uses: MarkusJx/[email protected]
3636
id: install-boost
3737
with:
38-
boost_version: 1.79.0
38+
boost_version: 1.80.0
3939
platform_version: 22.04
4040
- name: Run CMake
4141
run: |

.github/workflows/coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
uses: MarkusJx/[email protected]
3131
id: install-boost
3232
with:
33-
boost_version: 1.79.0
33+
boost_version: 1.80.0
3434
platform_version: 22.04
3535
- name: Run CMake
3636
run: |

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cmake_minimum_required(VERSION 3.14)
1010

1111
project(
1212
Aedis
13-
VERSION 1.3.0
13+
VERSION 1.3.1
1414
DESCRIPTION "A redis client designed for performance and scalability"
1515
HOMEPAGE_URL "https://mzimbres.github.io/aedis"
1616
LANGUAGES CXX

README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Some of its distinctive features are
1616
* Back pressure, cancellation and low latency.
1717

1818
In addition to that, Aedis hides most of the low-level Asio code away
19-
from the user, which in the majority of the case will be concerned
19+
from the user, which in the majority of the cases will be concerned
2020
with three library entities
2121

2222
* `aedis::resp3::request`: A container of Redis commands.
@@ -73,10 +73,10 @@ reading from the socket. The reationale behind this design is
7373
concurrently.
7474

7575
Before we see with more detail how connections, requests and responses
76-
work, users might find it helpful to skim over the examples, to gain a
77-
better feeling about the library capabilities.
76+
work, users might find it useful to skim over the examples in order to
77+
gain a better feeling about the library capabilities.
7878

79-
* intro.cpp: The Aedis hello-world program. Sends one command to Redis and quits the connection.
79+
* intro.cpp: The Aedis hello-world program. Sends one command and quits the connection.
8080
* intro_tls.cpp: Same as intro.cpp but over TLS.
8181
* intro_sync.cpp: Shows how to use the conneciton class synchronously.
8282
* containers.cpp: Shows how to send and receive STL containers and how to use transactions.
@@ -89,8 +89,8 @@ better feeling about the library capabilities.
8989
* low_level_async.cpp: Sends a ping asynchronously using the low-level API.
9090

9191
To avoid repetition code that is common to all examples have been
92-
grouped in common.hpp. The main function is defined in main.cpp and
93-
used by all examples.
92+
grouped in common.hpp. The main function used in some async examples
93+
has been factored out in the main.cpp file.
9494

9595
<a name="requests"></a>
9696
### Requests
@@ -842,18 +842,18 @@ library, so you can starting using it right away by adding the
842842

843843
```cpp
844844
#include <aedis/src.hpp>
845-
846845
```
847-
in no more than one source file in your applications. For example, to
848-
compile one of the examples manually
846+
847+
in no more than one source file in your applications. To build the
848+
examples and test cmake is supported, for example
849849

850850
```cpp
851-
g++ -std=c++20 -pthread -I/opt/boost_1_79_0/include/ -Iinclude -Iexamples examples/intro.cpp examples/common.cpp
851+
BOOST_ROOT=/opt/boost_1_80_0 cmake --preset dev
852852
```
853853

854854
The requirements for using Aedis are
855855

856-
- Boost 1.79 or greater.
856+
- Boost 1.80 or greater.
857857
- C++17 minimum.
858858
- Redis 6 or higher (must support RESP3).
859859
- Optionally also redis-cli and Redis Sentinel.
@@ -865,8 +865,7 @@ The following compilers are supported
865865

866866
## Acknowledgement
867867

868-
Acknowledgement to people that helped shape Aedis in one way or
869-
another.
868+
Acknowledgement to people that helped shape Aedis
870869

871870
* Richard Hodges ([madmongo1](https://github.com/madmongo1)): For very helpful support with Asio, the design of asynchronous programs, etc.
872871
* Vinícius dos Santos Oliveira ([vinipsmaker](https://github.com/vinipsmaker)): For useful discussion about how Aedis consumes buffers in the read operation.
@@ -876,7 +875,7 @@ another.
876875

877876
## Changelog
878877

879-
### v1.3.0
878+
### v1.3.0-1
880879

881880
* Removes automatic sending of the `HELLO` command. This can't be
882881
implemented properly without bloating the connection class. It is

include/aedis/detail/connection_ops.hpp

Lines changed: 19 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
#include <boost/system.hpp>
1515
#include <boost/asio/write.hpp>
1616
#include <boost/core/ignore_unused.hpp>
17-
#include <boost/asio/deferred.hpp>
18-
#include <boost/asio/append.hpp>
1917
#include <boost/asio/experimental/parallel_group.hpp>
2018

2119
#include <aedis/adapt.hpp>
@@ -31,47 +29,11 @@
3129

3230
namespace aedis::detail {
3331

34-
template <class Channel, class Op, class CompletionToken>
35-
auto async_guarded(Channel& channel, Op op, CompletionToken&& token)
36-
{
37-
return boost::asio::deferred.values(&channel)
38-
| boost::asio::deferred(
39-
[](Channel* ch)
40-
{
41-
return ch->async_receive(boost::asio::append(boost::asio::deferred, ch));
42-
}
43-
)
44-
| boost::asio::deferred(
45-
[op2 = std::move(op)](std::error_code ec, std::size_t, Channel* ch)
46-
{
47-
return boost::asio::deferred.when(!ec)
48-
.then(op2(boost::asio::append(boost::asio::deferred, ch)))
49-
.otherwise(boost::asio::deferred.values(ec, 0, ch));
50-
}
51-
)
52-
| boost::asio::deferred(
53-
[&](std::error_code ec, std::size_t n, Channel* ch)
54-
{
55-
return boost::asio::deferred.when(!ec)
56-
.then(ch->async_send({}, 0, boost::asio::append(boost::asio::deferred, n)))
57-
.otherwise(boost::asio::deferred.values(ec, 0));
58-
}
59-
)
60-
| boost::asio::deferred(
61-
[](std::error_code ec, std::size_t n)
62-
{
63-
return boost::asio::deferred.when(!ec)
64-
.then(boost::asio::deferred.values(boost::system::error_code{}, n))
65-
.otherwise(boost::asio::deferred.values(ec, 0));
66-
}
67-
)
68-
| std::forward<CompletionToken>(token);
69-
}
70-
7132
template <class Conn, class Adapter>
7233
struct receive_op {
7334
Conn* conn = nullptr;
7435
Adapter adapter;
36+
std::size_t read_size = 0;
7537
boost::asio::coroutine coro{};
7638

7739
template <class Self>
@@ -82,16 +44,26 @@ struct receive_op {
8244
{
8345
reenter (coro)
8446
{
47+
yield conn->push_channel_.async_receive(std::move(self));
48+
AEDIS_CHECK_OP1();
49+
8550
yield
86-
async_guarded(
87-
conn->push_channel_,
88-
resp3::async_read(
89-
conn->next_layer(),
90-
conn->make_dynamic_buffer(adapter.get_max_read_size(0)),
91-
adapter, boost::asio::deferred),
92-
std::move(self));
51+
resp3::async_read(
52+
conn->next_layer(),
53+
conn->make_dynamic_buffer(adapter.get_max_read_size(0)),
54+
adapter, std::move(self));
55+
56+
// cancel(receive) is needed to cancel the channel, otherwise
57+
// the read operation will be blocked forever see
58+
// test_push_adapter.
9359
AEDIS_CHECK_OP1(conn->cancel(operation::run); conn->cancel(operation::receive));
94-
self.complete({}, n);
60+
61+
read_size = n;
62+
63+
yield conn->push_channel_.async_send({}, 0, std::move(self));
64+
AEDIS_CHECK_OP1();
65+
66+
self.complete({}, read_size);
9567
return;
9668
}
9769
}

0 commit comments

Comments
 (0)