From 89613e1d2ebb1fc4b7becc760dfc9e733f170f26 Mon Sep 17 00:00:00 2001 From: Marcelo Zimbres Date: Sun, 7 Aug 2022 11:35:41 +0200 Subject: [PATCH] Uploads missing files. --- ...aedis_1_1experimental_1_1sync-members.html | 94 ++++++ classaedis_1_1experimental_1_1sync.html | 249 ++++++++++++++++ ...experimental_1_1sync__wrapper-members.html | 94 ++++++ ...edis_1_1experimental_1_1sync__wrapper.html | 243 ++++++++++++++++ dir_0071e3721a0c5c4a1ad5274289814aff.html | 88 ++++++ dir_13a41d9ad64fb9ae396cb953294783cf.html | 88 ++++++ dir_1f4b4de7ce79899a391e7214696c20ae.html | 92 ++++++ dir_2d8c70af17709e157e30cd5eaaba06e2.html | 88 ++++++ dir_77c374ed62434f1276e23aafc439a873.html | 88 ++++++ dir_89eec5a9d89fb1a77a2b4f745bacc2dd.html | 88 ++++++ dir_c182dba47daf15664f6962aa16cc85fb.html | 92 ++++++ dir_d44c64559bbebec7f509842c48db8b23.html | 92 ++++++ dir_dfb46dffe6d71d3a93e20a9010d8c207.html | 92 ++++++ dir_fc21780ef7622f597daa202227f08e20.html | 92 ++++++ dir_fc85455f487539f903afbbf854185fa3.html | 88 ++++++ echo__server__client_8cpp_source.html | 152 ++++++++++ echo__server__direct_8cpp_source.html | 146 ++++++++++ exec_8hpp_source.html | 273 ++++++++++++++++++ functions_enum.html | 85 ++++++ group__todo.html | 88 ++++++ intro__sync_8cpp_source.html | 138 +++++++++ md_CHANGELOG.html | 138 +++++++++ md_README.html | 86 ++++++ md_benchmarks_benchmarks.html | 141 +++++++++ pages.html | 86 ++++++ search/all_10.html | 37 +++ search/all_10.js | 5 + search/classes_3.html | 37 +++ search/classes_3.js | 4 + search/enumvalues_d.html | 37 +++ search/enumvalues_d.js | 4 + search/functions_6.html | 37 +++ search/functions_6.js | 4 + search/functions_7.html | 37 +++ search/functions_7.js | 5 + search/groups_1.html | 37 +++ search/groups_1.js | 4 + search/pages_1.html | 37 +++ search/pages_1.js | 4 + search/pages_2.html | 37 +++ search/pages_2.js | 4 + search/variables_7.html | 37 +++ search/variables_7.js | 5 + search/variables_8.html | 37 +++ search/variables_8.js | 4 + search/variables_9.html | 37 +++ search/variables_9.js | 4 + structaedis_1_1resp3_1_1node-members.html | 95 ++++++ structaedis_1_1resp3_1_1node.html | 209 ++++++++++++++ subscriber__sync_8cpp_source.html | 172 +++++++++++ sync_8hpp_source.html | 209 ++++++++++++++ sync__wrapper_8hpp_source.html | 228 +++++++++++++++ todo.html | 91 ++++++ 53 files changed, 4459 insertions(+) create mode 100644 classaedis_1_1experimental_1_1sync-members.html create mode 100644 classaedis_1_1experimental_1_1sync.html create mode 100644 classaedis_1_1experimental_1_1sync__wrapper-members.html create mode 100644 classaedis_1_1experimental_1_1sync__wrapper.html create mode 100644 dir_0071e3721a0c5c4a1ad5274289814aff.html create mode 100644 dir_13a41d9ad64fb9ae396cb953294783cf.html create mode 100644 dir_1f4b4de7ce79899a391e7214696c20ae.html create mode 100644 dir_2d8c70af17709e157e30cd5eaaba06e2.html create mode 100644 dir_77c374ed62434f1276e23aafc439a873.html create mode 100644 dir_89eec5a9d89fb1a77a2b4f745bacc2dd.html create mode 100644 dir_c182dba47daf15664f6962aa16cc85fb.html create mode 100644 dir_d44c64559bbebec7f509842c48db8b23.html create mode 100644 dir_dfb46dffe6d71d3a93e20a9010d8c207.html create mode 100644 dir_fc21780ef7622f597daa202227f08e20.html create mode 100644 dir_fc85455f487539f903afbbf854185fa3.html create mode 100644 echo__server__client_8cpp_source.html create mode 100644 echo__server__direct_8cpp_source.html create mode 100644 exec_8hpp_source.html create mode 100644 functions_enum.html create mode 100644 group__todo.html create mode 100644 intro__sync_8cpp_source.html create mode 100644 md_CHANGELOG.html create mode 100644 md_README.html create mode 100644 md_benchmarks_benchmarks.html create mode 100644 pages.html create mode 100644 search/all_10.html create mode 100644 search/all_10.js create mode 100644 search/classes_3.html create mode 100644 search/classes_3.js create mode 100644 search/enumvalues_d.html create mode 100644 search/enumvalues_d.js create mode 100644 search/functions_6.html create mode 100644 search/functions_6.js create mode 100644 search/functions_7.html create mode 100644 search/functions_7.js create mode 100644 search/groups_1.html create mode 100644 search/groups_1.js create mode 100644 search/pages_1.html create mode 100644 search/pages_1.js create mode 100644 search/pages_2.html create mode 100644 search/pages_2.js create mode 100644 search/variables_7.html create mode 100644 search/variables_7.js create mode 100644 search/variables_8.html create mode 100644 search/variables_8.js create mode 100644 search/variables_9.html create mode 100644 search/variables_9.js create mode 100644 structaedis_1_1resp3_1_1node-members.html create mode 100644 structaedis_1_1resp3_1_1node.html create mode 100644 subscriber__sync_8cpp_source.html create mode 100644 sync_8hpp_source.html create mode 100644 sync__wrapper_8hpp_source.html create mode 100644 todo.html diff --git a/classaedis_1_1experimental_1_1sync-members.html b/classaedis_1_1experimental_1_1sync-members.html new file mode 100644 index 00000000..ecf543c3 --- /dev/null +++ b/classaedis_1_1experimental_1_1sync-members.html @@ -0,0 +1,94 @@ + + + + + + + + +Aedis: Member List + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.2.1  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
aedis::experimental::sync< Connection > Member List
+
+
+ +

This is the complete list of members for aedis::experimental::sync< Connection >, including all inherited members.

+ + + + +
exec(resp3::request const &req, ResponseAdapter adapter, boost::system::error_code &ec)aedis::experimental::sync< Connection >inline
exec(resp3::request const &req, ResponseAdapter adapter)aedis::experimental::sync< Connection >inline
sync(failover_config cfg=failover_config{}, connection_config_type conn_cfg=connection_config_type{})aedis::experimental::sync< Connection >inline
+ + + + + diff --git a/classaedis_1_1experimental_1_1sync.html b/classaedis_1_1experimental_1_1sync.html new file mode 100644 index 00000000..a882f699 --- /dev/null +++ b/classaedis_1_1experimental_1_1sync.html @@ -0,0 +1,249 @@ + + + + + + + + +Aedis: aedis::experimental::sync< Connection > Class Template Reference + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.2.1  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+ +
+
aedis::experimental::sync< Connection > Class Template Reference
+
+
+ +

Synchronous wrapper over the conenction class. + More...

+ +

#include <include/aedis/experimental/sync.hpp>

+ + + + + + + + + + + + + +

+Public Member Functions

sync (failover_config cfg=failover_config{}, connection_config_type conn_cfg=connection_config_type{})
 Constructor.
 
template<class ResponseAdapter >
std::size_t exec (resp3::request const &req, ResponseAdapter adapter)
 Executes a command. More...
 
template<class ResponseAdapter >
std::size_t exec (resp3::request const &req, ResponseAdapter adapter, boost::system::error_code &ec)
 Executes a command. More...
 
+

Detailed Description

+

template<class Connection>
+class aedis::experimental::sync< Connection >

+ +

