Skip to content

Commit 0bb1456

Browse files
authored
[k2] move tl::mask out of *Extra TL types (#1521)
1 parent 04de6cc commit 0bb1456

File tree

7 files changed

+93
-85
lines changed

7 files changed

+93
-85
lines changed

common/tl/constants/common.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ namespace vk {
4545
namespace tl {
4646
namespace common {
4747

48-
namespace tracing::traceContext {
49-
static constexpr uint32_t return_reserved_status_0 = 1 << 0;
50-
static constexpr uint32_t return_reserved_status_1 = 1 << 1;
51-
static constexpr uint32_t parent_id = 1 << 2;
52-
static constexpr uint32_t source_id = 1 << 3;
53-
static constexpr uint32_t return_reserved_level_0 = 1 << 4;
54-
static constexpr uint32_t return_reserved_level_1 = 1 << 5;
55-
static constexpr uint32_t return_reserved_level_2 = 1 << 6;
56-
static constexpr uint32_t return_debug = 1 << 7;
57-
} // namespace tracing::traceContext
48+
namespace tracing::trace_context_flags {
49+
inline constexpr uint32_t reserved_status_0 = 1U << 0U;
50+
inline constexpr uint32_t reserved_status_1 = 1U << 1U;
51+
inline constexpr uint32_t parent_id = 1U << 2U;
52+
inline constexpr uint32_t source_id = 1U << 3U;
53+
inline constexpr uint32_t reserved_level_0 = 1U << 4U;
54+
inline constexpr uint32_t reserved_level_1 = 1U << 5U;
55+
inline constexpr uint32_t reserved_level_2 = 1U << 6U;
56+
inline constexpr uint32_t debug = 1U << 7U;
57+
} // namespace tracing::trace_context_flags
5858

5959
namespace rpc_invoke_req_extra_flags {
6060
inline constexpr uint32_t return_binlog_pos = 1U << 0U;

common/tl/tl-types.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@ struct traceID final {
126126
};
127127

128128
class traceContext final {
129-
static constexpr uint32_t RETURN_RESERVED_STATUS_0_FLAG = vk::tl::common::tracing::traceContext::return_reserved_status_0;
130-
static constexpr uint32_t RETURN_RESERVED_STATUS_1_FLAG = vk::tl::common::tracing::traceContext::return_reserved_status_1;
131-
static constexpr uint32_t PARENT_ID_FLAG = vk::tl::common::tracing::traceContext::parent_id;
132-
static constexpr uint32_t SOURCE_ID_FLAG = vk::tl::common::tracing::traceContext::source_id;
133-
static constexpr uint32_t RETURN_RESERVED_LEVEL_0_FLAG = vk::tl::common::tracing::traceContext::return_reserved_level_0;
134-
static constexpr uint32_t RETURN_RESERVED_LEVEL_1_FLAG = vk::tl::common::tracing::traceContext::return_reserved_level_1;
135-
static constexpr uint32_t RETURN_RESERVED_LEVEL_2_FLAG = vk::tl::common::tracing::traceContext::return_reserved_level_2;
136-
static constexpr uint32_t RETURN_DEBUG_FLAG = vk::tl::common::tracing::traceContext::return_debug;
129+
static constexpr uint32_t RESERVED_STATUS_0_FLAG = vk::tl::common::tracing::trace_context_flags::reserved_status_0;
130+
static constexpr uint32_t RESERVED_STATUS_1_FLAG = vk::tl::common::tracing::trace_context_flags::reserved_status_1;
131+
static constexpr uint32_t PARENT_ID_FLAG = vk::tl::common::tracing::trace_context_flags::parent_id;
132+
static constexpr uint32_t SOURCE_ID_FLAG = vk::tl::common::tracing::trace_context_flags::source_id;
133+
static constexpr uint32_t RESERVED_LEVEL_0_FLAG = vk::tl::common::tracing::trace_context_flags::reserved_level_0;
134+
static constexpr uint32_t RESERVED_LEVEL_1_FLAG = vk::tl::common::tracing::trace_context_flags::reserved_level_1;
135+
static constexpr uint32_t RESERVED_LEVEL_2_FLAG = vk::tl::common::tracing::trace_context_flags::reserved_level_2;
136+
static constexpr uint32_t DEBUG_FLAG = vk::tl::common::tracing::trace_context_flags::debug;
137137

138138
public:
139139
tracing::traceID trace_id{};
@@ -169,12 +169,12 @@ class traceContext final {
169169
ok = ok && !tl_fetch_error();
170170
}
171171

172-
reserved_status_0 = static_cast<bool>(fields_mask & RETURN_RESERVED_STATUS_0_FLAG);
173-
reserved_status_1 = static_cast<bool>(fields_mask & RETURN_RESERVED_STATUS_1_FLAG);
174-
reserved_level_0 = static_cast<bool>(fields_mask & RETURN_RESERVED_LEVEL_0_FLAG);
175-
reserved_level_1 = static_cast<bool>(fields_mask & RETURN_RESERVED_LEVEL_1_FLAG);
176-
reserved_level_2 = static_cast<bool>(fields_mask & RETURN_RESERVED_LEVEL_2_FLAG);
177-
debug_flag = static_cast<bool>(fields_mask & RETURN_DEBUG_FLAG);
172+
reserved_status_0 = static_cast<bool>(fields_mask & RESERVED_STATUS_0_FLAG);
173+
reserved_status_1 = static_cast<bool>(fields_mask & RESERVED_STATUS_1_FLAG);
174+
reserved_level_0 = static_cast<bool>(fields_mask & RESERVED_LEVEL_0_FLAG);
175+
reserved_level_1 = static_cast<bool>(fields_mask & RESERVED_LEVEL_1_FLAG);
176+
reserved_level_2 = static_cast<bool>(fields_mask & RESERVED_LEVEL_2_FLAG);
177+
debug_flag = static_cast<bool>(fields_mask & DEBUG_FLAG);
178178

179179
return ok;
180180
}

runtime-light/server/rpc/init-functions.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <algorithm>
88
#include <cstddef>
99
#include <cstdint>
10+
#include <optional>
1011
#include <string_view>
1112
#include <type_traits>
1213
#include <utility>
@@ -17,6 +18,7 @@
1718
#include "runtime-common/core/std/containers.h"
1819
#include "runtime-light/core/globals/php-script-globals.h"
1920
#include "runtime-light/server/rpc/rpc-server-state.h"
21+
#include "runtime-light/stdlib/diagnostics/logs.h"
2022
#include "runtime-light/streams/stream.h"
2123
#include "runtime-light/tl/tl-core.h"
2224
#include "runtime-light/tl/tl-functions.h"
@@ -209,8 +211,11 @@ void init_server(kphp::component::stream&& request_stream, kphp::stl::vector<std
209211
if (invoke_rpc.opt_actor_id) {
210212
superglobals.v$_SERVER.set_value(string{RPC_ACTOR_ID.data(), RPC_ACTOR_ID.size()}, (*invoke_rpc.opt_actor_id).value);
211213
}
214+
215+
const std::optional<tl::mask> opt_extra_fields_mask{invoke_rpc.opt_extra.transform([](const auto& extra) noexcept { return extra.get_flags(); })};
212216
if (invoke_rpc.opt_extra) {
213-
superglobals.v$_SERVER.set_value(string{RPC_EXTRA_FLAGS.data(), RPC_EXTRA_FLAGS.size()}, static_cast<int64_t>((*invoke_rpc.opt_extra).get_flags().value));
217+
kphp::log::assertion(opt_extra_fields_mask.has_value());
218+
superglobals.v$_SERVER.set_value(string{RPC_EXTRA_FLAGS.data(), RPC_EXTRA_FLAGS.size()}, static_cast<int64_t>((*opt_extra_fields_mask).value));
214219
process_rpc_invoke_req_extra(*invoke_rpc.opt_extra, superglobals);
215220
}
216221
kphp::log::info("rpc server initialized with: "
@@ -222,7 +227,7 @@ void init_server(kphp::component::stream&& request_stream, kphp::stl::vector<std
222227
"request -> {:#x}",
223228
invoke_rpc.net_pid.get_pid(), invoke_rpc.net_pid.get_port(), invoke_rpc.query_id.value,
224229
invoke_rpc.opt_actor_id.has_value() ? (*invoke_rpc.opt_actor_id).value : 0,
225-
invoke_rpc.opt_extra.has_value() ? (*invoke_rpc.opt_extra).get_flags().value : 0, request_magic.value);
230+
opt_extra_fields_mask.has_value() ? (*opt_extra_fields_mask).value : 0, request_magic.value);
226231
}
227232

228233
} // namespace kphp::rpc

runtime-light/stdlib/rpc/rpc-api.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ inline kphp::coro::task<> f$rpc_server_store_response(class_instance<C$VK$TL$Rpc
269269
// as we are in a coroutine, we must own the data to prevent it from being overwritten by another coroutine,
270270
// so create a TLBuffer owned by this coroutine
271271
auto& rpc_server_instance_st{RpcServerInstanceState::get()};
272-
tl::K2RpcResponse rpc_response{.value = tl::k2RpcResponseHeader{.flags = {}, .extra = {}, .result = rpc_server_instance_st.tl_storer.view()}};
272+
tl::K2RpcResponse rpc_response{.value =
273+
tl::k2RpcResponseHeader{.flags = {}, .extra_flags = {}, .extra = {}, .result = rpc_server_instance_st.tl_storer.view()}};
273274
tl::storer tls{rpc_response.footprint()};
274275
rpc_response.store(tls);
275276

runtime-light/tl/tl-functions.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ class K2InvokeRpc final {
304304
static constexpr auto EXTRA_FLAG = static_cast<uint32_t>(1U << 1U);
305305

306306
public:
307-
tl::mask flags{};
308307
tl::i64 query_id{};
309308
tl::netPid net_pid{};
310309
std::optional<tl::i64> opt_actor_id;
@@ -314,14 +313,18 @@ class K2InvokeRpc final {
314313
bool fetch(tl::fetcher& tlf) noexcept {
315314
tl::magic magic{};
316315
bool ok{magic.fetch(tlf) && magic.expect(K2_INVOKE_RPC_MAGIC)};
317-
ok = ok && flags.fetch(tlf);
316+
317+
tl::mask fields_mask{};
318+
ok = ok && fields_mask.fetch(tlf);
318319
ok = ok && query_id.fetch(tlf);
319320
ok = ok && net_pid.fetch(tlf);
320-
if (static_cast<bool>(flags.value & ACTOR_ID_FLAG)) {
321+
if (static_cast<bool>(fields_mask.value & ACTOR_ID_FLAG)) {
321322
ok = ok && opt_actor_id.emplace().fetch(tlf);
322323
}
323-
if (static_cast<bool>(flags.value & EXTRA_FLAG)) {
324-
ok = ok && opt_extra.emplace().fetch(tlf);
324+
if (static_cast<bool>(fields_mask.value & EXTRA_FLAG)) {
325+
tl::mask extra_fields_mask{};
326+
ok = ok && extra_fields_mask.fetch(tlf);
327+
ok = ok && opt_extra.emplace().fetch(tlf, extra_fields_mask);
325328
}
326329
const auto opt_query{tlf.fetch_bytes(tlf.remaining())};
327330
query = opt_query.value_or(std::span<const std::byte>{});

runtime-light/tl/tl-types.cpp

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,8 @@ bool CertInfoItem::fetch(tl::fetcher& tlf) noexcept {
146146

147147
// ===== RPC =====
148148

149-
bool rpcInvokeReqExtra::fetch(tl::fetcher& tlf) noexcept {
150-
tl::mask flags{};
151-
bool ok{flags.fetch(tlf)};
149+
bool rpcInvokeReqExtra::fetch(tl::fetcher& tlf, const tl::mask& flags) noexcept {
150+
bool ok{true};
152151
if (ok && static_cast<bool>(flags.value & WAIT_BINLOG_POS_FLAG)) {
153152
ok &= opt_wait_binlog_pos.emplace().fetch(tlf);
154153
}
@@ -197,30 +196,29 @@ bool rpcInvokeReqExtra::fetch(tl::fetcher& tlf) noexcept {
197196
tl::mask rpcInvokeReqExtra::get_flags() const noexcept {
198197
tl::mask flags{.value = static_cast<tl::mask::underlying_type>(return_binlog_pos)};
199198

200-
flags.value |= static_cast<tl::mask::underlying_type>(return_binlog_time) << 1;
201-
flags.value |= static_cast<tl::mask::underlying_type>(return_pid) << 2;
202-
flags.value |= static_cast<tl::mask::underlying_type>(return_request_sizes) << 3;
203-
flags.value |= static_cast<tl::mask::underlying_type>(return_failed_subqueries) << 4;
204-
flags.value |= static_cast<tl::mask::underlying_type>(return_query_stats) << 6;
205-
flags.value |= static_cast<tl::mask::underlying_type>(no_result) << 7;
206-
flags.value |= static_cast<tl::mask::underlying_type>(return_view_number) << 27;
207-
208-
flags.value |= static_cast<tl::mask::underlying_type>(opt_wait_binlog_pos.has_value()) << 16;
209-
flags.value |= static_cast<tl::mask::underlying_type>(opt_string_forward_keys.has_value()) << 18;
210-
flags.value |= static_cast<tl::mask::underlying_type>(opt_int_forward_keys.has_value()) << 19;
211-
flags.value |= static_cast<tl::mask::underlying_type>(opt_string_forward.has_value()) << 20;
212-
flags.value |= static_cast<tl::mask::underlying_type>(opt_int_forward.has_value()) << 21;
213-
flags.value |= static_cast<tl::mask::underlying_type>(opt_custom_timeout_ms.has_value()) << 23;
214-
flags.value |= static_cast<tl::mask::underlying_type>(opt_supported_compression_version.has_value()) << 25;
215-
flags.value |= static_cast<tl::mask::underlying_type>(opt_random_delay.has_value()) << 26;
216-
flags.value |= static_cast<tl::mask::underlying_type>(opt_persistent_query.has_value()) << 28;
217-
flags.value |= static_cast<tl::mask::underlying_type>(opt_trace_context.has_value()) << 29;
218-
flags.value |= static_cast<tl::mask::underlying_type>(opt_execution_context.has_value()) << 30;
199+
flags.value |= static_cast<tl::mask::underlying_type>(return_binlog_time) << 1U;
200+
flags.value |= static_cast<tl::mask::underlying_type>(return_pid) << 2U;
201+
flags.value |= static_cast<tl::mask::underlying_type>(return_request_sizes) << 3U;
202+
flags.value |= static_cast<tl::mask::underlying_type>(return_failed_subqueries) << 4U;
203+
flags.value |= static_cast<tl::mask::underlying_type>(return_query_stats) << 6U;
204+
flags.value |= static_cast<tl::mask::underlying_type>(no_result) << 7U;
205+
flags.value |= static_cast<tl::mask::underlying_type>(return_view_number) << 27U;
206+
207+
flags.value |= static_cast<tl::mask::underlying_type>(opt_wait_binlog_pos.has_value()) << 16U;
208+
flags.value |= static_cast<tl::mask::underlying_type>(opt_string_forward_keys.has_value()) << 18U;
209+
flags.value |= static_cast<tl::mask::underlying_type>(opt_int_forward_keys.has_value()) << 19U;
210+
flags.value |= static_cast<tl::mask::underlying_type>(opt_string_forward.has_value()) << 20U;
211+
flags.value |= static_cast<tl::mask::underlying_type>(opt_int_forward.has_value()) << 21U;
212+
flags.value |= static_cast<tl::mask::underlying_type>(opt_custom_timeout_ms.has_value()) << 23U;
213+
flags.value |= static_cast<tl::mask::underlying_type>(opt_supported_compression_version.has_value()) << 25U;
214+
flags.value |= static_cast<tl::mask::underlying_type>(opt_random_delay.has_value()) << 26U;
215+
flags.value |= static_cast<tl::mask::underlying_type>(opt_persistent_query.has_value()) << 28U;
216+
flags.value |= static_cast<tl::mask::underlying_type>(opt_trace_context.has_value()) << 29U;
217+
flags.value |= static_cast<tl::mask::underlying_type>(opt_execution_context.has_value()) << 30U;
219218
return flags;
220219
}
221220

222-
void rpcReqResultExtra::store(tl::storer& tls) const noexcept {
223-
flags.store(tls);
221+
void rpcReqResultExtra::store(tl::storer& tls, const tl::mask& flags) const noexcept {
224222
if (static_cast<bool>(flags.value & BINLOG_POS_FLAG)) {
225223
binlog_pos.store(tls);
226224
}
@@ -249,8 +247,8 @@ void rpcReqResultExtra::store(tl::storer& tls) const noexcept {
249247
}
250248
}
251249

252-
size_t rpcReqResultExtra::footprint() const noexcept {
253-
size_t footprint{flags.footprint()};
250+
size_t rpcReqResultExtra::footprint(const tl::mask& flags) const noexcept {
251+
size_t footprint{};
254252
if (static_cast<bool>(flags.value & BINLOG_POS_FLAG)) {
255253
footprint += binlog_pos.footprint();
256254
}

runtime-light/tl/tl-types.h

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,14 +1008,14 @@ struct traceID final {
10081008
};
10091009

10101010
class traceContext final {
1011-
static constexpr uint32_t RETURN_RESERVED_STATUS_0_FLAG = vk::tl::common::tracing::traceContext::return_reserved_status_0;
1012-
static constexpr uint32_t RETURN_RESERVED_STATUS_1_FLAG = vk::tl::common::tracing::traceContext::return_reserved_status_1;
1013-
static constexpr uint32_t PARENT_ID_FLAG = vk::tl::common::tracing::traceContext::parent_id;
1014-
static constexpr uint32_t SOURCE_ID_FLAG = vk::tl::common::tracing::traceContext::source_id;
1015-
static constexpr uint32_t RETURN_RESERVED_LEVEL_0_FLAG = vk::tl::common::tracing::traceContext::return_reserved_level_0;
1016-
static constexpr uint32_t RETURN_RESERVED_LEVEL_1_FLAG = vk::tl::common::tracing::traceContext::return_reserved_level_1;
1017-
static constexpr uint32_t RETURN_RESERVED_LEVEL_2_FLAG = vk::tl::common::tracing::traceContext::return_reserved_level_2;
1018-
static constexpr uint32_t RETURN_DEBUG_FLAG = vk::tl::common::tracing::traceContext::return_debug;
1011+
static constexpr uint32_t RESERVED_STATUS_0_FLAG = vk::tl::common::tracing::trace_context_flags::reserved_status_0;
1012+
static constexpr uint32_t RESERVED_STATUS_1_FLAG = vk::tl::common::tracing::trace_context_flags::reserved_status_1;
1013+
static constexpr uint32_t PARENT_ID_FLAG = vk::tl::common::tracing::trace_context_flags::parent_id;
1014+
static constexpr uint32_t SOURCE_ID_FLAG = vk::tl::common::tracing::trace_context_flags::source_id;
1015+
static constexpr uint32_t RESERVED_LEVEL_0_FLAG = vk::tl::common::tracing::trace_context_flags::reserved_level_0;
1016+
static constexpr uint32_t RESERVED_LEVEL_1_FLAG = vk::tl::common::tracing::trace_context_flags::reserved_level_1;
1017+
static constexpr uint32_t RESERVED_LEVEL_2_FLAG = vk::tl::common::tracing::trace_context_flags::reserved_level_2;
1018+
static constexpr uint32_t DEBUG_FLAG = vk::tl::common::tracing::trace_context_flags::debug;
10191019

10201020
public:
10211021
tl::tracing::traceID trace_id{};
@@ -1036,23 +1036,23 @@ class traceContext final {
10361036
bool debug_flag{};
10371037

10381038
bool fetch(tl::fetcher& tlf) noexcept {
1039-
tl::u32 fields_mask{};
1039+
tl::mask fields_mask{};
10401040
bool ok{fields_mask.fetch(tlf)};
10411041

10421042
ok = ok && trace_id.fetch(tlf);
10431043
if (ok && static_cast<bool>(fields_mask.value & PARENT_ID_FLAG)) {
1044-
ok = ok && opt_parent_id.emplace().fetch(tlf);
1044+
ok &= opt_parent_id.emplace().fetch(tlf);
10451045
}
10461046
if (ok && static_cast<bool>(fields_mask.value & SOURCE_ID_FLAG)) {
1047-
ok = ok && opt_source_id.emplace().fetch(tlf);
1047+
ok &= opt_source_id.emplace().fetch(tlf);
10481048
}
10491049

1050-
reserved_status_0 = static_cast<bool>(fields_mask.value & RETURN_RESERVED_STATUS_0_FLAG);
1051-
reserved_status_1 = static_cast<bool>(fields_mask.value & RETURN_RESERVED_STATUS_1_FLAG);
1052-
reserved_level_0 = static_cast<bool>(fields_mask.value & RETURN_RESERVED_LEVEL_0_FLAG);
1053-
reserved_level_1 = static_cast<bool>(fields_mask.value & RETURN_RESERVED_LEVEL_1_FLAG);
1054-
reserved_level_2 = static_cast<bool>(fields_mask.value & RETURN_RESERVED_LEVEL_2_FLAG);
1055-
debug_flag = static_cast<bool>(fields_mask.value & RETURN_DEBUG_FLAG);
1050+
reserved_status_0 = static_cast<bool>(fields_mask.value & RESERVED_STATUS_0_FLAG);
1051+
reserved_status_1 = static_cast<bool>(fields_mask.value & RESERVED_STATUS_1_FLAG);
1052+
reserved_level_0 = static_cast<bool>(fields_mask.value & RESERVED_LEVEL_0_FLAG);
1053+
reserved_level_1 = static_cast<bool>(fields_mask.value & RESERVED_LEVEL_1_FLAG);
1054+
reserved_level_2 = static_cast<bool>(fields_mask.value & RESERVED_LEVEL_2_FLAG);
1055+
debug_flag = static_cast<bool>(fields_mask.value & DEBUG_FLAG);
10561056

10571057
return ok;
10581058
}
@@ -1070,6 +1070,7 @@ class traceContext final {
10701070
return flags;
10711071
}
10721072
};
1073+
10731074
} // namespace tracing
10741075

10751076
class rpcInvokeReqExtra final {
@@ -1114,17 +1115,17 @@ class rpcInvokeReqExtra final {
11141115
std::optional<tl::string> opt_execution_context;
11151116
bool return_view_number{};
11161117

1117-
bool fetch(tl::fetcher& tlf) noexcept;
1118+
bool fetch(tl::fetcher& tlf, const tl::mask& flags) noexcept;
11181119

11191120
tl::mask get_flags() const noexcept;
11201121
};
11211122

11221123
struct RpcInvokeReqExtra final {
11231124
tl::rpcInvokeReqExtra inner{};
11241125

1125-
bool fetch(tl::fetcher& tlf) noexcept {
1126+
bool fetch(tl::fetcher& tlf, const tl::mask& flags) noexcept {
11261127
tl::magic magic{};
1127-
return magic.fetch(tlf) && magic.expect(TL_RPC_INVOKE_REQ_EXTRA) && inner.fetch(tlf);
1128+
return magic.fetch(tlf) && magic.expect(TL_RPC_INVOKE_REQ_EXTRA) && inner.fetch(tlf, flags);
11281129
}
11291130
};
11301131

@@ -1141,7 +1142,6 @@ class rpcReqResultExtra final {
11411142
static constexpr uint32_t VIEW_NUMBER_FLAG = vk::tl::common::rpc_req_result_extra_flags::view_number;
11421143

11431144
public:
1144-
tl::mask flags{};
11451145
tl::i64 binlog_pos{};
11461146
tl::i64 binlog_time{};
11471147
tl::netPid engine_pid{};
@@ -1153,16 +1153,16 @@ class rpcReqResultExtra final {
11531153
tl::i64 epoch_number{};
11541154
tl::i64 view_number{};
11551155

1156-
void store(tl::storer& tls) const noexcept;
1156+
void store(tl::storer& tls, const tl::mask& flags) const noexcept;
11571157

1158-
size_t footprint() const noexcept;
1158+
size_t footprint(const tl::mask& flags) const noexcept;
11591159
};
11601160

11611161
struct RpcReqResultExtra final {
11621162
tl::rpcReqResultExtra inner{};
11631163

1164-
void store(tl::storer& tls) const noexcept {
1165-
tl::magic{.value = TL_RPC_REQ_RESULT_EXTRA}.store(tls), inner.store(tls);
1164+
void store(tl::storer& tls, const tl::mask& flags) const noexcept {
1165+
tl::magic{.value = TL_RPC_REQ_RESULT_EXTRA}.store(tls), inner.store(tls, flags);
11661166
}
11671167
};
11681168

@@ -1181,15 +1181,16 @@ struct k2RpcResponseError final {
11811181

11821182
struct k2RpcResponseHeader final {
11831183
tl::mask flags{};
1184+
tl::mask extra_flags{};
11841185
tl::rpcReqResultExtra extra{};
11851186
std::span<const std::byte> result;
11861187

11871188
void store(tl::storer& tls) const noexcept {
1188-
flags.store(tls), extra.store(tls), tls.store_bytes(result);
1189+
flags.store(tls), extra_flags.store(tls), extra.store(tls, extra_flags), tls.store_bytes(result);
11891190
}
11901191

11911192
constexpr size_t footprint() const noexcept {
1192-
return flags.footprint() + extra.footprint() + result.size();
1193+
return flags.footprint() + extra_flags.footprint() + extra.footprint(extra_flags) + result.size();
11931194
}
11941195
};
11951196

0 commit comments

Comments
 (0)