Skip to content

Commit 1f3ef6b

Browse files
committed
Renames node to basic_node.
1 parent a850a6e commit 1f3ef6b

30 files changed

+291
-242
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ if (MSVC)
161161
target_compile_definitions(cpp20_intro_tls PRIVATE _WIN32_WINNT=0x0601)
162162
endif()
163163

164-
add_executable(cpp20_low_level_async examples/cpp20_low_level_async.cpp)
164+
add_executable(cpp20_low_level_async tests/cpp20_low_level_async.cpp)
165165
target_compile_features(cpp20_low_level_async PUBLIC cxx_std_20)
166166
add_test(cpp20_low_level_async cpp20_low_level_async)
167167
target_link_libraries(cpp20_low_level_async common)
@@ -184,7 +184,7 @@ if (MSVC)
184184
target_compile_definitions(echo_server_direct PRIVATE _WIN32_WINNT=0x0601)
185185
endif()
186186

187-
add_executable(cpp17_low_level_sync examples/cpp17_low_level_sync.cpp)
187+
add_executable(cpp17_low_level_sync tests/cpp17_low_level_sync.cpp)
188188
target_compile_features(cpp17_low_level_sync PUBLIC cxx_std_17)
189189
add_test(cpp17_low_level_sync cpp17_low_level_sync)
190190
if (MSVC)

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,11 @@ in no more than one source file in your applications. To build the
844844
examples and tests cmake is supported, for example
845845

846846
```cpp
847-
BOOST_ROOT=/opt/boost_1_80_0 cmake --preset dev
847+
# Linux
848+
$ BOOST_ROOT=/opt/boost_1_80_0 cmake --preset dev
849+
850+
# Windows
851+
$ cmake -G "Visual Studio 17 2022" -A x64 -B bin64 -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
848852
```
849853
## Acknowledgement
850854

examples/common/common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ auto redir(boost::system::error_code& ec)
2424
{ return net::redirect_error(net::use_awaitable, ec); }
2525
}
2626

27-
auto healthy_checker(std::shared_ptr<connection> conn) -> net::awaitable<void>
27+
auto health_check(std::shared_ptr<connection> conn) -> net::awaitable<void>
2828
{
2929
try {
3030
request req;

examples/common/common.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ connect(
2626
std::string const& host,
2727
std::string const& port) -> boost::asio::awaitable<void>;
2828

29-
auto healthy_checker(std::shared_ptr<connection> conn) -> boost::asio::awaitable<void>;
29+
auto health_check(std::shared_ptr<connection> conn) -> boost::asio::awaitable<void>;
3030

3131
auto run(boost::asio::awaitable<void> op) -> int;
3232

examples/cpp20_chat_room.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ auto co_main(std::string host, std::string port) -> net::awaitable<void>
6060

6161
co_await connect(conn, host, port);
6262
co_await ((conn->async_run() || publisher(stream, conn) || receiver(conn) ||
63-
healthy_checker(conn) || sig.async_wait()) && conn->async_exec(req));
63+
health_check(conn) || sig.async_wait()) && conn->async_exec(req));
6464
}
6565

6666
#else // defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR)

examples/cpp20_echo_server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ auto co_main(std::string host, std::string port) -> net::awaitable<void>
5454
req.push("HELLO", 3);
5555