Synchronous wrapper over the conenction class.

+

This class offers a synchronous API on top of the connection class.

+
Template Parameters
+ + +
ConnectionThe connection class. Its executor will be rebound to an internal executor.
+
+
+ +

Definition at line 86 of file sync.hpp.

+

Member Function Documentation

+ +

◆ exec() [1/2]

+ +
+
+
+template<class Connection >
+
+template<class ResponseAdapter >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
std::size_t aedis::experimental::sync< Connection >::exec (resp3::request const & req,
ResponseAdapter adapter 
)
+
+inline
+
+ +

Executes a command.

+

This function will block until execution completes.

+
Parameters
+ + + +
reqThe request.
adapterThe response adapter.
+
+
+
Exceptions
+ + +
std::system_errorin case of error.
+
+
+
Returns
The number of bytes of the response.
+ +

Definition at line 162 of file sync.hpp.

+ +
+
+ +

◆ exec() [2/2]

+ +
+
+
+template<class Connection >
+
+template<class ResponseAdapter >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
std::size_t aedis::experimental::sync< Connection >::exec (resp3::request const & req,
ResponseAdapter adapter,
boost::system::error_code & ec 
)
+
+inline
+
+ +

Executes a command.

+

This function will block until execution completes.

+
Parameters
+ + + + +
reqThe request.
adapterThe response adapter.
ecError code in case of error.
+
+
+
Returns
The number of bytes of the response.
+ +

Definition at line 128 of file sync.hpp.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + + diff --git a/classaedis_1_1experimental_1_1sync__wrapper-members.html b/classaedis_1_1experimental_1_1sync__wrapper-members.html new file mode 100644 index 00000000..a23c8a76 --- /dev/null +++ b/classaedis_1_1experimental_1_1sync__wrapper-members.html @@ -0,0 +1,94 @@ + + + + + + + + +Aedis: Member List + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.2.1  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
aedis::experimental::sync_wrapper< Connection > Member List
+
+
+ +

This is the complete list of members for aedis::experimental::sync_wrapper< Connection >, including all inherited members.

+ + + + +
exec(resp3::request const &req, ResponseAdapter adapter, boost::system::error_code &ec)aedis::experimental::sync_wrapper< Connection >inline
exec(resp3::request const &req, ResponseAdapter adapter)aedis::experimental::sync_wrapper< Connection >inline
sync_wrapper(config cfg=config{})aedis::experimental::sync_wrapper< Connection >inline
+ + + + + diff --git a/classaedis_1_1experimental_1_1sync__wrapper.html b/classaedis_1_1experimental_1_1sync__wrapper.html new file mode 100644 index 00000000..2704719b --- /dev/null +++ b/classaedis_1_1experimental_1_1sync__wrapper.html @@ -0,0 +1,243 @@ + + + + + + + + +Aedis: aedis::experimental::sync_wrapper< Connection > Class Template Reference + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.2.1  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+ +
+
aedis::experimental::sync_wrapper< Connection > Class Template Reference
+
+
+ +

Blocking wrapper for the conenction class. + More...

+ +

#include <include/aedis/experimental/sync_wrapper.hpp>

+ + + + + + + + + + + + + +

+Public Member Functions

sync_wrapper (config cfg=config{})
 Constructor.
 
template<class ResponseAdapter >
std::size_t exec (resp3::request const &req, ResponseAdapter adapter)
 Executes a command. More...
 
template<class ResponseAdapter >
std::size_t exec (resp3::request const &req, ResponseAdapter adapter, boost::system::error_code &ec)
 Executes a command. More...
 
+

Detailed Description

+

template<class Connection>
+class aedis::experimental::sync_wrapper< Connection >

+ +

Blocking wrapper for the conenction class.

+

This class offers a synchronous API on top of the connection class.

+ +

Definition at line 71 of file sync_wrapper.hpp.

+

Member Function Documentation

+ +

◆ exec() [1/2]

+ +
+
+
+template<class Connection >
+
+template<class ResponseAdapter >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
std::size_t aedis::experimental::sync_wrapper< Connection >::exec (resp3::request const & req,
ResponseAdapter adapter 
)
+
+inline
+
+ +

Executes a command.

+

This function will block until execution completes.

+
Parameters
+ + + +
reqThe request.
adapterThe response adapter.
+
+
+
Exceptions
+ + +
std::system_errorin case of error.
+
+
+
Returns
The number of bytes of the response.
+ +

Definition at line 147 of file sync_wrapper.hpp.

+ +
+
+ +

◆ exec() [2/2]

+ +
+
+
+template<class Connection >
+
+template<class ResponseAdapter >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
std::size_t aedis::experimental::sync_wrapper< Connection >::exec (resp3::request const & req,
ResponseAdapter adapter,
boost::system::error_code & ec 
)
+
+inline
+
+ +

Executes a command.

+

This function will block until execution completes.

+
Parameters
+ + + + +
reqThe request.
adapterThe response adapter.
ecError code in case of error.
+
+
+
Returns
The number of bytes of the response.
+ +

Definition at line 113 of file sync_wrapper.hpp.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + + diff --git a/dir_0071e3721a0c5c4a1ad5274289814aff.html b/dir_0071e3721a0c5c4a1ad5274289814aff.html new file mode 100644 index 00000000..6042ae61 --- /dev/null +++ b/dir_0071e3721a0c5c4a1ad5274289814aff.html @@ -0,0 +1,88 @@ + + + + + + + + +Aedis: benchmarks/cpp/asio Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.2.1  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
asio Directory Reference
+
+
+
+ + + + + diff --git a/dir_13a41d9ad64fb9ae396cb953294783cf.html b/dir_13a41d9ad64fb9ae396cb953294783cf.html new file mode 100644 index 00000000..0f34e5b5 --- /dev/null +++ b/dir_13a41d9ad64fb9ae396cb953294783cf.html @@ -0,0 +1,88 @@ + + + + + + + + +Aedis: benchmarks Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.3.0  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
benchmarks Directory Reference
+
+
+
+ + + + + diff --git a/dir_1f4b4de7ce79899a391e7214696c20ae.html b/dir_1f4b4de7ce79899a391e7214696c20ae.html new file mode 100644 index 00000000..e827809d --- /dev/null +++ b/dir_1f4b4de7ce79899a391e7214696c20ae.html @@ -0,0 +1,92 @@ + + + + + + + + +Aedis: include/aedis/adapter Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.3.0  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
adapter Directory Reference
+
+
+ + +

+Directories

+
+ + + + + diff --git a/dir_2d8c70af17709e157e30cd5eaaba06e2.html b/dir_2d8c70af17709e157e30cd5eaaba06e2.html new file mode 100644 index 00000000..9f6a05cf --- /dev/null +++ b/dir_2d8c70af17709e157e30cd5eaaba06e2.html @@ -0,0 +1,88 @@ + + + + + + + + +Aedis: include/aedis/adapter/detail Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.3.0  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
detail Directory Reference
+
+
+
+ + + + + diff --git a/dir_77c374ed62434f1276e23aafc439a873.html b/dir_77c374ed62434f1276e23aafc439a873.html new file mode 100644 index 00000000..96e3ef1f --- /dev/null +++ b/dir_77c374ed62434f1276e23aafc439a873.html @@ -0,0 +1,88 @@ + + + + + + + + +Aedis: include/aedis/resp3/detail Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.3.0  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
detail Directory Reference
+
+
+
+ + + + + diff --git a/dir_89eec5a9d89fb1a77a2b4f745bacc2dd.html b/dir_89eec5a9d89fb1a77a2b4f745bacc2dd.html new file mode 100644 index 00000000..210c2199 --- /dev/null +++ b/dir_89eec5a9d89fb1a77a2b4f745bacc2dd.html @@ -0,0 +1,88 @@ + + + + + + + + +Aedis: include/aedis/experimental Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.3.0  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
experimental Directory Reference
+
+
+
+ + + + + diff --git a/dir_c182dba47daf15664f6962aa16cc85fb.html b/dir_c182dba47daf15664f6962aa16cc85fb.html new file mode 100644 index 00000000..2807b6f2 --- /dev/null +++ b/dir_c182dba47daf15664f6962aa16cc85fb.html @@ -0,0 +1,92 @@ + + + + + + + + +Aedis: include/aedis/resp3 Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.3.0  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
resp3 Directory Reference
+
+
+ + +

