diff options
author | Tor Egge <Tor.Egge@online.no> | 2022-03-03 21:55:04 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2022-03-03 21:55:04 +0100 |
commit | 0b266f7959130ff8561ee6caf3dd5084e1f56992 (patch) | |
tree | fbcab28f24a3c21b1350c1b29168febb3e295b07 /vespalib | |
parent | d538dbc39a3f8da7160c6f0c034ff40824cd4bed (diff) |
Use AtomicEntryRef as key for unique store btree dictionary.
Diffstat (limited to 'vespalib')
18 files changed, 57 insertions, 42 deletions
diff --git a/vespalib/src/tests/datastore/unique_store/unique_store_test.cpp b/vespalib/src/tests/datastore/unique_store/unique_store_test.cpp index 7f279689985..aa2d060d20b 100644 --- a/vespalib/src/tests/datastore/unique_store/unique_store_test.cpp +++ b/vespalib/src/tests/datastore/unique_store/unique_store_test.cpp @@ -416,7 +416,7 @@ TYPED_TEST(TestBase, store_can_be_enumerated) auto enumerator = this->getEnumerator(true); std::vector<uint32_t> refs; - enumerator.foreach_key([&](EntryRef ref) { refs.push_back(ref.ref()); }); + enumerator.foreach_key([&](const AtomicEntryRef& ref) { refs.push_back(ref.load_relaxed().ref()); }); std::vector<uint32_t> expRefs; expRefs.push_back(val0Ref.ref()); expRefs.push_back(val1Ref.ref()); diff --git a/vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp b/vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp index 4a8b7eafe6a..d0fede5c550 100644 --- a/vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp +++ b/vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp @@ -113,7 +113,7 @@ TYPED_TEST(UniqueStoreDictionaryTest, can_iterate_all_keys) using EntryRefVector = std::vector<EntryRef>; this->add(3).add(5).add(7).take_snapshot(); EntryRefVector refs; - this->snapshot->foreach_key([&](EntryRef ref){ refs.emplace_back(ref); }); + this->snapshot->foreach_key([&](AtomicEntryRef ref){ refs.emplace_back(ref.load_relaxed()); }); EXPECT_EQ(EntryRefVector({EntryRef(3), EntryRef(5), EntryRef(7)}), refs); } @@ -161,7 +161,7 @@ TYPED_TEST(UniqueStoreDictionaryTest, compaction_works) } this->take_snapshot(); std::vector<EntryRef> refs; - this->snapshot->foreach_key([&](EntryRef ref){ refs.emplace_back(ref); }); + this->snapshot->foreach_key([&](const AtomicEntryRef& ref){ refs.emplace_back(ref.load_relaxed()); }); EXPECT_EQ(exp_refs, refs); } diff --git a/vespalib/src/vespa/vespalib/btree/btreeiterator.cpp b/vespalib/src/vespa/vespalib/btree/btreeiterator.cpp index 93e4a15b47d..8d451740177 100644 --- a/vespalib/src/vespa/vespalib/btree/btreeiterator.cpp +++ b/vespalib/src/vespa/vespalib/btree/btreeiterator.cpp @@ -7,7 +7,6 @@ namespace vespalib::btree { template class BTreeIteratorBase<uint32_t, uint32_t, NoAggregated>; template class BTreeIteratorBase<uint32_t, BTreeNoLeafData, NoAggregated>; -template class BTreeIteratorBase<datastore::EntryRef, BTreeNoLeafData, NoAggregated>; template class BTreeIteratorBase<uint32_t, int32_t, MinMaxAggregated>; template class BTreeConstIterator<uint32_t, uint32_t, NoAggregated>; template class BTreeConstIterator<uint32_t, BTreeNoLeafData, NoAggregated>; diff --git a/vespalib/src/vespa/vespalib/btree/btreeiterator.h b/vespalib/src/vespa/vespalib/btree/btreeiterator.h index 30123b1946e..e0df9744265 100644 --- a/vespalib/src/vespa/vespalib/btree/btreeiterator.h +++ b/vespalib/src/vespa/vespalib/btree/btreeiterator.h @@ -988,7 +988,6 @@ private: extern template class BTreeIteratorBase<uint32_t, uint32_t, NoAggregated>; extern template class BTreeIteratorBase<uint32_t, BTreeNoLeafData, NoAggregated>; -extern template class BTreeIteratorBase<datastore::EntryRef, BTreeNoLeafData, NoAggregated>; extern template class BTreeIteratorBase<uint32_t, int32_t, MinMaxAggregated>; extern template class BTreeConstIterator<uint32_t, uint32_t, NoAggregated>; extern template class BTreeConstIterator<uint32_t, BTreeNoLeafData, NoAggregated>; diff --git a/vespalib/src/vespa/vespalib/btree/btreenodestore.cpp b/vespalib/src/vespa/vespalib/btree/btreenodestore.cpp index e84d7eaf3ad..4787a1416de 100644 --- a/vespalib/src/vespa/vespalib/btree/btreenodestore.cpp +++ b/vespalib/src/vespa/vespalib/btree/btreenodestore.cpp @@ -36,13 +36,15 @@ VESPALIB_DATASTORE_INSTANTIATE_BUFFERTYPE_INTERNALNODE(uint32_t, NoAggregated, B VESPALIB_DATASTORE_INSTANTIATE_BUFFERTYPE_INTERNALNODE(uint32_t, MinMaxAggregated, BTreeDefaultTraits::INTERNAL_SLOTS); VESPALIB_DATASTORE_INSTANTIATE_BUFFERTYPE_INTERNALNODE(uint64_t, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS); VESPALIB_DATASTORE_INSTANTIATE_BUFFERTYPE_INTERNALNODE(uint64_t, MinMaxAggregated, BTreeDefaultTraits::INTERNAL_SLOTS); +VESPALIB_DATASTORE_INSTANTIATE_BUFFERTYPE_INTERNALNODE(AtomicEntryRef, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS); VESPALIB_DATASTORE_INSTANTIATE_BUFFERTYPE_INTERNALNODE(EntryRef, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS); VESPALIB_DATASTORE_INSTANTIATE_BUFFERTYPE_LEAFNODE(uint32_t, uint32_t, NoAggregated, BTreeDefaultTraits::LEAF_SLOTS); VESPALIB_DATASTORE_INSTANTIATE_BUFFERTYPE_LEAFNODE(uint32_t, BTreeNoLeafData, NoAggregated, BTreeDefaultTraits::LEAF_SLOTS); VESPALIB_DATASTORE_INSTANTIATE_BUFFERTYPE_LEAFNODE(uint32_t, int32_t , MinMaxAggregated, BTreeDefaultTraits::LEAF_SLOTS); VESPALIB_DATASTORE_INSTANTIATE_BUFFERTYPE_LEAFNODE(uint64_t, uint64_t , MinMaxAggregated, BTreeDefaultTraits::LEAF_SLOTS); -VESPALIB_DATASTORE_INSTANTIATE_BUFFERTYPE_LEAFNODE(EntryRef, uint32_t, NoAggregated, BTreeDefaultTraits::LEAF_SLOTS); +VESPALIB_DATASTORE_INSTANTIATE_BUFFERTYPE_LEAFNODE(AtomicEntryRef, uint32_t, NoAggregated, BTreeDefaultTraits::LEAF_SLOTS); +VESPALIB_DATASTORE_INSTANTIATE_BUFFERTYPE_LEAFNODE(AtomicEntryRef, BTreeNoLeafData, NoAggregated, BTreeDefaultTraits::LEAF_SLOTS); VESPALIB_DATASTORE_INSTANTIATE_BUFFERTYPE_LEAFNODE(EntryRef, BTreeNoLeafData, NoAggregated, BTreeDefaultTraits::LEAF_SLOTS); VESPALIB_DATASTORE_INSTANTIATE_BUFFERTYPE_LEAFNODE(EntryRef, EntryRef, NoAggregated, BTreeDefaultTraits::LEAF_SLOTS); VESPALIB_DATASTORE_INSTANTIATE_BUFFERTYPE_LEAFNODE(uint32_t, EntryRef, NoAggregated, BTreeDefaultTraits::LEAF_SLOTS); diff --git a/vespalib/src/vespa/vespalib/datastore/CMakeLists.txt b/vespalib/src/vespa/vespalib/datastore/CMakeLists.txt index a2f7a4d4ff4..abbdc79c527 100644 --- a/vespalib/src/vespa/vespalib/datastore/CMakeLists.txt +++ b/vespalib/src/vespa/vespalib/datastore/CMakeLists.txt @@ -3,6 +3,7 @@ vespa_add_library(vespalib_vespalib_datastore OBJECT SOURCES array_store.cpp array_store_config.cpp + atomic_entry_ref.cpp buffer_type.cpp bufferstate.cpp compaction_strategy.cpp diff --git a/vespalib/src/vespa/vespalib/datastore/atomic_entry_ref.cpp b/vespalib/src/vespa/vespalib/datastore/atomic_entry_ref.cpp new file mode 100644 index 00000000000..b1504bb5aa3 --- /dev/null +++ b/vespalib/src/vespa/vespalib/datastore/atomic_entry_ref.cpp @@ -0,0 +1,12 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "atomic_entry_ref.h" +#include <vespa/vespalib/stllike/asciistream.h> + +namespace vespalib::datastore { + +vespalib::asciistream & operator << (vespalib::asciistream & os, const AtomicEntryRef &ref) { + return os << "AtomicEntryRef(" << ref.load_relaxed().ref() << ")"; +} + +} diff --git a/vespalib/src/vespa/vespalib/datastore/atomic_entry_ref.h b/vespalib/src/vespa/vespalib/datastore/atomic_entry_ref.h index 5fa83d41ad4..9866339f776 100644 --- a/vespalib/src/vespa/vespalib/datastore/atomic_entry_ref.h +++ b/vespalib/src/vespa/vespalib/datastore/atomic_entry_ref.h @@ -45,4 +45,6 @@ public: } }; +vespalib::asciistream& operator<<(vespalib::asciistream& os, const AtomicEntryRef& ref); + } diff --git a/vespalib/src/vespa/vespalib/datastore/entry_comparator_wrapper.h b/vespalib/src/vespa/vespalib/datastore/entry_comparator_wrapper.h index ee2e8d29cea..cc51f5ef732 100644 --- a/vespalib/src/vespa/vespalib/datastore/entry_comparator_wrapper.h +++ b/vespalib/src/vespa/vespalib/datastore/entry_comparator_wrapper.h @@ -15,8 +15,8 @@ public: EntryComparatorWrapper(const EntryComparator &comp) : _comp(comp) { } - bool operator()(const EntryRef &lhs, const EntryRef &rhs) const { - return _comp.less(lhs, rhs); + bool operator()(const AtomicEntryRef &lhs, const AtomicEntryRef &rhs) const { + return _comp.less(lhs.load_acquire(), rhs.load_acquire()); } }; diff --git a/vespalib/src/vespa/vespalib/datastore/i_unique_store_dictionary_read_snapshot.h b/vespalib/src/vespa/vespalib/datastore/i_unique_store_dictionary_read_snapshot.h index dc2187a843b..802547491bc 100644 --- a/vespalib/src/vespa/vespalib/datastore/i_unique_store_dictionary_read_snapshot.h +++ b/vespalib/src/vespa/vespalib/datastore/i_unique_store_dictionary_read_snapshot.h @@ -2,7 +2,7 @@ #pragma once -#include "entryref.h" +#include "atomic_entry_ref.h" #include <functional> namespace vespalib::datastore { @@ -21,7 +21,7 @@ public: virtual void sort() = 0; virtual size_t count(const EntryComparator& comp) const = 0; virtual size_t count_in_range(const EntryComparator& low, const EntryComparator& high) const = 0; - virtual void foreach_key(std::function<void(EntryRef)> callback) const = 0; + virtual void foreach_key(std::function<void(const AtomicEntryRef&)> callback) const = 0; }; } diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store.cpp b/vespalib/src/vespa/vespalib/datastore/unique_store.cpp index dcd9b38fab8..bdaad5b9233 100644 --- a/vespalib/src/vespa/vespalib/datastore/unique_store.cpp +++ b/vespalib/src/vespa/vespalib/datastore/unique_store.cpp @@ -7,7 +7,7 @@ namespace vespalib::datastore { using namespace btree; -VESPALIB_DATASTORE_INSTANTIATE_BUFFERTYPE_INTERNALNODE(EntryRef, NoAggregated, uniquestore::DefaultDictionaryTraits::INTERNAL_SLOTS); -VESPALIB_DATASTORE_INSTANTIATE_BUFFERTYPE_LEAFNODE(EntryRef, BTreeNoLeafData, NoAggregated, uniquestore::DefaultDictionaryTraits::LEAF_SLOTS); +VESPALIB_DATASTORE_INSTANTIATE_BUFFERTYPE_INTERNALNODE(AtomicEntryRef, NoAggregated, uniquestore::DefaultDictionaryTraits::INTERNAL_SLOTS); +VESPALIB_DATASTORE_INSTANTIATE_BUFFERTYPE_LEAFNODE(AtomicEntryRef, BTreeNoLeafData, NoAggregated, uniquestore::DefaultDictionaryTraits::LEAF_SLOTS); } diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store.hpp b/vespalib/src/vespa/vespalib/datastore/unique_store.hpp index b1a7db56545..a252763fb5b 100644 --- a/vespalib/src/vespa/vespalib/datastore/unique_store.hpp +++ b/vespalib/src/vespa/vespalib/datastore/unique_store.hpp @@ -18,7 +18,7 @@ namespace vespalib::datastore { namespace uniquestore { using DefaultDictionaryTraits = btree::BTreeTraits<32, 32, 7, true>; -using DefaultDictionary = btree::BTree<EntryRef, btree::BTreeNoLeafData, +using DefaultDictionary = btree::BTree<AtomicEntryRef, btree::BTreeNoLeafData, btree::NoAggregated, EntryComparatorWrapper, DefaultDictionaryTraits>; diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_btree_dictionary_read_snapshot.h b/vespalib/src/vespa/vespalib/datastore/unique_store_btree_dictionary_read_snapshot.h index c9a57e545f8..b38c49ccab4 100644 --- a/vespalib/src/vespa/vespalib/datastore/unique_store_btree_dictionary_read_snapshot.h +++ b/vespalib/src/vespa/vespalib/datastore/unique_store_btree_dictionary_read_snapshot.h @@ -24,7 +24,7 @@ public: void sort() override; size_t count(const EntryComparator& comp) const override; size_t count_in_range(const EntryComparator& low, const EntryComparator& high) const override; - void foreach_key(std::function<void(EntryRef)> callback) const override; + void foreach_key(std::function<void(const AtomicEntryRef&)> callback) const override; }; } diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_btree_dictionary_read_snapshot.hpp b/vespalib/src/vespa/vespalib/datastore/unique_store_btree_dictionary_read_snapshot.hpp index e2b05dcf481..b1ae0f3239c 100644 --- a/vespalib/src/vespa/vespalib/datastore/unique_store_btree_dictionary_read_snapshot.hpp +++ b/vespalib/src/vespa/vespalib/datastore/unique_store_btree_dictionary_read_snapshot.hpp @@ -28,8 +28,8 @@ template <typename BTreeDictionaryT> size_t UniqueStoreBTreeDictionaryReadSnapshot<BTreeDictionaryT>::count(const EntryComparator& comp) const { - auto itr = _frozen_view.lowerBound(EntryRef(), comp); - if (itr.valid() && !comp.less(EntryRef(), itr.getKey())) { + auto itr = _frozen_view.lowerBound(AtomicEntryRef(), comp); + if (itr.valid() && !comp.less(EntryRef(), itr.getKey().load_acquire())) { return 1u; } return 0u; @@ -39,17 +39,17 @@ template <typename BTreeDictionaryT> size_t UniqueStoreBTreeDictionaryReadSnapshot<BTreeDictionaryT>::count_in_range(const EntryComparator& low, const EntryComparator& high) const { - auto low_itr = _frozen_view.lowerBound(EntryRef(), low); + auto low_itr = _frozen_view.lowerBound(AtomicEntryRef(), low); auto high_itr = low_itr; - if (high_itr.valid() && !high.less(EntryRef(), high_itr.getKey())) { - high_itr.seekPast(EntryRef(), high); + if (high_itr.valid() && !high.less(EntryRef(), high_itr.getKey().load_acquire())) { + high_itr.seekPast(AtomicEntryRef(), high); } return high_itr - low_itr; } template <typename BTreeDictionaryT> void -UniqueStoreBTreeDictionaryReadSnapshot<BTreeDictionaryT>::foreach_key(std::function<void(EntryRef)> callback) const +UniqueStoreBTreeDictionaryReadSnapshot<BTreeDictionaryT>::foreach_key(std::function<void(const AtomicEntryRef&)> callback) const { _frozen_view.foreach_key(callback); } diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp b/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp index 4375b38cf7c..bac65fc4cf8 100644 --- a/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp +++ b/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp @@ -70,16 +70,16 @@ UniqueStoreDictionary<BTreeDictionaryT, ParentT, HashDictionaryT>::add(const Ent { if constexpr (has_btree_dictionary) { using DataType = typename BTreeDictionaryType::DataType; - auto itr = this->_btree_dict.lowerBound(EntryRef(), comp); - if (itr.valid() && !comp.less(EntryRef(), itr.getKey())) { + auto itr = this->_btree_dict.lowerBound(AtomicEntryRef(), comp); + if (itr.valid() && !comp.less(EntryRef(), itr.getKey().load_relaxed())) { if constexpr (has_hash_dictionary) { auto* result = this->_hash_dict.find(comp, EntryRef()); - assert(result != nullptr && result->first.load_relaxed() == itr.getKey()); + assert(result != nullptr && result->first.load_relaxed() == itr.getKey().load_relaxed()); } - return UniqueStoreAddResult(itr.getKey(), false); + return UniqueStoreAddResult(itr.getKey().load_relaxed(), false); } else { EntryRef newRef = insertEntry(); - this->_btree_dict.insert(itr, newRef, DataType()); + this->_btree_dict.insert(itr, AtomicEntryRef(newRef), DataType()); if constexpr (has_hash_dictionary) { std::function<EntryRef(void)> insert_hash_entry([newRef]() noexcept -> EntryRef { return newRef; }); auto& add_result = this->_hash_dict.add(comp, newRef, insert_hash_entry); @@ -102,13 +102,13 @@ EntryRef UniqueStoreDictionary<BTreeDictionaryT, ParentT, HashDictionaryT>::find(const EntryComparator &comp) { if constexpr (has_btree_dictionary) { - auto itr = this->_btree_dict.lowerBound(EntryRef(), comp); - if (itr.valid() && !comp.less(EntryRef(), itr.getKey())) { + auto itr = this->_btree_dict.lowerBound(AtomicEntryRef(), comp); + if (itr.valid() && !comp.less(EntryRef(), itr.getKey().load_relaxed())) { if constexpr (has_hash_dictionary) { auto* result = this->_hash_dict.find(comp, EntryRef()); - assert(result != nullptr && result->first.load_relaxed() == itr.getKey()); + assert(result != nullptr && result->first.load_relaxed() == itr.getKey().load_relaxed()); } - return itr.getKey(); + return itr.getKey().load_relaxed(); } else { if constexpr (has_hash_dictionary) { auto* result = this->_hash_dict.find(comp, EntryRef()); @@ -128,8 +128,8 @@ UniqueStoreDictionary<BTreeDictionaryT, ParentT, HashDictionaryT>::remove(const { assert(ref.valid()); if constexpr (has_btree_dictionary) { - auto itr = this->_btree_dict.lowerBound(ref, comp); - assert(itr.valid() && itr.getKey() == ref); + auto itr = this->_btree_dict.lowerBound(AtomicEntryRef(ref), comp); + assert(itr.valid() && itr.getKey().load_relaxed() == ref); this->_btree_dict.remove(itr); } if constexpr (has_hash_dictionary) { @@ -145,12 +145,12 @@ UniqueStoreDictionary<BTreeDictionaryT, ParentT, HashDictionaryT>::move_keys(ICo if constexpr (has_btree_dictionary) { auto itr = this->_btree_dict.begin(); while (itr.valid()) { - EntryRef oldRef(itr.getKey()); + EntryRef oldRef(itr.getKey().load_relaxed()); assert(oldRef.valid()); if (compacting_buffers.has(oldRef)) { EntryRef newRef(compactable.move(oldRef)); this->_btree_dict.thaw(itr); - itr.writeKey(newRef); + itr.writeKey(AtomicEntryRef(newRef)); if constexpr (has_hash_dictionary) { auto result = this->_hash_dict.find(this->_hash_dict.get_default_comparator(), oldRef); assert(result != nullptr && result->first.load_relaxed() == oldRef); @@ -202,7 +202,7 @@ UniqueStoreDictionary<BTreeDictionaryT, ParentT, HashDictionaryT>::build(vespali typename BTreeDictionaryType::Builder builder(this->_btree_dict.getAllocator()); for (size_t i = 1; i < refs.size(); ++i) { if (ref_counts[i] != 0u) { - builder.insert(refs[i], DataType()); + builder.insert(AtomicEntryRef(refs[i]), DataType()); } else { hold(refs[i]); } @@ -231,7 +231,7 @@ UniqueStoreDictionary<BTreeDictionaryT, ParentT, HashDictionaryT>::build(vespali using DataType = typename BTreeDictionaryType::DataType; typename BTreeDictionaryType::Builder builder(this->_btree_dict.getAllocator()); for (const auto& ref : refs) { - builder.insert(ref, DataType()); + builder.insert(AtomicEntryRef(ref), DataType()); } this->_btree_dict.assign(builder); } @@ -255,9 +255,9 @@ UniqueStoreDictionary<BTreeDictionaryT, ParentT, HashDictionaryT>::build_with_pa typename BTreeDictionaryType::Builder builder(this->_btree_dict.getAllocator()); for (size_t i = 0; i < refs.size(); ++i) { if constexpr (std::is_same_v<DataType, uint32_t>) { - builder.insert(refs[i], payloads[i]); - } else { - builder.insert(refs[i], DataType()); + builder.insert(AtomicEntryRef(refs[i]), payloads[i]); + } else { + builder.insert(AtomicEntryRef(refs[i]), DataType()); } } this->_btree_dict.assign(builder); diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.hpp b/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.hpp index ec3b0c54bda..214f5b8e8c4 100644 --- a/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.hpp +++ b/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.hpp @@ -56,7 +56,7 @@ void UniqueStoreEnumerator<RefT>::enumerateValues() { _next_enum_val = 1; - _dict_snapshot->foreach_key([this](EntryRef ref) noexcept { enumerateValue(ref); }); + _dict_snapshot->foreach_key([this](const AtomicEntryRef& ref) noexcept { enumerateValue(ref.load_acquire()); }); } template <typename RefT> diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_hash_dictionary_read_snapshot.h b/vespalib/src/vespa/vespalib/datastore/unique_store_hash_dictionary_read_snapshot.h index 3a3aeb7ab64..e5a7bbe62c6 100644 --- a/vespalib/src/vespa/vespalib/datastore/unique_store_hash_dictionary_read_snapshot.h +++ b/vespalib/src/vespa/vespalib/datastore/unique_store_hash_dictionary_read_snapshot.h @@ -28,7 +28,7 @@ public: void sort() override; size_t count(const EntryComparator& comp) const override; size_t count_in_range(const EntryComparator& low, const EntryComparator& high) const override; - void foreach_key(std::function<void(EntryRef)> callback) const override; + void foreach_key(std::function<void(const AtomicEntryRef&)> callback) const override; }; } diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_hash_dictionary_read_snapshot.hpp b/vespalib/src/vespa/vespalib/datastore/unique_store_hash_dictionary_read_snapshot.hpp index 302336f462c..7b68373aa3a 100644 --- a/vespalib/src/vespa/vespalib/datastore/unique_store_hash_dictionary_read_snapshot.hpp +++ b/vespalib/src/vespa/vespalib/datastore/unique_store_hash_dictionary_read_snapshot.hpp @@ -45,10 +45,10 @@ UniqueStoreHashDictionaryReadSnapshot<HashDictionaryT>::count_in_range(const Ent template <typename HashDictionaryT> void -UniqueStoreHashDictionaryReadSnapshot<HashDictionaryT>::foreach_key(std::function<void(EntryRef)> callback) const +UniqueStoreHashDictionaryReadSnapshot<HashDictionaryT>::foreach_key(std::function<void(const AtomicEntryRef&)> callback) const { for (auto ref : _refs) { - callback(ref); + callback(AtomicEntryRef(ref)); } } |