diff --git a/README.md b/README.md index 1a85487a..9aca6a94 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,18 @@ that implements the latest version of the Redis communication protocol [RESP3](https://github.com/redis/redis-specifications/blob/master/protocol/RESP3.md). It makes communication with a Redis server easy by hiding low-level -Asio-related code away from the user, which, in the majority of the -cases will be concerned with only three library entities +code away from the user, which, in the majority of the cases will be +concerned with only three library entities -* `aedis::connection`: A connection to the Redis server that - implements automatic - [pipelining](https://redis.io/docs/manual/pipelining/) and which can - handle requests and server pushes concurrently. +* `aedis::connection`: A connection to the Redis server with + high-level functions to execute Redis commands, receive server + pushes and support for automatic command + [pipelines](https://redis.io/docs/manual/pipelining/). * `aedis::resp3::request`: A container of Redis commands that supports STL containers and user defined data types. * `aedis::adapt()`: A function that adapts data structures to receive responses. -In the next sections we will cover all those points in detail and with +In the next sections we will cover all those points in detail with examples. The requirements for using Aedis are * Boost 1.80 or greater. @@ -53,7 +53,7 @@ auto co_main() -> net::awaitable // From examples/common.hpp to avoid vebosity co_await connect(conn, "127.0.0.1", "6379"); - // A request can contains multiple commands. + // A request can contain multiple commands. resp3::request req; req.push("HELLO", 3); req.push("HGETALL", "hset-key"); @@ -71,8 +71,8 @@ auto co_main() -> net::awaitable ``` The example above uses the Asio awaitable `operator ||` to compose -`connection::async_exec` and `connection::async_run` in a single -operation we can `co_await` on. It also provides cancelation one of +`connection::async_exec` and `connection::async_run` in an +operation we can `co_await` on. It also provides cancelation of one of the operations when the other completes. The role played by these functions are diff --git a/include/aedis/resp3/node.hpp b/include/aedis/resp3/node.hpp index d7fcbb65..a3d4bcd5 100644 --- a/include/aedis/resp3/node.hpp +++ b/include/aedis/resp3/node.hpp @@ -14,11 +14,33 @@ namespace aedis::resp3 { /** \brief A node in the response tree. * \ingroup high-level-api * - * Redis responses are the pre-order view of the response tree (see - * https://en.wikipedia.org/wiki/Tree_traversal#Pre-order,_NLR). + * RESP3 can contain recursive data structures: A map of sets of + * vector of etc. As it is parsed each element is passed to user + * callbacks (push parser), the `aedis::adapt` function. The signature of this + * callback is `f(resp3::node>. + * ```cpp + * resp3::node resp; + * co_await conn->async_exec(req, adapt(resp)); + * ``` + * + * for an aggregate use instead + * + * ```cpp + * std::vector> resp; co_await + * conn->async_exec(req, adapt(resp)); + * ``` + * + * The vector will contain the + * [pre-order](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order,_NLR) + * view of the response tree. Any Redis response can be received in + * an array of nodes as shown above. + * + * \tparam String A `std::string`-like type. */ template struct node {