+Directories

+
+ + + + + diff --git a/dir_d44c64559bbebec7f509842c48db8b23.html b/dir_d44c64559bbebec7f509842c48db8b23.html new file mode 100644 index 00000000..7fb75306 --- /dev/null +++ b/dir_d44c64559bbebec7f509842c48db8b23.html @@ -0,0 +1,92 @@ + + + + + + + + +Aedis: include Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.3.0  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
include Directory Reference
+
+
+ + +

+Directories

+
+ + + + + diff --git a/dir_dfb46dffe6d71d3a93e20a9010d8c207.html b/dir_dfb46dffe6d71d3a93e20a9010d8c207.html new file mode 100644 index 00000000..9b5680ca --- /dev/null +++ b/dir_dfb46dffe6d71d3a93e20a9010d8c207.html @@ -0,0 +1,92 @@ + + + + + + + + +Aedis: benchmarks/cpp Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.2.1  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
cpp Directory Reference
+
+
+ + +

+Directories

+
+ + + + + diff --git a/dir_fc21780ef7622f597daa202227f08e20.html b/dir_fc21780ef7622f597daa202227f08e20.html new file mode 100644 index 00000000..4c96ee53 --- /dev/null +++ b/dir_fc21780ef7622f597daa202227f08e20.html @@ -0,0 +1,92 @@ + + + + + + + + +Aedis: include/aedis Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.3.0  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
aedis Directory Reference
+
+
+ + +

+Directories

