summaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authorbabenko <[email protected]>2024-09-09 18:48:41 +0300
committerbabenko <[email protected]>2024-09-09 19:02:18 +0300
commitd3e48fe4feee0750b9edd6b987e4637d4f678f29 (patch)
tree59e6c11bf3828c3683d65a4dcface6fbae8ced9c /library/cpp
parentab9b1efed10713e3420ece39a521ec5273efd375 (diff)
YT-22593: Switch (some) trace context tags to std::string and refactor code around [TRIVIAL]
643d86a500b7db9df11009f54364b468b29a409a
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/yt/memory/allocation_tags.h16
-rw-r--r--library/cpp/yt/memory/allocation_tags_hooks.cpp27
-rw-r--r--library/cpp/yt/memory/allocation_tags_hooks.h23
-rw-r--r--library/cpp/yt/memory/ya.make1
4 files changed, 67 insertions, 0 deletions
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