diff options
| author | Alexander Smirnov <[email protected]> | 2024-09-11 06:01:46 +0000 |
|---|---|---|
| committer | Alexander Smirnov <[email protected]> | 2024-09-11 06:01:46 +0000 |
| commit | e9872cecdd762b5c182e454d179a2b82efaa668e (patch) | |
| tree | 241fc78a31833278a40f02ef1eb2855cf89f1130 /library/cpp | |
| parent | a8fb87e9659374402d5c50524b7be8e4b4c8944f (diff) | |
| parent | 4b4aec2e3e4cf5409f9874f6cad0bb8d2d7482e8 (diff) | |
Merge branch 'rightlib' into mergelibs-240911-0600
Diffstat (limited to 'library/cpp')
| -rw-r--r-- | library/cpp/protobuf/json/json2proto.cpp | 10 | ||||
| -rw-r--r-- | library/cpp/tld/tlds-alpha-by-domain.txt | 2 | ||||
| -rw-r--r-- | library/cpp/yt/memory/allocation_tags.h | 16 | ||||
| -rw-r--r-- | library/cpp/yt/memory/allocation_tags_hooks.cpp | 27 | ||||
| -rw-r--r-- | library/cpp/yt/memory/allocation_tags_hooks.h | 23 | ||||
| -rw-r--r-- | library/cpp/yt/memory/ya.make | 1 | ||||
| -rw-r--r-- | library/cpp/yt/small_containers/compact_vector.h | 2 |
7 files changed, 78 insertions, 3 deletions
diff --git a/library/cpp/protobuf/json/json2proto.cpp b/library/cpp/protobuf/json/json2proto.cpp index f0ca3adf42e..823c471b967 100644 --- a/library/cpp/protobuf/json/json2proto.cpp +++ b/library/cpp/protobuf/json/json2proto.cpp @@ -85,7 +85,15 @@ static void JsonString2Duration(const NJson::TJsonValue& json, const google::protobuf::FieldDescriptor& field, const NProtobufJson::TJson2ProtoConfig& config) { using namespace google::protobuf; - if (!json.GetString() && !config.CastRobust) { + if (json.IsMap()) { + const auto& m = json.GetMap(); + Duration duration; + duration.set_seconds(m.contains("Seconds") ? m.at("Seconds").GetInteger() : 0); + duration.set_nanos(m.contains("Nanos") ? m.at("Nanos").GetInteger() : 0); + proto.CopyFrom(duration); + + return; + } else if (!json.GetString() && !config.CastRobust) { ythrow yexception() << "Invalid type of JSON field '" << field.name() << "': " << "IsString() failed while " << "CPPTYPE_STRING is expected."; diff --git a/library/cpp/tld/tlds-alpha-by-domain.txt b/library/cpp/tld/tlds-alpha-by-domain.txt index fd7b650f85c..227d1d26722 100644 --- a/library/cpp/tld/tlds-alpha-by-domain.txt +++ b/library/cpp/tld/tlds-alpha-by-domain.txt @@ -1,4 +1,4 @@ -# Version 2024090400, Last Updated Wed Sep 4 07:07:01 2024 UTC +# Version 2024090700, Last Updated Sat Sep 7 07:07:02 2024 UTC AAA AARP ABB diff --git a/library/cpp/yt/memory/allocation_tags.h b/library/cpp/yt/memory/allocation_tags.h new file mode 100644 index 00000000000..5bd0f415c60 --- /dev/null +++ b/library/cpp/yt/memory/allocation_tags.h @@ -0,0 +1,16 @@ +#pragma once + +#include <string> +#include <utility> + +namespace NYT { + +//////////////////////////////////////////////////////////////////////////////// + +using TAllocationTagKey = std::string; +using TAllocationTagValue = std::string; +using TAllocationTag = std::pair<TAllocationTagKey, TAllocationTagValue>; + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT diff --git a/library/cpp/yt/memory/allocation_tags_hooks.cpp b/library/cpp/yt/memory/allocation_tags_hooks.cpp new file mode 100644 index 00000000000..dc6d531f3e8 --- /dev/null +++ b/library/cpp/yt/memory/allocation_tags_hooks.cpp @@ -0,0 +1,27 @@ +#include "allocation_tags_hooks.h" + +namespace NYT { + +//////////////////////////////////////////////////////////////////////////////// + +Y_WEAK const TAllocationTagsHooks& GetAllocationTagsHooks() +{ + static const TAllocationTagsHooks hooks{ + .CreateAllocationTags = [] () -> void* { + return nullptr; + }, + .CopyAllocationTags = [] (void* /*opaque*/) -> void* { + return nullptr; + }, + .DestroyAllocationTags = [] (void* /*opaque*/) { + }, + .ReadAllocationTags = [] (void* /*opaque*/) -> TRange<TAllocationTag> { + return {}; + }, + }; + return hooks; +} + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT diff --git a/library/cpp/yt/memory/allocation_tags_hooks.h b/library/cpp/yt/memory/allocation_tags_hooks.h new file mode 100644 index 00000000000..57673f68b0a --- /dev/null +++ b/library/cpp/yt/memory/allocation_tags_hooks.h @@ -0,0 +1,23 @@ +#pragma once + +#include "allocation_tags.h" + +#include <library/cpp/yt/memory/range.h> + +namespace NYT { + +//////////////////////////////////////////////////////////////////////////////// + +struct TAllocationTagsHooks +{ + void* (*CreateAllocationTags)(); + void* (*CopyAllocationTags)(void* opaque); + void (*DestroyAllocationTags)(void* opaque); + TRange<TAllocationTag> (*ReadAllocationTags)(void* opaque); +}; + +const TAllocationTagsHooks& GetAllocationTagsHooks(); + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT diff --git a/library/cpp/yt/memory/ya.make b/library/cpp/yt/memory/ya.make index 9dc43727291..c2d78b0d079 100644 --- a/library/cpp/yt/memory/ya.make +++ b/library/cpp/yt/memory/ya.make @@ -3,6 +3,7 @@ LIBRARY() INCLUDE(${ARCADIA_ROOT}/library/cpp/yt/ya_cpp.make.inc) SRCS( + allocation_tags_hooks.cpp blob.cpp chunked_input_stream.cpp chunked_memory_allocator.cpp diff --git a/library/cpp/yt/small_containers/compact_vector.h b/library/cpp/yt/small_containers/compact_vector.h index 23a0ac3fd01..07fd9f89244 100644 --- a/library/cpp/yt/small_containers/compact_vector.h +++ b/library/cpp/yt/small_containers/compact_vector.h @@ -69,7 +69,7 @@ public: TCompactVector(TIterator first, TIterator last); TCompactVector(std::initializer_list<T> list); - ~TCompactVector(); + ~TCompactVector(); [[nodiscard]] bool empty() const; |