+
+ + + + + diff --git a/dir_fc85455f487539f903afbbf854185fa3.html b/dir_fc85455f487539f903afbbf854185fa3.html new file mode 100644 index 00000000..c02bdb00 --- /dev/null +++ b/dir_fc85455f487539f903afbbf854185fa3.html @@ -0,0 +1,88 @@ + + + + + + + + +Aedis: include/aedis/detail Directory Reference + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.3.0  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
detail Directory Reference
+
+
+
+ + + + + diff --git a/echo__server__client_8cpp_source.html b/echo__server__client_8cpp_source.html new file mode 100644 index 00000000..78e7be5e --- /dev/null +++ b/echo__server__client_8cpp_source.html @@ -0,0 +1,152 @@ + + + + + + + + +Aedis: benchmarks/cpp/asio/echo_server_client.cpp Source File + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.2.1  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
echo_server_client.cpp
+
+
+
1 /* Copyright (c) 2018-2022 Marcelo Zimbres Silva (mzimbres@gmail.com)
+
2  *
+
3  * Distributed under the Boost Software License, Version 1.0. (See
+
4  * accompanying file LICENSE.txt)
+
5  */
+
6 
+
7 #include <iostream>
+
8 #include <boost/asio.hpp>
+
9 
+
10 namespace net = boost::asio;
+
11 
+
12 using net::ip::tcp;
+
13 using tcp_socket = net::use_awaitable_t<>::as_default_on_t<net::ip::tcp::socket>;
+
14 using timer_type = net::use_awaitable_t<>::as_default_on_t<net::steady_timer>;
+
15 
+
16 net::awaitable<void>
+
17 example(boost::asio::ip::tcp::endpoint ep, std::string msg, int n)
+
18 {
+
19  try {
+
20  auto ex = co_await net::this_coro::executor;
+
21 
+
22  tcp_socket socket{ex};
+
23  co_await socket.async_connect(ep);
+
24 
+
25  std::string buffer;
+
26  auto dbuffer = net::dynamic_buffer(buffer);
+
27  for (int i = 0; i < n; ++i) {
+
28  co_await net::async_write(socket, net::buffer(msg));
+
29  auto n = co_await net::async_read_until(socket, dbuffer, "\n");
+
30  //std::printf("> %s", buffer.data());
+
31  dbuffer.consume(n);
+
32  }
+
33 
+
34  //std::printf("Ok: %s", msg.data());
+
35  } catch (std::exception const& e) {
+
36  std::cerr << "Error: " << e.what() << std::endl;
+
37  }
+
38 }
+
39 
+
40 int main(int argc, char* argv[])
+
41 {
+
42  try {
+
43  int sessions = 1;
+
44  int msgs = 1;
+
45 
+
46  if (argc == 3) {
+
47  sessions = std::stoi(argv[1]);
+
48  msgs = std::stoi(argv[2]);
+
49  }
+
50 
+
51  net::io_context ioc;
+
52 
+
53  tcp::resolver resv{ioc};
+
54  auto const res = resv.resolve("127.0.0.1", "55555");
+
55  auto ep = *std::begin(res);
+
56 
+
57  for (int i = 0; i < sessions; ++i)
+
58  net::co_spawn(ioc, example(ep, "Some message\n", msgs), net::detached);
+
59 
+
60  ioc.run();
+
61  } catch (std::exception const& e) {
+
62  std::cerr << e.what() << std::endl;
+
63  }
+
64 }
+
+ + + + + diff --git a/echo__server__direct_8cpp_source.html b/echo__server__direct_8cpp_source.html new file mode 100644 index 00000000..1ebabc87 --- /dev/null +++ b/echo__server__direct_8cpp_source.html @@ -0,0 +1,146 @@ + + + + + + + + +Aedis: benchmarks/cpp/asio/echo_server_direct.cpp Source File + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.2.1  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
echo_server_direct.cpp
+
+
+
1 //
+
2 // echo_server.cpp
+
3 // ~~~~~~~~~~~~~~~
+
4 //
+
5 // Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+
6 //
+
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
+
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
9 //
+
10 
+
11 #include <cstdio>
+
12 #include <boost/asio.hpp>
+
13 
+
14 namespace net = boost::asio;
+
15 namespace this_coro = net::this_coro;
+
16 using net::ip::tcp;
+
17 using net::detached;
+
18 using executor_type = net::io_context::executor_type;
+
19 using socket_type = net::basic_stream_socket<net::ip::tcp, executor_type>;
+
20 using tcp_socket = net::use_awaitable_t<executor_type>::as_default_on_t<socket_type>;
+
21 using acceptor_type = net::basic_socket_acceptor<net::ip::tcp, executor_type>;
+
22 using tcp_acceptor = net::use_awaitable_t<executor_type>::as_default_on_t<acceptor_type>;
+
23 using awaitable_type = net::awaitable<void, executor_type>;
+
24 constexpr net::use_awaitable_t<executor_type> use_awaitable;
+
25 
+
26 awaitable_type echo(tcp_socket socket)
+
27 {
+
28  try {
+
29  char data[1024];
+
30  for (;;) {
+
31  std::size_t n = co_await socket.async_read_some(net::buffer(data), use_awaitable);
+
32  co_await async_write(socket, net::buffer(data, n), use_awaitable);
+
33  }
+
34  } catch (std::exception const& e) {
+
35  //std::printf("echo Exception: %s\n", e.what());
+
36  }
+
37 }
+
38 
+
39 awaitable_type listener()
+
40 {
+
41  auto ex = co_await this_coro::executor;
+
42  tcp_acceptor acceptor(ex, {tcp::v4(), 55555});
+
43  for (;;) {
+
44  tcp_socket socket = co_await acceptor.async_accept(use_awaitable);
+
45  co_spawn(ex, echo(std::move(socket)), detached);
+
46  }
+
47 }
+
48 
+
49 int main()
+
50 {
+
51  try {
+
52  net::io_context io_context{BOOST_ASIO_CONCURRENCY_HINT_UNSAFE_IO};
+
53  co_spawn(io_context, listener(), detached);
+
54  io_context.run();
+
55  } catch (std::exception const& e) {
+
56  std::printf("Exception: %s\n", e.what());
+
57  }
+
58 }
+
+ + + + + diff --git a/exec_8hpp_source.html b/exec_8hpp_source.html new file mode 100644 index 00000000..d6e2dba1 --- /dev/null +++ b/exec_8hpp_source.html @@ -0,0 +1,273 @@ + + + + + + + + +Aedis: include/aedis/resp3/detail/exec.hpp Source File + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.3.0  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
exec.hpp
+
+
+
1 /* Copyright (c) 2018-2022 Marcelo Zimbres Silva (mzimbres@gmail.com)
+
2  *
+
3  * Distributed under the Boost Software License, Version 1.0. (See
+
4  * accompanying file LICENSE.txt)
+
5  */
+
6 
+
7 #ifndef AEDIS_RESP3_EXEC_HPP
+
8 #define AEDIS_RESP3_EXEC_HPP
+
9 
+
10 #include <boost/assert.hpp>
+
11 #include <boost/asio/ip/tcp.hpp>
+
12 #include <boost/asio/read.hpp>
+
13 #include <boost/asio/write.hpp>
+
14 #include <boost/asio/coroutine.hpp>
+
15 #include <boost/asio/compose.hpp>
+
16 #include <boost/asio/steady_timer.hpp>
+
17 #include <boost/asio/experimental/parallel_group.hpp>
+
18 
+
19 #include <aedis/error.hpp>
+
20 #include <aedis/resp3/read.hpp>
+
21 #include <aedis/resp3/request.hpp>
+
22 
+
23 namespace aedis {
+
24 namespace resp3 {
+
25 namespace detail {
+
26 
+
27 #include <boost/asio/yield.hpp>
+
28 
+
29 template <
+
30  class AsyncStream,
+
31  class Adapter,
+
32  class DynamicBuffer
+
33  >
+
34 struct exec_op {
+
35  AsyncStream* socket = nullptr;
+
36  request const* req = nullptr;
+
37  Adapter adapter;
+
38  DynamicBuffer dbuf{};
+
39  std::size_t n_cmds = 0;
+
40  std::size_t size = 0;
+
41  boost::asio::coroutine coro{};
+
42 
+
43  template <class Self>
+
44  void operator()( Self& self
+
45  , boost::system::error_code ec = {}
+
46  , std::size_t n = 0)
+
47  {
+
48  reenter (coro) for (;;)
+
49  {
+
50  if (req) {
+
51  yield
+
52  boost::asio::async_write(
+
53  *socket,
+
54  boost::asio::buffer(req->payload()),
+
55  std::move(self));
+
56 
+
57  if (ec || n_cmds == 0) {
+
58  self.complete(ec, n);
+
59  return;
+
60  }
+
61 
+
62  req = nullptr;
+
63  }
+
64 
+
65  yield resp3::async_read(*socket, dbuf, adapter, std::move(self));
+
66  if (ec) {
+
67  self.complete(ec, 0);
+
68  return;
+
69  }
+
70 
+
71  size += n;
+
72  if (--n_cmds == 0) {
+
73  self.complete(ec, size);
+
74  return;
+
75  }
+
76  }
+
77  }
+
78 };
+
79 
+
80 template <
+
81  class AsyncStream,
+
82  class Adapter,
+
83  class DynamicBuffer,
+
84  class CompletionToken = boost::asio::default_completion_token_t<typename AsyncStream::executor_type>
+
85  >
+
86 auto async_exec(
+
87  AsyncStream& socket,
+
88  request const& req,
+
89  Adapter adapter,
+
90  DynamicBuffer dbuf,
+
91  CompletionToken token = CompletionToken{})
+
92 {
+
93  return boost::asio::async_compose
+
94  < CompletionToken
+
95  , void(boost::system::error_code, std::size_t)
+
96  >(detail::exec_op<AsyncStream, Adapter, DynamicBuffer>
+
97  {&socket, &req, adapter, dbuf, req.size()}, token, socket);
+
98 }
+
99 
+
100 template <
+
101  class AsyncStream,
+
102  class Timer,
+
103  class Adapter,
+
104  class DynamicBuffer
+
105  >
+
106 struct exec_with_timeout_op {
+
107  AsyncStream* socket = nullptr;
+
108  Timer* timer = nullptr;
+
109  request const* req = nullptr;
+
110  Adapter adapter;
+
111  DynamicBuffer dbuf{};
+
112  boost::asio::coroutine coro{};
+
113 
+
114  template <class Self>
+
115  void operator()( Self& self
+
116  , std::array<std::size_t, 2> order = {}
+
117  , boost::system::error_code ec1 = {}
+
118  , std::size_t n = 0
+
119  , boost::system::error_code ec2 = {})
+
120  {
+
121  reenter (coro)
+
122  {
+
123  yield
+
124  boost::asio::experimental::make_parallel_group(
+
125  [this](auto token) { return detail::async_exec(*socket, *req, adapter, dbuf, token);},
+
126  [this](auto token) { return timer->async_wait(token);}
+
127  ).async_wait(
+
128  boost::asio::experimental::wait_for_one(),
+
129  std::move(self));
+
130 
+
131  switch (order[0]) {
+
132  case 0:
+
133  {
+
134  if (ec1) {
+
135  self.complete(ec1, 0);
+
136  return;
+
137  }
+
138  } break;
+
139 
+
140  case 1:
+
141  {
+
142  if (!ec2) {
+
143  self.complete(aedis::error::idle_timeout, 0);
+
144  return;
+
145  }
+
146  } break;
+
147 
+
148  default: BOOST_ASSERT(false);
+
149  }
+
150 
+
151  self.complete({}, n);
+
152  }
+
153  }
+
154 };
+
155 
+
156 #include <boost/asio/unyield.hpp>
+
157 
+
158 template <
+
159  class AsyncStream,
+
160  class Timer,
+
161  class Adapter,
+
162  class DynamicBuffer,
+
163  class CompletionToken = boost::asio::default_completion_token_t<typename AsyncStream::executor_type>
+
164  >
+
165 auto async_exec(
+
166  AsyncStream& socket,
+
167  Timer& timer,
+
168  request const& req,
+
169  Adapter adapter,
+
170  DynamicBuffer dbuf,
+
171  CompletionToken token = CompletionToken{})
+
172 {
+
173  return boost::asio::async_compose
+
174  < CompletionToken
+
175  , void(boost::system::error_code, std::size_t)
+
176  >(detail::exec_with_timeout_op<AsyncStream, Timer, Adapter, DynamicBuffer>
+
177  {&socket, &timer, &req, adapter, dbuf}, token, socket, timer);
+
178 }
+
179 
+
180 } // detail
+
181 } // resp3
+
182 } // aedis
+
183 
+
184 #endif // AEDIS_RESP3_EXEC_HPP
+
@ idle_timeout
Idle timeout.
+
+ + + + + diff --git a/functions_enum.html b/functions_enum.html new file mode 100644 index 00000000..f0ca0832 --- /dev/null +++ b/functions_enum.html @@ -0,0 +1,85 @@ + + + + + + + + +Aedis: Class Members - Enumerations + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.3.0  
High level Redis client
+ + + + + + +
+
+
+ + + +
+ +
+
+ + +
+ +
+ +
+
+ + + + + diff --git a/group__todo.html b/group__todo.html new file mode 100644 index 00000000..ee6ffea7 --- /dev/null +++ b/group__todo.html @@ -0,0 +1,88 @@ + + + + + + + + +Aedis: TODO + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.2.1  
High level Redis client
+ + + + + + +
+
+
+ + + +
+ +
+
+ + +
+ +
+ +
+
+
TODO
+
+
+
Todo:

: Support sentinel support as described in sentinel and sentinel-clients

+

: Avoid conflicts between aedis::adapt and aedis::resp3::adapt.

+
+

function.

