Skip to content

Commit b7e60db

Browse files
committed
Fix code style
Signed-off-by: Petr Shumilov <p.shumilov@vkteam.ru>
1 parent db3564f commit b7e60db

5 files changed

Lines changed: 27 additions & 31 deletions

File tree

runtime-light/stdlib/curl/curl-multi-functions.h

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ inline auto f$curl_multi_select(kphp::web::curl::multi_type multi_id, double tim
214214
co_return *res;
215215
}
216216

217-
inline auto f$curl_multi_info_read(kphp::web::curl::multi_type multi_id, std::optional<std::reference_wrapper<int64_t>> msgs_in_queue = {}) noexcept -> kphp::coro::task<Optional<array<int64_t>>>{
217+
inline auto f$curl_multi_info_read(kphp::web::curl::multi_type multi_id,
218+
std::optional<std::reference_wrapper<int64_t>> msgs_in_queue = {}) noexcept -> kphp::coro::task<Optional<array<int64_t>>> {
218219
auto& curl_state{CurlInstanceState::get()};
219220
if (!curl_state.multi_ctx.has(multi_id)) {
220221
co_return false;
@@ -224,7 +225,7 @@ inline auto f$curl_multi_info_read(kphp::web::curl::multi_type multi_id, std::op
224225
constexpr auto CURL_MULTI_INFO_READ_OPTION = 0;
225226

226227
auto props{co_await kphp::forks::id_managed(
227-
kphp::web::get_transfer_properties(kphp::web::composite_transfer{multi_id}, CURL_MULTI_INFO_READ_OPTION, kphp::web::get_properties_policy::load))};
228+
kphp::web::get_transfer_properties(kphp::web::composite_transfer{multi_id}, CURL_MULTI_INFO_READ_OPTION, kphp::web::get_properties_policy::load))};
228229
if (!props.has_value()) [[unlikely]] {
229230
multi_ctx.set_errno(props.error().code, props.error().description);
230231
kphp::web::curl::print_error("could not get info message of multi handle", std::move(props.error()));
@@ -245,10 +246,6 @@ inline auto f$curl_multi_info_read(kphp::web::curl::multi_type multi_id, std::op
245246

246247
const auto& optional_info{it_optional_info->second.to<array<int64_t>>()};
247248
if (!optional_info.has_value()) [[unlikely]] {
248-
// Special case: array of bool should be interpreted as empty array, otherwise raise a warning
249-
if (it_optional_info->second.to<array<bool>>().has_value() == false) { // NOLINT
250-
kphp::log::warning("incorrect format of multi info message: array of options have to be obtained");
251-
}
252249
if (msgs_in_queue.has_value()) {
253250
(*msgs_in_queue).get() = 0;
254251
}
@@ -275,17 +272,17 @@ inline auto f$curl_multi_info_read(kphp::web::curl::multi_type multi_id, std::op
275272
}
276273

277274
if (auto ok{info.has_key(MSG_IDX)}; ok) {
278-
result.set_value(string{"msg"},info.get_value(MSG_IDX));
275+
result.set_value(string{"msg"}, info.get_value(MSG_IDX));
279276
}
280277

281278
if (auto ok{info.has_key(RESULT_IDX)}; ok) {
282-
result.set_value(string{"result"},info.get_value(RESULT_IDX));
279+
result.set_value(string{"result"}, info.get_value(RESULT_IDX));
283280
}
284281

285282
if (auto ok{info.has_key(HANDLE_IDX)}; ok) {
286283
auto easy_id{info.get_value(HANDLE_IDX)};
287284
if (curl_state.easy_ctx.has(easy_id)) {
288-
result.set_value(string{"handle"},info.get_value(HANDLE_IDX));
285+
result.set_value(string{"handle"}, info.get_value(HANDLE_IDX));
289286
}
290287
}
291288

runtime-light/stdlib/web-transfer-lib/defs.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,21 @@ class property_value {
3939

4040
private:
4141
explicit property_value(bool v) noexcept
42-
: value(v) {};
42+
: value(v){};
4343
explicit property_value(int64_t v) noexcept
44-
: value(v) {};
44+
: value(v){};
4545
explicit property_value(double v) noexcept
46-
: value(v) {};
46+
: value(v){};
4747
explicit property_value(string v) noexcept
48-
: value(v) {};
48+
: value(v){};
4949
explicit property_value(array<bool> v) noexcept
50-
: value(v) {};
50+
: value(v){};
5151
explicit property_value(array<int64_t> v) noexcept
52-
: value(v) {};
52+
: value(v){};
5353
explicit property_value(array<double> v) noexcept
54-
: value(v) {};
54+
: value(v){};
5555
explicit property_value(array<string> v) noexcept
56-
: value(v) {};
56+
: value(v){};
5757

5858
std::variant<bool, int64_t, double, string, array<bool>, array<int64_t>, array<double>, array<string>> value;
5959

runtime-light/stdlib/web-transfer-lib/details/web-response.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ inline auto process_simple_response(std::span<const std::byte> request) noexcept
6262
switch (frame_num) {
6363
case 0: {
6464
frame_num += 1;
65-
tl::Either<tl::SimpleWebTransferPerformResultOk, tl::WebError> simple_web_transfer_perform_resp{};
65+
tl::Either<tl::SimpleWebTransferResponseResultOk, tl::WebError> simple_web_transfer_resp{};
6666
tl::fetcher tlf{ok_or_error_buffer};
67-
if (!simple_web_transfer_perform_resp.fetch(tlf)) [[unlikely]] {
67+
if (!simple_web_transfer_resp.fetch(tlf)) [[unlikely]] {
6868
kphp::log::error("failed to parse response of Simple descriptor");
6969
}
70-
if (auto r{simple_web_transfer_perform_resp.value}; std::holds_alternative<tl::WebError>(r)) {
70+
if (auto r{simple_web_transfer_resp.value}; std::holds_alternative<tl::WebError>(r)) {
7171
err.emplace(details::process_error(std::get<tl::WebError>(r)));
7272
return kphp::component::inter_component_session::client::response_readiness::ready;
7373
}

runtime-light/stdlib/web-transfer-lib/web-composite-transfer.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,11 @@ inline auto composite_transfer_close(composite_transfer ct) noexcept -> kphp::co
288288

289289
// Enumerate over all included simple transfers, close and remove them
290290
auto& simple_transfers{web_state.composite_transfer2simple_transfers[ct.descriptor]};
291-
auto it_simple_transfer {simple_transfers.begin()};
291+
auto it_simple_transfer{simple_transfers.begin()};
292292
while (simple_transfers.size()) {
293293
if (auto remove_res{co_await kphp::web::composite_transfer_remove(ct, kphp::web::simple_transfer{*it_simple_transfer})}; !remove_res.has_value()) {
294294
co_return std::move(remove_res);
295295
};
296-
it_simple_transfer = simple_transfers.begin();
297296
}
298297

299298
tl::CompositeWebTransferClose tl_close{tl::u64{ct.descriptor}};
@@ -371,8 +370,8 @@ inline auto composite_transfer_wait_updates(composite_transfer ct,
371370
co_return std::unexpected{details::process_error(std::get<tl::WebError>(result))};
372371
}
373372

374-
const auto awaiters_num{std::get<tl::CompositeWebTransferWaitUpdatesResultOk>(result).awaiters_num.value};
375-
co_return std::expected<uint64_t, error>{awaiters_num};
373+
const auto updated_descriptors_num{std::get<tl::CompositeWebTransferWaitUpdatesResultOk>(result).updated_descriptors_num.value};
374+
co_return std::expected<uint64_t, error>{updated_descriptors_num};
376375
}
377376

378377
} // namespace kphp::web

runtime-light/tl/tl-types.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,18 +1271,18 @@ class SimpleWebTransferOpenResultOk final {
12711271
}
12721272
};
12731273

1274-
class SimpleWebTransferPerformResultOk final {
1275-
static constexpr uint32_t SIMPLE_WEB_TRANSFER_PERFORM_RESULT_OK_MAGIC = 0x77A8'98FF;
1274+
class SimpleWebTransferResponseResultOk final {
1275+
static constexpr uint32_t SIMPLE_WEB_TRANSFER_RESPONSE_RESULT_OK_MAGIC = 0x77A8'98FF;
12761276

12771277
public:
12781278
bool fetch(tl::fetcher& tlf) noexcept {
12791279
tl::magic magic{};
1280-
bool ok{magic.fetch(tlf) && magic.expect(SIMPLE_WEB_TRANSFER_PERFORM_RESULT_OK_MAGIC)};
1280+
bool ok{magic.fetch(tlf) && magic.expect(SIMPLE_WEB_TRANSFER_RESPONSE_RESULT_OK_MAGIC)};
12811281
return ok;
12821282
}
12831283

12841284
constexpr size_t footprint() const noexcept {
1285-
return tl::magic{.value = SIMPLE_WEB_TRANSFER_PERFORM_RESULT_OK_MAGIC}.footprint();
1285+
return tl::magic{.value = SIMPLE_WEB_TRANSFER_RESPONSE_RESULT_OK_MAGIC}.footprint();
12861286
}
12871287
};
12881288

@@ -1413,16 +1413,16 @@ class CompositeWebTransferWaitUpdatesResultOk final {
14131413
static constexpr uint32_t COMPOSITE_WEB_TRANSFER_WAIT_UPDATES_RESULT_OK_MAGIC = 0x2007'1997;
14141414

14151415
public:
1416-
tl::u64 awaiters_num;
1416+
tl::u64 updated_descriptors_num;
14171417

14181418
bool fetch(tl::fetcher& tlf) noexcept {
14191419
tl::magic magic{};
1420-
bool ok{magic.fetch(tlf) && magic.expect(COMPOSITE_WEB_TRANSFER_WAIT_UPDATES_RESULT_OK_MAGIC) && awaiters_num.fetch(tlf)};
1420+
bool ok{magic.fetch(tlf) && magic.expect(COMPOSITE_WEB_TRANSFER_WAIT_UPDATES_RESULT_OK_MAGIC) && updated_descriptors_num.fetch(tlf)};
14211421
return ok;
14221422
}
14231423

14241424
constexpr size_t footprint() const noexcept {
1425-
return tl::magic{.value = COMPOSITE_WEB_TRANSFER_WAIT_UPDATES_RESULT_OK_MAGIC}.footprint() && awaiters_num.footprint();
1425+
return tl::magic{.value = COMPOSITE_WEB_TRANSFER_WAIT_UPDATES_RESULT_OK_MAGIC}.footprint() && updated_descriptors_num.footprint();
14261426
}
14271427
};
14281428

0 commit comments

Comments
 (0)