Skip to content

Conversation

@denisichh
Copy link
Contributor

added: persistent_query, trace_context, execution_context

@denisichh denisichh marked this pull request as draft January 20, 2026 15:30
@denisichh denisichh self-assigned this Jan 20, 2026
@denisichh denisichh added runtime Feature related to runtime k2 k2 related labels Jan 20, 2026
@denisichh denisichh marked this pull request as ready for review January 20, 2026 15:42
@denisichh denisichh marked this pull request as draft January 20, 2026 16:14
@denisichh denisichh marked this pull request as ready for review January 21, 2026 16:04
@astrophysik astrophysik self-requested a review January 21, 2026 16:05
// ===== RPC =====

namespace exactlyOnce {
class Uuid final {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, check current approach for type naming in the tl namespace

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

bool fetch(tl::fetcher& tlf) noexcept {
bool ok{fields_mask.fetch(tlf)};

if (ok) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just ok = ok && trace_id.fetch()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not the case we had discussion about, but I it's to keep it as it is

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, done


array out{std::pair{underline, mixed{}},
std::pair{string{persistent_query_uuid_sv.data(), static_cast<string::size_type>(persistent_query_uuid_sv.size())}, mixed{}},
std::pair{string{persistent_slot_uuid_sv.data(), static_cast<string::size_type>(persistent_slot_uuid_sv.size())}, mixed{}}};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have an empty persistent_slot_uuid in the prepareRequest case? I think it would be more correct for it to be absent

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

constexpr std::string_view lo_sv = "lo";
constexpr std::string_view hi_sv = "hi";

const auto underline = string{"_", 1};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: include please string header

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


array out{std::pair{underline, mixed{}},
std::pair{string{persistent_query_uuid_sv.data(), static_cast<string::size_type>(persistent_query_uuid_sv.size())}, mixed{}},
std::pair{string{persistent_slot_uuid_sv.data(), static_cast<string::size_type>(persistent_slot_uuid_sv.size())}, mixed{}}};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as for runtime-light

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

constexpr std::string_view lo_sv = "lo";
constexpr std::string_view hi_sv = "hi";

const auto underline = string{"_", 1};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use braced init, please

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


const auto underline = string{"_", 1};

array out{std::pair{underline, mixed{}},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may eliminate one array lookup here. To do that, create and set the array directly in if branches

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

[&superglobals](const auto& value) noexcept {
using value_t = std::remove_cvref_t<decltype(value)>;

constexpr std::string_view exactlyOnce_prepareRequest_sv = "exactlyOnce.prepareRequest";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: no actual need for _sv suffix

extra.opt_persistent_query->request);
}
if (extra.opt_trace_context) {
const auto& trace_context{*extra.opt_trace_context};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: let's not mix -> and * operators of std::optional. Just choose one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

constexpr std::string_view debug_flag_sv = "debug_flag";

array out{
std::pair{string{"_", 1}, mixed{string{tracing_traceContext_sv.data(), static_cast<string::size_type>(tracing_traceContext_sv.size())}}},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: here you don't create a constant for underscore, but you do that above, why?

btw it's called underscore, not underline

out.set_value(string{source_id_sv.data(), static_cast<string::size_type>(source_id_sv.size())},
string{opt_source_id_value.data(), static_cast<string::size_type>(opt_source_id_value.size())});
}
if (trace_context.reserved_status_0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this won't work when you try to use out array in further RPC calls. It should not contain these flags. It only needs to contain fields mask

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

k2 k2 related runtime Feature related to runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants