Skip to content

Commit a00c9e7

Browse files
committed
Doc improvements.
1 parent 0520791 commit a00c9e7

File tree

3 files changed

+51
-46
lines changed

3 files changed

+51
-46
lines changed

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.4.0
13+
VERSION 1.4.1
1414
DESCRIPTION "A redis client library"
1515
HOMEPAGE_URL "https://mzimbres.github.io/aedis"
1616
LANGUAGES CXX

README.md

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,46 @@ The execution of `connection::async_exec` above is composed with
4646
that ensures that one operation is cancelled as soon as the other
4747
completes, these functions play the following roles
4848

49-
* `connection::async_exec`: Execute commands by writing the request payload to the underlying stream and reading the response sent back by Redis. It can be called from multiple places in your code concurrently.
50-
* `connection::async_run`: Coordinate the low-level IO (read and write) operations. It remains suspended until the connection is lost.
51-
52-
The `async_exec` calls won't automatically fail when the connection is
53-
lost, instead, they will remain suspended until either
54-
`connection::cancel(operation::exec)` is called to cancel them all or
55-
a new connection is established and `async_run` is called again.
56-
Users can customise the desired behaviour by carefully choosing
57-
`aedis::resp3::request::config`. The role played by `async_run`
58-
becomes clearer with long-lived connections, which we will cover in
59-
the next section.
49+
* `connection::async_exec`: Execute commands by queuing the request
50+
for writing and wait for the response sent back by Redis. It can be
51+
called from multiple places in your code concurrently.
52+
* `connection::async_run`: Coordinate low-level read and write
53+
operations. More specifically, it will hand IO control to
54+
`async_exec` when a response arrives and to
55+
`aedis::connection::async_receive` when a server-push is received.
56+
It will also trigger writes of pending requests when a reconnection
57+
occurs. It remains suspended until the connection is lost.
58+
59+
By carefully choosing the flags `aedis::resp3::request::config` users
60+
can also express their desire to not automatically cancel pending
61+
requests when the connection is lost, giving the opportunity to
62+
reconnect and call `async_run` again after a failover to trigger their
63+
execution, perhaps in another Redis instance. Before we approach
64+
long-lived connections in the next section users will find it helpful
65+
to skim over the examples
66+
67+
* intro.cpp: The Aedis hello-world program. Sends one command and quits the connection.
68+
* intro_tls.cpp: Same as intro.cpp but over TLS.
69+
* intro_sync.cpp: Shows how to use the connection class synchronously.
70+
* containers.cpp: Shows how to send and receive STL containers and how to use transactions.
71+
* serialization.cpp: Shows how to serialize types using Boost.Json.
72+
* resolve_with_sentinel.cpp: Shows how to resolve a master address using sentinels.
73+
* subscriber.cpp: Shows how to implement pubsub with reconnection re-subscription.
74+
* echo_server.cpp: A simple TCP echo server.
75+
* chat_room.cpp: A command line chat built on Redis pubsub.
76+
* low_level_sync.cpp: Sends a ping synchronously using the low-level API.
77+
* low_level_async.cpp: Sends a ping asynchronously using the low-level API.
78+
79+
To avoid repetition code that is common to some examples has been
80+
grouped in common.hpp. The main function used in some async examples
81+
has been factored out in the main.cpp file.
6082

6183
<a name="connection"></a>
6284
## Connection
6385

6486
For performance reasons we will usually want to perform multiple
6587
requests on the same connection. We can do this with the example above
66-
by decoupling the HELLO command and the call to `async_run` in a
88+
by decoupling the `HELLO` command and the call to `async_run` in a
6789
separate coroutine
6890

