Skip to content

Commit 88d76df

Browse files
committed
clang-format recursively
1 parent 27a5c25 commit 88d76df

9 files changed

+139
-136
lines changed

core/impl/lookup_in_all_replicas.cxx

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,14 @@ initiate_lookup_in_all_replicas_operation(std::shared_ptr<cluster> core,
6464
if (ec) {
6565
std::optional<std::string> first_error_path{};
6666
std::optional<std::size_t> first_error_index{};
67-
return h(make_subdocument_error_context(make_key_value_error_context(ec, r->id()), ec, first_error_path, first_error_index, false), lookup_in_all_replicas_result{});
67+
return h(
68+
make_subdocument_error_context(make_key_value_error_context(ec, r->id()), ec, first_error_path, first_error_index, false),
69+
lookup_in_all_replicas_result{});
6870
}
6971
struct replica_context {
7072
replica_context(movable_lookup_in_all_replicas_handler handler, std::uint32_t expected_responses)
71-
: handler_(std::move(handler))
72-
, expected_responses_(expected_responses)
73+
: handler_(std::move(handler))
74+
, expected_responses_(expected_responses)
7375
{
7476
}
7577

@@ -84,46 +86,48 @@ initiate_lookup_in_all_replicas_operation(std::shared_ptr<cluster> core,
8486
for (std::size_t idx = 1U; idx <= config.num_replicas.value_or(0U); ++idx) {
8587
document_id replica_id{ r->id() };
8688
replica_id.node_index(idx);
87-
core->execute(impl::lookup_in_replica_request{ std::move(replica_id), r->specs(), r->timeout() }, [ctx](impl::lookup_in_replica_response&& resp) {
88-
movable_lookup_in_all_replicas_handler local_handler{};
89-
{
90-
std::scoped_lock lock(ctx->mutex_);
91-
if (ctx->done_) {
92-
return;
93-
}
94-
--ctx->expected_responses_;
95-
if (resp.ctx.ec()) {
96-
if (ctx->expected_responses_ > 0) {
97-
// just ignore the response
98-
return;
99-
}
100-
} else {
101-
std::vector<lookup_in_replica_result::entry> entries{};
102-
for (auto& field : resp.fields) {
103-
lookup_in_replica_result::entry lookup_in_entry{};
104-
lookup_in_entry.path = field.path;
105-
lookup_in_entry.value = field.value;
106-
lookup_in_entry.exists = field.exists;
107-
lookup_in_entry.original_index = field.original_index;
108-
entries.emplace_back(lookup_in_entry);
109-
}
110-
ctx->result_.emplace_back(lookup_in_replica_result{ resp.cas, entries, resp.deleted, true /* replica */ });
111-
}
112-
if (ctx->expected_responses_ == 0) {
113-
ctx->done_ = true;
114-
std::swap(local_handler, ctx->handler_);
115-
}
116-
}
117-
if (local_handler) {
118-
if (!ctx->result_.empty()) {
119-
resp.ctx.override_ec({});
120-
}
121-
return local_handler(std::move(resp.ctx), std::move(ctx->result_));
122-
}
123-
});
89+
core->execute(
90+
impl::lookup_in_replica_request{ std::move(replica_id), r->specs(), r->timeout() },
91+
[ctx](impl::lookup_in_replica_response&& resp) {
92+
movable_lookup_in_all_replicas_handler local_handler{};
93+
{
94+
std::scoped_lock lock(ctx->mutex_);
95+
if (ctx->done_) {
96+
return;
97+
}
98+
--ctx->expected_responses_;
99+
if (resp.ctx.ec()) {
100+
if (ctx->expected_responses_ > 0) {
101+
// just ignore the response
102+
return;
103+
}
104+
} else {
105+
std::vector<lookup_in_replica_result::entry> entries{};
106+
for (auto& field : resp.fields) {
107+
lookup_in_replica_result::entry lookup_in_entry{};
108+
lookup_in_entry.path = field.path;
109+
lookup_in_entry.value = field.value;
110+
lookup_in_entry.exists = field.exists;
111+
lookup_in_entry.original_index = field.original_index;
112+
entries.emplace_back(lookup_in_entry);
113+
}
114+
ctx->result_.emplace_back(lookup_in_replica_result{ resp.cas, entries, resp.deleted, true /* replica */ });
115+
}
116+
if (ctx->expected_responses_ == 0) {
117+
ctx->done_ = true;
118+
std::swap(local_handler, ctx->handler_);
119+
}
120+
}
121+
if (local_handler) {
122+
if (!ctx->result_.empty()) {
123+
resp.ctx.override_ec({});
124+
}
125+
return local_handler(std::move(resp.ctx), std::move(ctx->result_));
126+
}
127+
});
124128
}
125129

126-
core::operations::lookup_in_request active{document_id{ r->id() } };
130+
core::operations::lookup_in_request active{ document_id{ r->id() } };
127131
active.specs = r->specs();
128132
active.timeout = r->timeout();
129133
core->execute(active, [ctx](core::operations::lookup_in_response&& resp) {

core/impl/lookup_in_all_replicas.hxx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ class lookup_in_all_replicas_request
3535
std::string document_key,
3636
std::vector<couchbase::core::impl::subdoc::command> specs,
3737
std::optional<std::chrono::milliseconds> timeout)
38-
: id_{std::move(bucket_name), std::move(scope_name), std::move(collection_name), std::move(document_key) }
39-
, specs_{std::move( specs )}
40-
, timeout_{ timeout }
38+
: id_{ std::move(bucket_name), std::move(scope_name), std::move(collection_name), std::move(document_key) }
39+
, specs_{ std::move(specs) }
40+
, timeout_{ timeout }
4141
{
4242
}
4343

@@ -62,7 +62,8 @@ class lookup_in_all_replicas_request
6262
std::optional<std::chrono::milliseconds> timeout_{};
6363
};
6464

65-
using movable_lookup_in_all_replicas_handler = utils::movable_function<void(couchbase::subdocument_error_context, lookup_in_all_replicas_result)>;
65+
using movable_lookup_in_all_replicas_handler =
66+
utils::movable_function<void(couchbase::subdocument_error_context, lookup_in_all_replicas_result)>;
6667

6768
void
6869
initiate_lookup_in_all_replicas_operation(std::shared_ptr<cluster> core,

core/impl/lookup_in_any_replica.cxx

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,33 @@ namespace couchbase::core::impl
2727
{
2828
void
2929
initiate_lookup_in_any_replica_operation(std::shared_ptr<cluster> core,
30-
const std::string& bucket_name,
31-
const std::string& scope_name,
32-
const std::string& collection_name,
33-
std::string document_key,
34-
const std::vector<subdoc::command>& specs,
35-
lookup_in_any_replica_options::built options,
36-
lookup_in_any_replica_handler&& handler)
30+
const std::string& bucket_name,
31+
const std::string& scope_name,
32+
const std::string& collection_name,
33+
std::string document_key,
34+
const std::vector<subdoc::command>& specs,
35+
lookup_in_any_replica_options::built options,
36+
lookup_in_any_replica_handler&& handler)
3737
{
3838
return initiate_lookup_in_any_replica_operation(std::move(core),
39-
bucket_name,
40-
scope_name,
41-
collection_name,
42-
std::move(document_key),
43-
specs,
44-
options.timeout,
45-
movable_lookup_in_any_replica_handler{ std::move(handler) });
39+
bucket_name,
40+
scope_name,
41+
collection_name,
42+
std::move(document_key),
43+
specs,
44+
options.timeout,
45+
movable_lookup_in_any_replica_handler{ std::move(handler) });
4646
}
4747

4848
void
4949
initiate_lookup_in_any_replica_operation(std::shared_ptr<cluster> core,
50-
const std::string& bucket_name,
51-
const std::string& scope_name,
52-
const std::string& collection_name,
53-
std::string document_key,
54-
const std::vector<subdoc::command>& specs,
55-
std::optional<std::chrono::milliseconds> timeout,
56-
movable_lookup_in_any_replica_handler&& handler)
50+
const std::string& bucket_name,
51+
const std::string& scope_name,
52+
const std::string& collection_name,
53+
std::string document_key,
54+
const std::vector<subdoc::command>& specs,
55+
std::optional<std::chrono::milliseconds> timeout,
56+
movable_lookup_in_any_replica_handler&& handler)
5757
{
5858
auto request = std::make_shared<couchbase::core::impl::lookup_in_any_replica_request>(
5959
bucket_name, scope_name, collection_name, std::move(document_key), specs, timeout);

core/impl/lookup_in_any_replica.hxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ class lookup_in_any_replica_request
3434
std::string document_key,
3535
std::vector<couchbase::core::impl::subdoc::command> specs,
3636
std::optional<std::chrono::milliseconds> timeout)
37-
: id_{ std::move(bucket_name), std::move(scope_name), std::move(collection_name), std::move(document_key) }
38-
, specs_{std::move( specs )}
39-
, timeout_{ timeout }
37+
: id_{ std::move(bucket_name), std::move(scope_name), std::move(collection_name), std::move(document_key) }
38+
, specs_{ std::move(specs) }
39+
, timeout_{ timeout }
4040
{
4141
}
4242

core/impl/lookup_in_replica.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
* limitations under the License.
1616
*/
1717

18-
#include "core/impl/subdoc/path_flags.hxx"
1918
#include "lookup_in_replica.hxx"
19+
#include "core/impl/subdoc/path_flags.hxx"
2020

2121
#include <couchbase/error_codes.hxx>
2222

2323
namespace couchbase::core::impl
2424
{
2525
std::error_code
26-
lookup_in_replica_request::encode_to(lookup_in_replica_request::encoded_request_type& encoded, mcbp_context&& context )
26+
lookup_in_replica_request::encode_to(lookup_in_replica_request::encoded_request_type& encoded, mcbp_context&& context)
2727
{
2828
if (!context.config->supports_subdoc_read_replica()) {
2929
return errc::common::feature_not_available;

core/impl/lookup_in_replica.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
#include "core/public_fwd.hxx"
2929
#include "core/timeout_defaults.hxx"
3030

31-
#include <couchbase/subdocument_error_context.hxx>
3231
#include <couchbase/lookup_in_result.hxx>
32+
#include <couchbase/subdocument_error_context.hxx>
3333

3434
namespace couchbase::core::impl
3535
{

0 commit comments

Comments
 (0)