From 2c116732464ec51b7e82a47559ba599385e94fbf Mon Sep 17 00:00:00 2001 From: "Raphael S. Carvalho" <raphaelsc@scylladb.com> Date: Fri, 8 Apr 2022 10:35:54 -0300 Subject: [PATCH] utils/chunked_managed_vector: expose max_chunk_capacity() That's useful for tests which want to verify correctness when the vector is performing operations across the chunk boundary. Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com> Message-Id: <20220408133555.12397-1-raphaelsc@scylladb.com> --- utils/lsa/chunked_managed_vector.hh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/lsa/chunked_managed_vector.hh b/utils/lsa/chunked_managed_vector.hh index cbf83eef7915..9f1082f8d93f 100644 --- a/utils/lsa/chunked_managed_vector.hh +++ b/utils/lsa/chunked_managed_vector.hh @@ -37,10 +37,11 @@ class chunked_managed_vector { managed_vector<chunk_ptr, 1> _chunks; size_t _size = 0; size_t _capacity = 0; -private: +public: static size_t max_chunk_capacity() { return std::max(max_contiguous_allocation / sizeof(T), size_t(1)); } +private: void reserve_for_push_back() { if (_size == _capacity) { do_reserve_for_push_back();