+
+ + + + + diff --git a/intro__sync_8cpp_source.html b/intro__sync_8cpp_source.html new file mode 100644 index 00000000..1c79404a --- /dev/null +++ b/intro__sync_8cpp_source.html @@ -0,0 +1,138 @@ + + + + + + + + +Aedis: examples/intro_sync.cpp Source File + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.3.0  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
intro_sync.cpp
+
+
+
1 /* Copyright (c) 2018-2022 Marcelo Zimbres Silva (mzimbres@gmail.com)
+
2  *
+
3  * Distributed under the Boost Software License, Version 1.0. (See
+
4  * accompanying file LICENSE.txt)
+
5  */
+
6 
+
7 #include <tuple>
+
8 #include <string>
+
9 #include <boost/asio.hpp>
+
10 #include <aedis.hpp>
+
11 #include <aedis/experimental/sync.hpp>
+
12 
+
13 // Include this in no more than one .cpp file.
+
14 #include <aedis/src.hpp>
+
15 
+
16 namespace net = boost::asio;
+
17 using aedis::adapt;
+ + + +
21 
+
22 int main()
+
23 {
+
24  try {
+
25  net::io_context ioc{1};
+
26  connection conn{ioc};
+
27 
+
28  std::thread thread{[&]() {
+
29  conn.async_run(net::detached);
+
30  ioc.run();
+
31  }};
+
32 
+
33  request req;
+
34  req.push("PING");
+
35  req.push("QUIT");
+
36 
+
37  std::tuple<std::string, aedis::ignore> resp;
+
38  exec(conn, req, adapt(resp));
+
39  thread.join();
+
40 
+
41  std::cout << "Response: " << std::get<0>(resp) << std::endl;
+
42  } catch (std::exception const& e) {
+
43  std::cerr << e.what() << std::endl;
+
44  }
+
45 }
+
A high level Redis connection class.
Definition: connection.hpp:37
+
auto async_run(CompletionToken token=CompletionToken{})
Starts communication with the Redis server asynchronously.
Definition: connection.hpp:172
+
Creates Redis requests.
Definition: request.hpp:48
+
void push(boost::string_view cmd, Ts const &... args)
Appends a new command to the end of the request.
Definition: request.hpp:79
+
std::size_t exec(Connection &conn, resp3::request const &req, ResponseAdapter adapter, boost::system::error_code &ec)
Executes a command.
Definition: sync.hpp:39
+
+ + + + + diff --git a/md_CHANGELOG.html b/md_CHANGELOG.html new file mode 100644 index 00000000..049541c9 --- /dev/null +++ b/md_CHANGELOG.html @@ -0,0 +1,138 @@ + + + + + + + + +Aedis: Changelog + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.3.0  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ +
+
+
+
Changelog
+
+
+

+v0.3.0

+
    +
  • Adds experimental::exec and receive_event functions to offer a thread safe and synchronous way of executing requests across threads. See intro_sync.cpp and subscriber_sync.cpp for examples.
  • +
  • connection::async_read_push was renamed to async_receive_event.
  • +
  • connection::async_receive_event is now being used to communicate internal events to the user, such as resolve, connect, push etc. For examples see subscriber.cpp and connection::event.
  • +
  • The aedis directory has been moved to include to look more similar to Boost libraries. Users should now replace -I/aedis-path with -I/aedis-path/include in the compiler flags.
  • +
  • The AUTH and HELLO commands are now sent automatically. This change was necessary to implement reconnection. The username and password used in AUTH should be provided by the user on connection::config.
  • +
  • Adds support for reconnection. See connection::enable_reconnect.
  • +
  • Fixes a bug in the connection::async_run(host, port) overload that was causing crashes on reconnection.
  • +
  • Fixes the executor usage in the connection class. Before theses changes it was imposing any_io_executor on users.
  • +
  • connection::async_receiver_event is not cancelled anymore when connection::async_run exits. This change makes user code simpler.
  • +
  • connection::async_exec with host and port overload has been removed. Use the other connection::async_run overload.
  • +
  • The host and port parameters from connection::async_run have been move to connection::config to better support authentication and failover.
  • +
  • Many simplifications in the chat_room example.
  • +
  • Fixes build in clang the compilers and makes some improvements in the documentation.
  • +
+

+v0.2.1

+
    +
  • Fixes a bug that happens on very high load.
  • +
+

+v0.2.0

+
    +
  • Major rewrite of the high-level API. There is no more need to use the low-level API anymore.
  • +
  • No more callbacks: Sending requests follows the ASIO asynchrnous model.
  • +
  • Support for reconnection: Pending requests are not canceled when a connection is lost and are re-sent when a new one is established.
  • +
  • The library is not sending HELLO-3 on user behalf anymore. This is important to support AUTH properly.
  • +
+

+v0.1.2

+
    +
  • Adds reconnect coroutine in the echo_server example.
  • +
  • Corrects client::async_wait_for_data with make_parallel_group to launch operation.
  • +
  • Improvements in the documentation.
  • +
  • Avoids dynamic memory allocation in the client class after reconnection.
  • +
+

+v0.1.1

+
    +
  • Improves the documentation and adds some features to the high-level client.
  • +
+

+v0.1.0

+
    +
  • Improvements in the design and documentation.
  • +
+

+v0.0.1

+
    +
  • First release to collect design feedback.
  • +
+
+
+ + + + + diff --git a/md_README.html b/md_README.html new file mode 100644 index 00000000..8ebdbfd4 --- /dev/null +++ b/md_README.html @@ -0,0 +1,86 @@ + + + + + + + + +Aedis: README + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.2.1  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ +
+
+
+
README
+
+
+

See the official github-pages for documentation: https://mzimbres.github.io/aedis

+
+
+ + + + + diff --git a/md_benchmarks_benchmarks.html b/md_benchmarks_benchmarks.html new file mode 100644 index 00000000..8646e7a9 --- /dev/null +++ b/md_benchmarks_benchmarks.html @@ -0,0 +1,141 @@ + + + + + + + + +Aedis: TCP echo server performance + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.3.0  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ +
+
+
+
TCP echo server performance
+
+
+

This document benchmarks the performance of TCP echo servers I implemented in different languages using different Redis clients. The main motivations for choosing an echo server are

+
    +
  • Simple to implement and does not require expertise level in most languages.
  • +
  • I/O bound: Echo servers have very low CPU consumption in general and therefore are excelent to measure how a program handles concurrent requests.
  • +
  • It simulates very well a typical backend in regard to concurrency.
  • +
+

I also imposed some constraints on the implementations

+
    +
  • It should be simple enough and not require writing too much code.
  • +
  • Favor the use standard idioms and avoid optimizations that require expert level.
  • +
  • Avoid the use of complex things like connection and thread pool.
  • +
+

+No Redis

+

First I tested a pure TCP echo server, i.e. one that sends the messages directly to the client without interacting with Redis. The result can be seen below

+

+

The tests were performed with a 1000 concurrent TCP connections on the localhost where latency is 0.07ms on average on my machine. On higher latency networks the difference among libraries is expected to decrease.

+

+Remarks

+
    +
  • I expected Libuv to have similar performance to Asio and Tokio.
  • +
  • I did expect nodejs to come a little behind given it is is javascript code. Otherwise I did expect it to have similar performance to libuv since it is the framework behind it.
  • +
  • Go performance did not surprise me: decent and not some much far behind nodejs.
  • +
+

The code used in the benchmarks can be found at

+ +

+Echo over Redis

+

This is similar to the echo server described above but messages are echoed by Redis and not by the echo-server itself, which acts as a proxy between the client and the Redis server. The results can be seen below

+

+

The tests were performed on a network where latency is 35ms on average, otherwise it uses the same number of TCP connections as the previous example.

+

+Remarks

+

As the reader can see, the Libuv and the Rust test are not depicted in the graph, the reasons are

+
    +
  • redis-rs: This client comes so far behind that it can't even be represented together with the other benchmarks without making them look insignificant. I don't know for sure why it is so slow, I suppose it has something to do with its lack of proper pipelining support. In fact, the more TCP connections I lauch the worst its performance gets.
  • +
  • Libuv: I left it out because it would require too much work to write it and make it have a good performance. More specifically, I would have to use hiredis and implement support for pipelines manually.
  • +
+

The code used in the benchmarks can be found at

+ +

+Running the benchmarks

+

Run one of the echo-server programs in one terminal and the echo-server-client in another.

+

+Contributing

+

If your spot any performance improvement in any of the example or would like to include other clients, please open a PR and I will gladly merge it.

