8#include <userver/compiler/thread_local.hpp>
9#include <userver/utils/encoding/tskv_parser.hpp>
11USERVER_NAMESPACE_BEGIN
13namespace utils::encoding {
17struct TskvParserKvStorage {
22inline compiler::ThreadLocal tskv_parser_kv_storage = [] {
23 return TskvParserKvStorage{};
39template <
typename TagConsumer>
41 TagConsumer consumer) {
44 auto kv_storage = impl::tskv_parser_kv_storage.Use();
47 if (
const auto key_status = parser.ReadKey(kv_storage->key)) {
51 const auto value_status = parser.ReadValue(kv_storage->value);
52 if (value_status == RecordStatus::kIncomplete) {
56 const bool record_ok = consumer(std::as_const(kv_storage->key),
57 std::as_const(kv_storage->value));
58 if (value_status == RecordStatus::kReachedEnd) {