diff options
author | babenko <babenko@yandex-team.com> | 2022-08-07 17:29:43 +0300 |
---|---|---|
committer | babenko <babenko@yandex-team.com> | 2022-08-07 17:29:43 +0300 |
commit | e3b2f4c99d645adbb0956e98dd7d38bc01b7db29 (patch) | |
tree | 00fcb67e7026e42d4af185a268606e3f5ba95829 /library/cpp/yt/memory/ref.h | |
parent | ccc7c68ba2a051861c8d517c87f293368e0b7c7b (diff) | |
download | ydb-e3b2f4c99d645adbb0956e98dd7d38bc01b7db29.tar.gz |
Introduce TSharedMutableRefAllocateOptions
Diffstat (limited to 'library/cpp/yt/memory/ref.h')
-rw-r--r-- | library/cpp/yt/memory/ref.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/library/cpp/yt/memory/ref.h b/library/cpp/yt/memory/ref.h index 73d19d9013..2003ba0c0d 100644 --- a/library/cpp/yt/memory/ref.h +++ b/library/cpp/yt/memory/ref.h @@ -166,6 +166,12 @@ private: //////////////////////////////////////////////////////////////////////////////// +//! Various options for allocating TSharedMutableRef. +struct TSharedMutableRefAllocateOptions +{ + bool InitializeStorage = true; +}; + //! A reference to a mutable range of memory with shared ownership. //! Use with caution :) class TSharedMutableRef @@ -200,31 +206,31 @@ public: //! Allocates a new shared block of memory. //! The memory is marked with a given tag. template <class TTag> - static TSharedMutableRef Allocate(size_t size, bool initializeStorage = true); + static TSharedMutableRef Allocate(size_t size, TSharedMutableRefAllocateOptions options = {}); //! Allocates a new shared block of memory. //! The memory is marked with TDefaultSharedBlobTag. - static TSharedMutableRef Allocate(size_t size, bool initializeStorage = true); + static TSharedMutableRef Allocate(size_t size, TSharedMutableRefAllocateOptions options = {}); //! Allocates a new shared block of memory. //! The memory is marked with a given tag. - static TSharedMutableRef Allocate(size_t size, bool initializeStorage, TRefCountedTypeCookie tagCookie); + static TSharedMutableRef Allocate(size_t size, TSharedMutableRefAllocateOptions options, TRefCountedTypeCookie tagCookie); //! Allocates a new page aligned shared block of memory. //! #size must be divisible by page size. //! The memory is marked with a given tag. template <class TTag> - static TSharedMutableRef AllocatePageAligned(size_t size, bool initializeStorage = true); + static TSharedMutableRef AllocatePageAligned(size_t size, TSharedMutableRefAllocateOptions options = {}); //! Allocates a new page aligned shared block of memory. //! #size must be divisible by page size. //! The memory is marked with TDefaultSharedBlobTag. - static TSharedMutableRef AllocatePageAligned(size_t size, bool initializeStorage = true); + static TSharedMutableRef AllocatePageAligned(size_t size, TSharedMutableRefAllocateOptions options = {}); //! Allocates a new page aligned shared block of memory. //! #size must be divisible by page size. //! The memory is marked with a given tag. - static TSharedMutableRef AllocatePageAligned(size_t size, bool initializeStorage, TRefCountedTypeCookie tagCookie); + static TSharedMutableRef AllocatePageAligned(size_t size, TSharedMutableRefAllocateOptions options, TRefCountedTypeCookie tagCookie); //! Creates a TSharedMutableRef for the whole blob taking ownership of its content. static TSharedMutableRef FromBlob(TBlob&& blob); |