6991
```cpp
@@ -561,26 +583,6 @@ In addition to the above users can also use unordered versions of the
561583
containers. The same reasoning also applies to sets e.g. `SMEMBERS`
562584
and other data structures in general.
563585

564-
## Examples
565-
566-
These examples demonstrate what has been discussed so far.
567-
568-
* intro.cpp: The Aedis hello-world program. Sends one command and quits the connection.
569-
* intro_tls.cpp: Same as intro.cpp but over TLS.
570-
* intro_sync.cpp: Shows how to use the connection class synchronously.
571-
* containers.cpp: Shows how to send and receive STL containers and how to use transactions.
572-
* serialization.cpp: Shows how to serialize types using Boost.Json.
573-
* resolve_with_sentinel.cpp: Shows how to resolve a master address using sentinels.
574-
* subscriber.cpp: Shows how to implement pubsub with reconnection re-subscription.
575-
* echo_server.cpp: A simple TCP echo server.
576-
* chat_room.cpp: A command line chat built on Redis pubsub.
577-
* low_level_sync.cpp: Sends a ping synchronously using the low-level API.
578-
* low_level_async.cpp: Sends a ping asynchronously using the low-level API.
579-
580-
To avoid repetition code that is common to all examples has been
581-
grouped in common.hpp. The main function used in some async examples
582-
has been factored out in the main.cpp file.
583-
584586
## Echo server benchmark
585587

586588
This document benchmarks the performance of TCP echo servers I
@@ -829,8 +831,9 @@ Acknowledgement to people that helped shape Aedis
829831

830832
## Changelog
831833

832-
### v1.4.0
834+
### v1.4.0-1
833835

836+
* Renames `retry_on_connection_lost` to `cancel_if_unresponded`. (v1.4.1)
834837
* Removes dependency on Boost.Hana, boost::string_view, Boost.Variant2 and Boost.Spirit.
835838
* Fixes build and setup CI on windows.
836839

include/aedis/resp3/request.hpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -169,35 +169,37 @@ class request {
169169
public:
170170
/// Request configuration options.
171171
struct config {
172-
/** \brief Setting it to true will cause
173-
* `aedis::connection::async_exec` to complete with error if the
172+
/** \brief If `true`
173+
* `aedis::connection::async_exec` will complete with error if the
174174
* connection is lost. Affects only requests that haven't been
175175
* sent yet.
176176
*/
177177
bool cancel_on_connection_lost = true;
178178

179-
/** \brief If true the request will be coalesced with other
179+
/** \brief If `true` the request will be coalesced with other
180180
* requests, see https://redis.io/topics/pipelining. Otherwise
181181
* the request is sent individually.
182182
*/
183183
bool coalesce = true;
184184

185-
/** \brief If true, the request will complete with error if the
186-
* call happens before the connection with Redis was established.
185+
/** \brief If `true` the request will complete with
186+
* aedis::error::not_connected if `async_exec` is called before
187+
* the connection with Redis was established.
187188
*/
188189
bool cancel_if_not_connected = false;
189190

190-
/** \brief If true `aedis::connection::async_exec` will not
191-
* cancel this request if the connection is lost. Affects only
192-
* requests that have been written to the socket but remained
193-
* unresponded when `aedis::connection::async_run` completed.
191+
/** \brief If `false` `aedis::connection::async_exec` will not
192+
* automatically cancel this request if the connection is lost.
193+
* Affects only requests that have been written to the socket
194+
* but remained unresponded when `aedis::connection::async_run`
195+
* completed.
194196
*/
195197
bool cancel_if_unresponded = true;
196198

197-
/** \brief If this request has a HELLO command and this flag is
198-
* true, the `aedis::connection` will move it to the front of
199+
/** \brief If this request has a `HELLO` command and this flag is
200+
* `true`, the `aedis::connection` will move it to the front of
199201
* the queue of awaiting requests. This makes it possible to
200-
* send HELLO and authenticate before other commands are sent.
202+
* send `HELLO` and authenticate before other commands are sent.
201203
*/
202204
bool hello_with_priority = true;
203205
};

0 commit comments

Comments
 (0)