diff options
author | babenko <babenko@yandex-team.com> | 2023-06-06 18:53:47 +0300 |
---|---|---|
committer | babenko <babenko@yandex-team.com> | 2023-06-06 18:53:47 +0300 |
commit | f662d68f5a0c839f02969571c1fbba97c7711be4 (patch) | |
tree | 2b3139782772eac6c64732bc4935667eb34a3a8d /library/cpp/yt/memory/ref.cpp | |
parent | d0bbc6698a9beab10362d6e0ac5ad09e5497f94f (diff) | |
download | ydb-f662d68f5a0c839f02969571c1fbba97c7711be4.tar.gz |
Copy cached responses in TObjectServiceCache
Diffstat (limited to 'library/cpp/yt/memory/ref.cpp')
-rw-r--r-- | library/cpp/yt/memory/ref.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/library/cpp/yt/memory/ref.cpp b/library/cpp/yt/memory/ref.cpp index d48277f84c..31680b6c61 100644 --- a/library/cpp/yt/memory/ref.cpp +++ b/library/cpp/yt/memory/ref.cpp @@ -386,6 +386,21 @@ TString TSharedRefArray::ToString() const return result; } +TSharedRefArray TSharedRefArray::MakeCopy( + const TSharedRefArray& array, + TRefCountedTypeCookie tagCookie) +{ + TSharedRefArrayBuilder builder( + array.Size(), + array.ByteSize(), + tagCookie); + for (const auto& part : array) { + auto partCopy = builder.AllocateAndAdd(part.Size()); + ::memcpy(partCopy.Begin(), part.Begin(), part.Size()); + } + return builder.Finish(); +} + //////////////////////////////////////////////////////////////////////////////// TSharedRefArrayBuilder::TSharedRefArrayBuilder( |