+
+
+ + + + + diff --git a/pages.html b/pages.html new file mode 100644 index 00000000..675f6eaa --- /dev/null +++ b/pages.html @@ -0,0 +1,86 @@ + + + + + + + + +Aedis: Related Pages + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.3.0  
High level Redis client
+ + + + + + +
+
+
+ + + +
+ +
+
+ + +
+ +
+ +
+
+
Related Pages
+
+
+
Here is a list of all related documentation pages:
+
+
+ + + + + diff --git a/search/all_10.html b/search/all_10.html new file mode 100644 index 00000000..3bf11961 --- /dev/null +++ b/search/all_10.html @@ -0,0 +1,37 @@ + + + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_10.js b/search/all_10.js new file mode 100644 index 00000000..70d9cc9b --- /dev/null +++ b/search/all_10.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['value_78',['value',['../group__any.html#a923b33182800f271bad3155a36231da3',1,'aedis::resp3::node']]], + ['verbatim_5fstring_79',['verbatim_string',['../group__any.html#ggabdb6bdf6f96b4a7a91ed63d2324cef57a94bddd7697a78d3184ec1342f9f89e97',1,'aedis::resp3']]] +]; diff --git a/search/classes_3.html b/search/classes_3.html new file mode 100644 index 00000000..d33343bc --- /dev/null +++ b/search/classes_3.html @@ -0,0 +1,37 @@ + + + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/classes_3.js b/search/classes_3.js new file mode 100644 index 00000000..28dfb29e --- /dev/null +++ b/search/classes_3.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['sync_70',['sync',['../classaedis_1_1experimental_1_1sync.html',1,'aedis::experimental']]] +]; diff --git a/search/enumvalues_d.html b/search/enumvalues_d.html new file mode 100644 index 00000000..47a76159 --- /dev/null +++ b/search/enumvalues_d.html @@ -0,0 +1,37 @@ + + + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/enumvalues_d.js b/search/enumvalues_d.js new file mode 100644 index 00000000..3cde535c --- /dev/null +++ b/search/enumvalues_d.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['verbatim_5fstring_159',['verbatim_string',['../group__any.html#ggabdb6bdf6f96b4a7a91ed63d2324cef57a94bddd7697a78d3184ec1342f9f89e97',1,'aedis::resp3']]] +]; diff --git a/search/functions_6.html b/search/functions_6.html new file mode 100644 index 00000000..9c4f5fc6 --- /dev/null +++ b/search/functions_6.html @@ -0,0 +1,37 @@ + + + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_6.js b/search/functions_6.js new file mode 100644 index 00000000..f5a32619 --- /dev/null +++ b/search/functions_6.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['receive_5fevent_100',['receive_event',['../group__any.html#ga741edfcbb4b5105c81af8ffcb245fce2',1,'aedis::experimental']]] +]; diff --git a/search/functions_7.html b/search/functions_7.html new file mode 100644 index 00000000..46b5c0f6 --- /dev/null +++ b/search/functions_7.html @@ -0,0 +1,37 @@ + + + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_7.js b/search/functions_7.js new file mode 100644 index 00000000..16f886f4 --- /dev/null +++ b/search/functions_7.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['to_5fbulk_101',['to_bulk',['../group__any.html#ga4e21de126538a37995f90914afd51447',1,'aedis::resp3']]], + ['to_5fstring_102',['to_string',['../group__any.html#ga1fd47bfcbb0461e09ec55ea767454ce5',1,'aedis::resp3::to_string(node< String > const &in)'],['../group__any.html#gae50b66df4a64aef687a28d38d6c15992',1,'aedis::resp3::to_string(type t)']]] +]; diff --git a/search/groups_1.html b/search/groups_1.html new file mode 100644 index 00000000..2eb3550d --- /dev/null +++ b/search/groups_1.html @@ -0,0 +1,37 @@ + + + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/groups_1.js b/search/groups_1.js new file mode 100644 index 00000000..1e8db68e --- /dev/null +++ b/search/groups_1.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['todo_134',['TODO',['../group__todo.html',1,'']]] +]; diff --git a/search/pages_1.html b/search/pages_1.html new file mode 100644 index 00000000..a0fb6796 --- /dev/null +++ b/search/pages_1.html @@ -0,0 +1,37 @@ + + + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/pages_1.js b/search/pages_1.js new file mode 100644 index 00000000..715cdfb6 --- /dev/null +++ b/search/pages_1.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['documentation_162',['Documentation',['../index.html',1,'']]] +]; diff --git a/search/pages_2.html b/search/pages_2.html new file mode 100644 index 00000000..084edfd0 --- /dev/null +++ b/search/pages_2.html @@ -0,0 +1,37 @@ + + + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/pages_2.js b/search/pages_2.js new file mode 100644 index 00000000..1c6cc4f3 --- /dev/null +++ b/search/pages_2.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['tcp_20echo_20server_20performance_163',['TCP echo server performance',['../md_benchmarks_benchmarks.html',1,'']]] +]; diff --git a/search/variables_7.html b/search/variables_7.html new file mode 100644 index 00000000..5c263409 --- /dev/null +++ b/search/variables_7.html @@ -0,0 +1,37 @@ + + + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/variables_7.js b/search/variables_7.js new file mode 100644 index 00000000..744d88b2 --- /dev/null +++ b/search/variables_7.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['reconnect_5finterval_115',['reconnect_interval',['../classaedis_1_1connection.html#ace4475814df7b5a1bc8d2545701b9ab0',1,'aedis::connection::config']]], + ['resolve_5ftimeout_116',['resolve_timeout',['../classaedis_1_1connection.html#a650fc6a2f21aaba6e3be507c97da3719',1,'aedis::connection::config']]] +]; diff --git a/search/variables_8.html b/search/variables_8.html new file mode 100644 index 00000000..dc9ec54a --- /dev/null +++ b/search/variables_8.html @@ -0,0 +1,37 @@ + + + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/variables_8.js b/search/variables_8.js new file mode 100644 index 00000000..a4f0f59e --- /dev/null +++ b/search/variables_8.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['username_117',['username',['../classaedis_1_1connection.html#a4c2c5e3c10176852a484b267dd54b8b2',1,'aedis::connection::config']]] +]; diff --git a/search/variables_9.html b/search/variables_9.html new file mode 100644 index 00000000..7b014750 --- /dev/null +++ b/search/variables_9.html @@ -0,0 +1,37 @@ + + + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/variables_9.js b/search/variables_9.js new file mode 100644 index 00000000..c756fbfa --- /dev/null +++ b/search/variables_9.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['value_118',['value',['../group__any.html#a923b33182800f271bad3155a36231da3',1,'aedis::resp3::node']]] +]; diff --git a/structaedis_1_1resp3_1_1node-members.html b/structaedis_1_1resp3_1_1node-members.html new file mode 100644 index 00000000..b773914a --- /dev/null +++ b/structaedis_1_1resp3_1_1node-members.html @@ -0,0 +1,95 @@ + + + + + + + + +Aedis: Member List + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.2.1  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
aedis::resp3::node< String > Member List
+
+
+ +

This is the complete list of members for aedis::resp3::node< String >, including all inherited members.

+ + + + + +
aggregate_sizeaedis::resp3::node< String >
data_typeaedis::resp3::node< String >
depthaedis::resp3::node< String >
valueaedis::resp3::node< String >
+ + + + + diff --git a/structaedis_1_1resp3_1_1node.html b/structaedis_1_1resp3_1_1node.html new file mode 100644 index 00000000..c02c00ea --- /dev/null +++ b/structaedis_1_1resp3_1_1node.html @@ -0,0 +1,209 @@ + + + + + + + + +Aedis: aedis::resp3::node< String > Struct Template Reference + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.2.1  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+ +
+
aedis::resp3::node< String > Struct Template Reference
+
+
+ +

A node in the response tree. + More...

+ +

#include <include/aedis/resp3/node.hpp>

+ + + + + + + + + + + + + + +

+Public Attributes

+std::size_t aggregate_size
 The number of elements of an aggregate.
 
+resp3::type data_type
 The RESP3 type of the data in this node.
 
+std::size_t depth
 The depth of this node in the response tree.
 
+String value
 The actual data. For aggregate types this is usually empty.
 
+

Detailed Description

+

template<class String>
+struct aedis::resp3::node< String >

+ +

A node in the response tree.

+