5656
co_await connect(conn, host, port);
57-
co_await ((conn->async_run() || listener(conn) || healthy_checker(conn) ||
57+
co_await ((conn->async_run() || listener(conn) || health_check(conn) ||
5858
sig.async_wait()) && conn->async_exec(req));
5959
}
6060

examples/cpp20_subscriber.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ auto co_main(std::string host, std::string port) -> net::awaitable<void>
5656
// The loop will reconnect on connection lost. To exit type Ctrl-C twice.
5757
for (;;) {
5858
co_await connect(conn, host, port);
59-
co_await ((conn->async_run() || healthy_checker(conn) || receiver(conn)) && conn->async_exec(req));
59+
co_await ((conn->async_run() || health_check(conn) || receiver(conn)) && conn->async_exec(req));
6060

6161
conn->reset_stream();
6262
timer.expires_after(std::chrono::seconds{1});

include/boost/redis/adapter/detail/adapters.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class general_aggregate {
7575

7676
public:
7777
explicit general_aggregate(Result* c = nullptr): result_(c) {}
78-
void operator()(resp3::node<std::string_view> const& nd, system::error_code&)
78+
void operator()(resp3::basic_node<std::string_view> const& nd, system::error_code&)
7979
{
8080
BOOST_ASSERT_MSG(!!result_, "Unexpected null pointer");
8181
switch (nd.data_type) {
@@ -97,7 +97,7 @@ class general_simple {
9797
public:
9898
explicit general_simple(Node* t = nullptr) : result_(t) {}
9999

100-
void operator()(resp3::node<std::string_view> const& nd, system::error_code&)
100+
void operator()(resp3::basic_node<std::string_view> const& nd, system::error_code&)
101101
{
102102
BOOST_ASSERT_MSG(!!result_, "Unexpected null pointer");
103103
switch (nd.data_type) {
@@ -122,7 +122,7 @@ class simple_impl {
122122
void
123123
operator()(
124124
Result& result,
125-
resp3::node<std::string_view> const& n,
125+
resp3::basic_node<std::string_view> const& n,
126126
system::error_code& ec)
127127
{
128128
if (is_aggregate(n.data_type)) {
@@ -146,7 +146,7 @@ class set_impl {
146146
void
147147
operator()(
148148
Result& result,
149-
resp3::node<std::string_view> const& nd,
149+
resp3::basic_node<std::string_view> const& nd,
150150
system::error_code& ec)
151151
{
152152
if (is_aggregate(nd.data_type)) {
@@ -181,7 +181,7 @@ class map_impl {
181181
void
182182
operator()(
183183
Result& result,
184-
resp3::node<std::string_view> const& nd,
184+
resp3::basic_node<std::string_view> const& nd,
185185
system::error_code& ec)
186186
{
187187
if (is_aggregate(nd.data_type)) {
@@ -219,7 +219,7 @@ class vector_impl {
219219
void
220220
operator()(
221221
Result& result,
222-
resp3::node<std::string_view> const& nd,
222+
resp3::basic_node<std::string_view> const& nd,
223223
system::error_code& ec)
224224
{
225225
if (is_aggregate(nd.data_type)) {
@@ -243,7 +243,7 @@ class array_impl {
243243
void
244244
operator()(
245245
Result& result,
246-
resp3::node<std::string_view> const& nd,
246+
resp3::basic_node<std::string_view> const& nd,
247247
system::error_code& ec)
248248
{
249249
if (is_aggregate(nd.data_type)) {
@@ -278,7 +278,7 @@ struct list_impl {
278278
void
279279
operator()(
280280
Result& result,
281-
resp3::node<std::string_view> const& nd,
281+
resp3::basic_node<std::string_view> const& nd,
282282
system::error_code& ec)
283283
{
284284
if (!is_aggregate(nd.data_type)) {
@@ -348,7 +348,7 @@ class wrapper<result<Result>> {
348348
response_type* result_;
349349
typename impl_map<Result>::type impl_;
350350

351-
bool set_if_resp3_error(resp3::node<std::string_view> const& nd) noexcept
351+
bool set_if_resp3_error(resp3::basic_node<std::string_view> const& nd) noexcept
352352
{
353353
switch (nd.data_type) {
354354
case resp3::type::null:
@@ -372,7 +372,7 @@ class wrapper<result<Result>> {
372372

373373
void
374374
operator()(
375-
resp3::node<std::string_view> const& nd,
375+
resp3::basic_node<std::string_view> const& nd,
376376
system::error_code& ec)
377377
{
378378
BOOST_ASSERT_MSG(!!result_, "Unexpected null pointer");
@@ -397,7 +397,7 @@ class wrapper<result<std::optional<T>>> {
397397
response_type* result_;
398398
typename impl_map<T>::type impl_{};
399399

400-
bool set_if_resp3_error(resp3::node<std::string_view> const& nd) noexcept
400+
bool set_if_resp3_error(resp3::basic_node<std::string_view> const& nd) noexcept
401401
{
402402
switch (nd.data_type) {
403403
case resp3::type::blob_error:
@@ -414,7 +414,7 @@ class wrapper<result<std::optional<T>>> {
414414

415415
void
416416
operator()(
417-
resp3::node<std::string_view> const& nd,
417+
resp3::basic_node<std::string_view> const& nd,
418418
system::error_code& ec)
419419
{
420420
BOOST_ASSERT_MSG(!!result_, "Unexpected null pointer");

include/boost/redis/adapter/detail/response_traits.hpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace boost::redis::adapter::detail
2424
class ignore_adapter {
2525
public:
2626
void
27-
operator()(std::size_t, resp3::node<std::string_view> const& nd, system::error_code& ec)
27+
operator()(std::size_t, resp3::basic_node<std::string_view> const& nd, system::error_code& ec)
2828
{
2929
switch (nd.data_type) {
3030
case resp3::type::simple_error: ec = redis::error::resp3_simple_error; break;
@@ -62,7 +62,7 @@ class static_adapter {
6262
void
6363
operator()(
6464
std::size_t i,
65-
resp3::node<std::string_view> const& nd,
65+
resp3::basic_node<std::string_view> const& nd,
6666
system::error_code& ec)
6767
{
6868
using std::visit;
@@ -91,7 +91,7 @@ class vector_adapter {
9191
void
9292
operator()(
9393
std::size_t,
94-
resp3::node<std::string_view> const& nd,
94+
resp3::basic_node<std::string_view> const& nd,
9595
system::error_code& ec)
9696
{
9797
adapter_(nd, ec);
@@ -120,8 +120,8 @@ struct response_traits<result<ignore_t>> {
120120
};
121121

122122
template <class String, class Allocator>
123-
struct response_traits<result<std::vector<resp3::node<String>, Allocator>>> {
124-
using response_type = result<std::vector<resp3::node<String>, Allocator>>;
123+
struct response_traits<result<std::vector<resp3::basic_node<String>, Allocator>>> {
124+
using response_type = result<std::vector<resp3::basic_node<String>, Allocator>>;
125125
using adapter_type = vector_adapter<response_type>;
126126

127127
static auto adapt(response_type& v) noexcept
@@ -142,8 +142,8 @@ class wrapper {
142142
public:
143143
explicit wrapper(Adapter adapter) : adapter_{adapter} {}
144144

145-
void operator()(resp3::node<std::string_view> const& node, system::error_code& ec)
146-
{ return adapter_(0, node, ec); }
145+
void operator()(resp3::basic_node<std::string_view> const& nd, system::error_code& ec)
146+
{ return adapter_(0, nd, ec); }
147147

148148
[[nodiscard]]
149149
auto get_supported_response_size() const noexcept
@@ -153,7 +153,6 @@ class wrapper {
153153
Adapter adapter_;
154154
};
155155

156-
// TODO: Move this to adapt.hpp.
157156
template <class Adapter>
158157
auto make_adapter_wrapper(Adapter adapter)
159158
{

include/boost/redis/adapter/detail/result_traits.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ struct result_traits<ignore_t> {
4848
};
4949

5050
template <class T>
51-
struct result_traits<result<resp3::node<T>>> {
52-
using response_type = result<resp3::node<T>>;
51+
struct result_traits<result<resp3::basic_node<T>>> {
52+
using response_type = result<resp3::basic_node<T>>;
5353
using adapter_type = adapter::detail::general_simple<response_type>;
5454
static auto adapt(response_type& v) noexcept { return adapter_type{&v}; }
5555
};
5656

5757
template <class String, class Allocator>
58-
struct result_traits<result<std::vector<resp3::node<String>, Allocator>>> {
59-
using response_type = result<std::vector<resp3::node<String>, Allocator>>;
58+
struct result_traits<result<std::vector<resp3::basic_node<String>, Allocator>>> {
59+
using response_type = result<std::vector<resp3::basic_node<String>, Allocator>>;
6060
using adapter_type = adapter::detail::general_aggregate<response_type>;
6161
static auto adapt(response_type& v) noexcept { return adapter_type{&v}; }
6262
};
@@ -115,7 +115,7 @@ class static_aggregate_adapter<result<Tuple>> {
115115
}
116116
}
117117

118-
void count(resp3::node<std::string_view> const& nd)
118+
void count(resp3::basic_node<std::string_view> const& nd)
119119
{
120120
if (nd.depth == 1) {
121121
if (is_aggregate(nd.data_type))
@@ -130,7 +130,7 @@ class static_aggregate_adapter<result<Tuple>> {
130130
++i_;
131131
}
132132

133-
void operator()(resp3::node<std::string_view> const& nd, system::error_code& ec)
133+
void operator()(resp3::basic_node<std::string_view> const& nd, system::error_code& ec)
134134
{
135135
using std::visit;
136136

0 commit comments

Comments
 (0)