aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2022-02-11 11:18:04 +0100
committerTor Egge <Tor.Egge@online.no>2022-02-11 11:28:28 +0100
commitbf1020f6c8b7e6aabba0c6859ddcc4310d090143 (patch)
treed0e24e7d745b8a60a20f6a5dd18662017d0e0f11 /vespalib
parent80c0e1b687bbe57f5fdbb501580a8cb05af47804 (diff)
Move memory allocator argument to be last argument.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/tests/datastore/array_store/array_store_test.cpp9
-rw-r--r--vespalib/src/vespa/vespalib/datastore/array_store.h4
-rw-r--r--vespalib/src/vespa/vespalib/datastore/array_store.hpp6
3 files changed, 9 insertions, 10 deletions
diff --git a/vespalib/src/tests/datastore/array_store/array_store_test.cpp b/vespalib/src/tests/datastore/array_store/array_store_test.cpp
index 7c9f0770a17..2672ed70f6d 100644
--- a/vespalib/src/tests/datastore/array_store/array_store_test.cpp
+++ b/vespalib/src/tests/datastore/array_store/array_store_test.cpp
@@ -49,16 +49,15 @@ struct Fixture
ReferenceStore refStore;
generation_t generation;
Fixture(uint32_t maxSmallArraySize, bool enable_free_lists = true)
- : store(std::make_unique<MemoryAllocatorObserver>(stats),
- ArrayStoreConfig(maxSmallArraySize,
+ : store(ArrayStoreConfig(maxSmallArraySize,
ArrayStoreConfig::AllocSpec(16, RefT::offsetSize(), 8_Ki,
- ALLOC_GROW_FACTOR)).enable_free_lists(enable_free_lists)),
+ ALLOC_GROW_FACTOR)).enable_free_lists(enable_free_lists),
+ std::make_unique<MemoryAllocatorObserver>(stats)),
refStore(),
generation(1)
{}
Fixture(const ArrayStoreConfig &storeCfg)
- : store(std::make_unique<MemoryAllocatorObserver>(stats),
- storeCfg),
+ : store(storeCfg, std::make_unique<MemoryAllocatorObserver>(stats)),
refStore(),
generation(1)
{}
diff --git a/vespalib/src/vespa/vespalib/datastore/array_store.h b/vespalib/src/vespa/vespalib/datastore/array_store.h
index c26a2a318dd..ed3af451b04 100644
--- a/vespalib/src/vespa/vespalib/datastore/array_store.h
+++ b/vespalib/src/vespa/vespalib/datastore/array_store.h
@@ -42,7 +42,7 @@ private:
LargeArrayBufferType<EntryT> _largeArrayType;
using generation_t = vespalib::GenerationHandler::generation_t;
- void initArrayTypes(std::shared_ptr<alloc::MemoryAllocator> memory_allocator, const ArrayStoreConfig &cfg);
+ void initArrayTypes(const ArrayStoreConfig &cfg, std::shared_ptr<alloc::MemoryAllocator> memory_allocator);
// 1-to-1 mapping between type ids and sizes for small arrays is enforced during initialization.
uint32_t getTypeId(size_t arraySize) const { return arraySize; }
size_t getArraySize(uint32_t typeId) const { return typeId; }
@@ -58,7 +58,7 @@ private:
}
public:
- ArrayStore(std::shared_ptr<alloc::MemoryAllocator> memory_allocator, const ArrayStoreConfig &cfg);
+ ArrayStore(const ArrayStoreConfig &cfg, std::shared_ptr<alloc::MemoryAllocator> memory_allocator);
~ArrayStore();
EntryRef add(const ConstArrayRef &array);
ConstArrayRef get(EntryRef ref) const {
diff --git a/vespalib/src/vespa/vespalib/datastore/array_store.hpp b/vespalib/src/vespa/vespalib/datastore/array_store.hpp
index d3183ac93d0..00c1615b173 100644
--- a/vespalib/src/vespa/vespalib/datastore/array_store.hpp
+++ b/vespalib/src/vespa/vespalib/datastore/array_store.hpp
@@ -15,7 +15,7 @@ namespace vespalib::datastore {
template <typename EntryT, typename RefT>
void
-ArrayStore<EntryT, RefT>::initArrayTypes(std::shared_ptr<alloc::MemoryAllocator> memory_allocator, const ArrayStoreConfig &cfg)
+ArrayStore<EntryT, RefT>::initArrayTypes(const ArrayStoreConfig &cfg, std::shared_ptr<alloc::MemoryAllocator> memory_allocator)
{
_largeArrayTypeId = _store.addType(&_largeArrayType);
assert(_largeArrayTypeId == 0);
@@ -31,14 +31,14 @@ ArrayStore<EntryT, RefT>::initArrayTypes(std::shared_ptr<alloc::MemoryAllocator>
}
template <typename EntryT, typename RefT>
-ArrayStore<EntryT, RefT>::ArrayStore(std::shared_ptr<alloc::MemoryAllocator> memory_allocator, const ArrayStoreConfig &cfg)
+ArrayStore<EntryT, RefT>::ArrayStore(const ArrayStoreConfig &cfg, std::shared_ptr<alloc::MemoryAllocator> memory_allocator)
: _largeArrayTypeId(0),
_maxSmallArraySize(cfg.maxSmallArraySize()),
_store(),
_smallArrayTypes(),
_largeArrayType(cfg.specForSize(0), memory_allocator)
{
- initArrayTypes(std::move(memory_allocator), cfg);
+ initArrayTypes(cfg, std::move(memory_allocator));
_store.init_primary_buffers();
if (cfg.enable_free_lists()) {
_store.enableFreeLists();