Redis responses are the pre-order view of the response tree (see https://en.wikipedia.org/wiki/Tree_traversal#Pre-order,_NLR).

+
Remarks
Any Redis response can be received in an array of nodes, for example std::vector<node<std::string>>.
+ +

Definition at line 28 of file node.hpp.

+

Member Data Documentation

+ +

◆ aggregate_size

+ +
+
+
+template<class String >
+ + + + +
std::size_t aedis::resp3::node< String >::aggregate_size
+
+ +

The number of elements of an aggregate.

+ +

Definition at line 33 of file node.hpp.

+ +
+
+ +

◆ data_type

+ +
+
+
+template<class String >
+ + + + +
resp3::type aedis::resp3::node< String >::data_type
+
+ +

The RESP3 type of the data in this node.

+ +

Definition at line 30 of file node.hpp.

+ +
+
+ +

◆ depth

+ +
+
+
+template<class String >
+ + + + +
std::size_t aedis::resp3::node< String >::depth
+
+ +

The depth of this node in the response tree.

+ +

Definition at line 36 of file node.hpp.

+ +
+
+ +

◆ value

+ +
+
+
+template<class String >
+ + + + +
String aedis::resp3::node< String >::value
+
+ +

The actual data. For aggregate types this is usually empty.

+ +

Definition at line 39 of file node.hpp.

+ +
+
+
The documentation for this struct was generated from the following file: +
+ + + + + diff --git a/subscriber__sync_8cpp_source.html b/subscriber__sync_8cpp_source.html new file mode 100644 index 00000000..0d647c61 --- /dev/null +++ b/subscriber__sync_8cpp_source.html @@ -0,0 +1,172 @@ + + + + + + + + +Aedis: examples/subscriber_sync.cpp Source File + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.3.0  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
subscriber_sync.cpp
+
+
+
1 /* Copyright (c) 2018-2022 Marcelo Zimbres Silva (mzimbres@gmail.com)
+
2  *
+
3  * Distributed under the Boost Software License, Version 1.0. (See
+
4  * accompanying file LICENSE.txt)
+
5  */
+
6 
+
7 #include <tuple>
+
8 #include <string>
+
9 #include <boost/asio.hpp>
+
10 #include <aedis.hpp>
+
11 #include <aedis/experimental/sync.hpp>
+
12 #include "print.hpp"
+
13 
+
14 // Include this in no more than one .cpp file.
+
15 #include <aedis/src.hpp>
+
16 
+
17 namespace net = boost::asio;
+ + + + +
22 using aedis::resp3::node;
+
23 using event = connection::event;
+
24 
+
25 // See subscriber.cpp for more info about how to run this example.
+
26 
+
27 void subscriber(connection& conn)
+
28 {
+
29  request req;
+
30  req.push("SUBSCRIBE", "channel");
+
31 
+
32  for (std::vector<node<std::string>> resp;;) {
+
33  auto const ev = receive_event(conn, aedis::adapt(resp));
+
34  switch (ev) {
+ +
36  print_push(resp);
+
37  resp.clear();
+
38  break;
+
39 
+ +
41  // Subscribes to the channels when a new connection is
+
42  // stablished.
+
43  exec(conn, req);
+
44  break;
+
45 
+
46  default:;
+
47  }
+
48  }
+
49 }
+
50 
+
51 int main()
+
52 {
+
53  try {
+
54  net::io_context ioc{1};
+
55  connection conn{ioc};
+
56 
+
57  conn.get_config().enable_events = true;
+
58  conn.get_config().enable_reconnect = true;
+
59 
+
60  std::thread thread{[&]() {
+
61  conn.async_run(net::detached);
+
62  ioc.run();
+
63  }};
+
64 
+
65  subscriber(conn);
+
66  thread.join();
+
67 
+
68  } catch (std::exception const& e) {
+
69  std::cerr << e.what() << std::endl;
+
70  }
+
71 }
+
A high level Redis connection class.
Definition: connection.hpp:37
+
config & get_config() noexcept
Get the config object.
Definition: connection.hpp:347
+
event
Events communicated through async_receive_event.
Definition: connection.hpp:93
+
@ push
A push event has been received.
+
@ hello
Success sending AUTH and HELLO.
+
auto async_run(CompletionToken token=CompletionToken{})
Starts communication with the Redis server asynchronously.
Definition: connection.hpp:172
+
bool enable_events
Enable events.
Definition: connection.hpp:86
+
bool enable_reconnect
Enable automatic reconnection (see also reconnect_interval).
Definition: connection.hpp:89
+
Creates Redis requests.
Definition: request.hpp:48
+
void push(boost::string_view cmd, Ts const &... args)
Appends a new command to the end of the request.
Definition: request.hpp:79
+
auto receive_event(Connection &conn, ResponseAdapter adapter, boost::system::error_code &ec)
Receives server pushes synchronusly.
Definition: sync.hpp:104
+
std::size_t exec(Connection &conn, resp3::request const &req, ResponseAdapter adapter, boost::system::error_code &ec)
Executes a command.
Definition: sync.hpp:39
+
A node in the response tree.
Definition: node.hpp:28
+
+ + + + + diff --git a/sync_8hpp_source.html b/sync_8hpp_source.html new file mode 100644 index 00000000..72b590f7 --- /dev/null +++ b/sync_8hpp_source.html @@ -0,0 +1,209 @@ + + + + + + + + +Aedis: include/aedis/experimental/sync.hpp Source File + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.3.0  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
sync.hpp
+
+
+
1 /* Copyright (c) 2018-2022 Marcelo Zimbres Silva (mzimbres@gmail.com)
+
2  *
+
3  * Distributed under the Boost Software License, Version 1.0. (See
+
4  * accompanying file LICENSE.txt)
+
5  */
+
6 
+
7 #ifndef AEDIS_EXPERIMENTAL_SYNC_HPP
+
8 #define AEDIS_EXPERIMENTAL_SYNC_HPP
+
9 
+
10 #include <aedis/adapt.hpp>
+
11 #include <aedis/connection.hpp>
+
12 #include <aedis/resp3/request.hpp>
+
13 
+
14 namespace aedis {
+
15 namespace experimental {
+
16 namespace detail {
+
17 
+
18 struct sync {
+
19  std::mutex mutex;
+
20  std::condition_variable cv;
+
21  bool ready = false;
+
22 };
+
23 
+
24 } // detail
+
25 
+
37 template <class Connection, class ResponseAdapter>
+
38 std::size_t
+ +
40  Connection& conn,
+
41  resp3::request const& req,
+
42  ResponseAdapter adapter,
+
43  boost::system::error_code& ec)
+
44 {
+
45  detail::sync sh;
+
46  std::size_t res = 0;
+
47 
+
48  auto f = [&conn, &ec, &res, &sh, &req, adapter]()
+
49  {
+
50  conn.async_exec(req, adapter, [&sh, &res, &ec](auto const& ecp, std::size_t n) {
+
51  std::unique_lock ul(sh.mutex);
+
52  ec = ecp;
+
53  res = n;
+
54  sh.ready = true;
+
55  ul.unlock();
+
56  sh.cv.notify_one();
+
57  });
+
58  };
+
59 
+
60  boost::asio::dispatch(boost::asio::bind_executor(conn.get_executor(), f));
+
61  std::unique_lock lk(sh.mutex);
+
62  sh.cv.wait(lk, [&sh]{return sh.ready;});
+
63  return res;
+
64 }
+
65 
+
77 template <
+
78  class Connection,
+
79  class ResponseAdapter = aedis::detail::response_traits<void>::adapter_type>
+
80 std::size_t
+ +
82  Connection& conn,
+
83  resp3::request const& req,
+
84  ResponseAdapter adapter = aedis::adapt())
+
85 {
+
86  boost::system::error_code ec;
+
87  auto const res = exec(conn, req, adapter, ec);
+
88  if (ec)
+
89  throw std::system_error(ec);
+
90  return res;
+
91 }
+
92 
+
103 template <class Connection, class ResponseAdapter>
+ +
105  Connection& conn,
+
106  ResponseAdapter adapter,
+
107  boost::system::error_code& ec)
+
108 {
+
109  using event_type = typename Connection::event;
+
110  std::mutex mutex;
+
111  std::condition_variable cv;
+
112  bool ready = false;
+
113  event_type ev = event_type::invalid;
+
114 
+
115  auto f = [&conn, &ec, &ev, &mutex, &cv, &ready, adapter]()
+
116  {
+
117  conn.async_receive_event(adapter, [&cv, &mutex, &ready, &ev, &ec](auto const& ecp, event_type evp) {
+
118  std::unique_lock ul(mutex);
+
119  ec = ecp;
+
120  ev = evp;
+
121  ready = true;
+
122  ul.unlock();
+
123  cv.notify_one();
+
124  });
+
125  };
+
126 
+
127  boost::asio::dispatch(boost::asio::bind_executor(conn.get_executor(), f));
+
128  std::unique_lock lk(mutex);
+
129  cv.wait(lk, [&ready]{return ready;});
+
130  return ev;
+
131 }
+
132 
+
134 template <
+
135  class Connection,
+
136  class ResponseAdapter = aedis::detail::response_traits<void>::adapter_type>
+
137 auto receive_event(
+
138  Connection& conn,
+
139  ResponseAdapter adapter = aedis::adapt())
+
140 {
+
141  boost::system::error_code ec;
+
142  auto const res = receive_event(conn, adapter, ec);
+
143  if (ec)
+
144  throw std::system_error(ec);
+
145  return res;
+
146 }
+
147 
+
148 } // experimental
+
149 } // aedis
+
150 
+
151 #endif // AEDIS_EXPERIMENTAL_SYNC_HPP
+
Creates Redis requests.
Definition: request.hpp:48
+
auto receive_event(Connection &conn, ResponseAdapter adapter, boost::system::error_code &ec)
Receives server pushes synchronusly.
Definition: sync.hpp:104
+
std::size_t exec(Connection &conn, resp3::request const &req, ResponseAdapter adapter=aedis::adapt())
Executes a command.
Definition: sync.hpp:81
+
+ + + + + diff --git a/sync__wrapper_8hpp_source.html b/sync__wrapper_8hpp_source.html new file mode 100644 index 00000000..5829794e --- /dev/null +++ b/sync__wrapper_8hpp_source.html @@ -0,0 +1,228 @@ + + + + + + + + +Aedis: include/aedis/experimental/sync_wrapper.hpp Source File + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.2.1  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ + +
+
+
+
sync_wrapper.hpp
+
+
+
1 /* Copyright (c) 2018-2022 Marcelo Zimbres Silva (mzimbres@gmail.com)
+
2  *
+
3  * Distributed under the Boost Software License, Version 1.0. (See
+
4  * accompanying file LICENSE.txt)
+
5  */
+
6 
+
7 #ifndef AEDIS_EXPERIMENTAL_SYNC_WRAPPER_HPP
+
8 #define AEDIS_EXPERIMENTAL_SYNC_WRAPPER_HPP
+
9 
+
10 #include <mutex>
+
11 #include <thread>
+
12 #include <memory>
+
13 
+
14 #include <boost/asio/io_context.hpp>
+
15 #include <aedis/connection.hpp>
+
16 #include <aedis/resp3/request.hpp>
+
17 
+
18 namespace aedis {
+
19 namespace experimental {
+
20 namespace detail {
+
21 
+
22 #include <boost/asio/yield.hpp>
+
23 template <class Connection>
+
24 struct failover_op {
+
25  std::shared_ptr<Connection> db;
+
26  boost::string_view host;
+
27  boost::string_view port;
+
28  //typename Connection::timer_type timer{db->get_executor()};
+
29  boost::asio::coroutine coro;
+
30 
+
31  template <class Self>
+
32  void operator()(Self& self, boost::system::error_code ec = {})
+
33  {
+
34  reenter (coro)
+
35  {
+
36  BOOST_ASSERT(db != nullptr);
+
37  yield db->async_run(host, port, std::move(self));
+
38  //timer.expires_at(std::chrono::seconds{1});
+
39  self.complete(ec);
+
40  }
+
41  }
+
42 };
+
43 #include <boost/asio/unyield.hpp>
+
44 
+
45 template <
+
46  class Connection,
+
47  class CompletionToken = boost::asio::default_completion_token_t<typename Connection::executor_type>
+
48  >
+
49 auto async_failover(
+
50  std::shared_ptr<Connection> db,
+
51  boost::string_view host,
+
52  boost::string_view port,
+
53  CompletionToken&& token =
+
54  boost::asio::default_completion_token_t<typename Connection::executor_type>{})
+
55 {
+
56  return boost::asio::async_compose
+
57  < CompletionToken
+
58  , void(boost::system::error_code)
+
59  >(detail::failover_op<Connection> {db, host, port}, token, db->get_executor());
+
60 }
+
61 
+
62 } // detail
+
63 
+
70 template <class Connection>
+
71 class sync_wrapper {
+
72 private:
+
73  boost::asio::io_context ioc{1};
+
74  std::shared_ptr<Connection> db;
+
75  std::thread thread;
+
76 
+
77 public:
+
78  struct config {
+
79  std::chrono::seconds reconnect_wait_time{2};
+
80  };
+
81 
+
83  sync_wrapper(config cfg = config{})
+
84  : db{std::make_shared<Connection>(ioc)}
+
85  { }
+
86 
+
87  // Destructor
+
88  ~sync_wrapper()
+
89  {
+
90  ioc.stop();
+
91  thread.join();
+
92  }
+
93 
+
94  void run(boost::string_view host, boost::string_view port)
+
95  {
+
96  thread = std::thread{[this, host, port]() {
+
97  detail::async_failover(db, host, port, boost::asio::detached);
+
98  ioc.run();
+
99  }};
+
100  }
+
101 
+
111  template <class ResponseAdapter>
+
112  std::size_t
+
113  exec(resp3::request const& req, ResponseAdapter adapter, boost::system::error_code& ec)
+
114  {
+
115  std::mutex m;
+
116  std::condition_variable cv;
+
117  bool ready = false;
+
118  std::size_t res = 0;
+
119 
+
120  auto f = [this, &ec, &res, &m, &cv, &ready, &req, adapter]()
+
121  {
+
122  std::lock_guard lk(m);
+
123  db->async_exec(req, adapter, [&cv, &ready, &res, &ec](auto const& ecp, std::size_t n) {
+
124  ec = ecp;
+
125  res = n;
+
126  ready = true;
+
127  cv.notify_one();
+
128  });
+
129  };
+
130 
+
131  boost::asio::dispatch(boost::asio::bind_executor(ioc, f));
+
132  std::unique_lock lk(m);
+
133  cv.wait(lk, [&ready]{return ready;});
+
134  return res;
+
135  }
+
136 
+
146  template <class ResponseAdapter>
+
147  std::size_t exec(resp3::request const& req, ResponseAdapter adapter)
+
148  {
+
149  boost::system::error_code ec;
+
150  auto const res = exec(req, adapter, ec);
+
151  if (ec)
+
152  throw std::system_error(ec);
+
153  return res;
+
154  }
+
155 };
+
156 
+
157 #endif
+
158 
+
159 } // experimental
+
160 } // aedis
+
Blocking wrapper for the conenction class.
+
sync_wrapper(config cfg=config{})
Constructor.
+
std::size_t exec(resp3::request const &req, ResponseAdapter adapter, boost::system::error_code &ec)
Executes a command.
+
std::size_t exec(resp3::request const &req, ResponseAdapter adapter)
Executes a command.
+
Creates Redis requests.
Definition: request.hpp:48
+
+ + + + + diff --git a/todo.html b/todo.html new file mode 100644 index 00000000..94873224 --- /dev/null +++ b/todo.html @@ -0,0 +1,91 @@ + + + + + + + + +Aedis: Todo List + + + + + + + + + + + +
+
+ + + + + + + +
Aedis 0.2.1  
High level Redis client
+ + + + + + +
+
+
+ + + + +
+
+ + +
+ +
+ +
+
+
+
Todo List
+
+
+
+
Module todo
+

: Support sentinel support as described in sentinel and sentinel-clients

+

: Avoid conflicts between aedis::adapt and aedis::resp3::adapt.

+
+
+
+
+ + + + +