diff options
79 files changed, 406 insertions, 401 deletions
diff --git a/searchcore/src/tests/proton/index/indexmanager_test.cpp b/searchcore/src/tests/proton/index/indexmanager_test.cpp index 00579ce3d07..a384bc824c5 100644 --- a/searchcore/src/tests/proton/index/indexmanager_test.cpp +++ b/searchcore/src/tests/proton/index/indexmanager_test.cpp @@ -33,7 +33,7 @@ LOG_SETUP("indexmanager_test"); using document::Document; using document::FieldValue; -using search::btree::EntryRef; +using search::datastore::EntryRef; using search::index::DocBuilder; using search::index::Schema; using search::index::DummyFileHeaderContext; diff --git a/searchlib/src/tests/attribute/attribute_test.cpp b/searchlib/src/tests/attribute/attribute_test.cpp index de9bb30914e..8708bc83ff3 100644 --- a/searchlib/src/tests/attribute/attribute_test.cpp +++ b/searchlib/src/tests/attribute/attribute_test.cpp @@ -1706,7 +1706,7 @@ AttributeTest::testStatus() 4 + sizeof(EnumStoreBase::Index) * EnumTreeTraits::LEAF_SLOTS; static constexpr size_t InternalNodeSize = 8 + (sizeof(EnumStoreBase::Index) + - sizeof(btree::EntryRef)) * EnumTreeTraits::INTERNAL_SLOTS; + sizeof(datastore::EntryRef)) * EnumTreeTraits::INTERNAL_SLOTS; static constexpr size_t NestedVectorSize = 24; // sizeof(vespalib::Array) { diff --git a/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp b/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp index e63889bbeb8..432a86be780 100644 --- a/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp +++ b/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp @@ -315,7 +315,7 @@ EnumStoreTest::testAddEnum(bool hasPostings) uint32_t e = ses.getEnum(indices[i]); EXPECT_EQUAL(i, e); EXPECT_TRUE(ses.findEnum(unique[i].c_str(), e)); - EXPECT_TRUE(ses.getEnum(btree::EntryRef(e)) == i); + EXPECT_TRUE(ses.getEnum(datastore::EntryRef(e)) == i); EXPECT_TRUE(ses.findIndex(unique[i].c_str(), idx)); EXPECT_TRUE(idx == indices[i]); EXPECT_EQUAL(1u, ses.getRefCount(indices[i])); diff --git a/searchlib/src/tests/attribute/postinglist/postinglist.cpp b/searchlib/src/tests/attribute/postinglist/postinglist.cpp index 5d340dc5b07..ea53bd49c19 100644 --- a/searchlib/src/tests/attribute/postinglist/postinglist.cpp +++ b/searchlib/src/tests/attribute/postinglist/postinglist.cpp @@ -99,7 +99,7 @@ private: std::vector<RandomValue> _randomValues; public: - typedef btree::DataStore<int> IntKeyStore; + typedef datastore::DataStore<int> IntKeyStore; typedef btree::BTreeKeyData<uint32_t, btree::BTreeNoLeafData> AttributePosting; typedef btree::BTreeStore<uint32_t, @@ -109,8 +109,8 @@ public: btree::BTreeDefaultTraits> PostingList; typedef PostingList::NodeAllocatorType PostingListNodeAllocator; - typedef btree::EntryRef PostingIdx; - typedef btree::EntryRef StoreIndex; + typedef datastore::EntryRef PostingIdx; + typedef datastore::EntryRef StoreIndex; class IntComp { private: @@ -593,8 +593,8 @@ AttributePostingListTest::doCompactEnumStore(Tree &tree, std::vector<uint32_t> toHold; for (uint32_t bufferId = 0; bufferId < numBuffers; ++bufferId) { - btree::BufferState &state = valueHandle.getBufferState(bufferId); - if (state._state == btree::BufferState::ACTIVE) { + datastore::BufferState &state = valueHandle.getBufferState(bufferId); + if (state._state == datastore::BufferState::ACTIVE) { toHold.push_back(bufferId); // Freelists already disabled due to variable sized data } diff --git a/searchlib/src/tests/btree/btreeaggregation_test.cpp b/searchlib/src/tests/btree/btreeaggregation_test.cpp index bb8e86ef49d..51ff66367a1 100644 --- a/searchlib/src/tests/btree/btreeaggregation_test.cpp +++ b/searchlib/src/tests/btree/btreeaggregation_test.cpp @@ -24,6 +24,7 @@ LOG_SETUP("btreeaggregation_test"); #include <vespa/searchlib/btree/btreeaggregator.hpp> using vespalib::GenerationHandler; +using search::datastore::EntryRef; namespace search { namespace btree { diff --git a/searchlib/src/tests/memoryindex/btree/btree_test.cpp b/searchlib/src/tests/memoryindex/btree/btree_test.cpp index 5fb6761ba57..deec982b5ab 100644 --- a/searchlib/src/tests/memoryindex/btree/btree_test.cpp +++ b/searchlib/src/tests/memoryindex/btree/btree_test.cpp @@ -21,6 +21,7 @@ LOG_SETUP("btree_test"); #include <vespa/searchlib/btree/btreestore.hpp> using vespalib::GenerationHandler; +using search::datastore::EntryRef; namespace search { namespace btree { diff --git a/searchlib/src/tests/memoryindex/compact_document_words_store/compact_document_words_store_test.cpp b/searchlib/src/tests/memoryindex/compact_document_words_store/compact_document_words_store_test.cpp index 736e24332d4..662adbf6b94 100644 --- a/searchlib/src/tests/memoryindex/compact_document_words_store/compact_document_words_store_test.cpp +++ b/searchlib/src/tests/memoryindex/compact_document_words_store/compact_document_words_store_test.cpp @@ -10,7 +10,7 @@ LOG_SETUP(".memoryindex.compact_document_words_store_test"); #include <map> using namespace search; -using namespace search::btree; +using namespace search::datastore; using namespace search::memoryindex; typedef CompactDocumentWordsStore::Builder Builder; diff --git a/searchlib/src/tests/memoryindex/datastore/datastore_test.cpp b/searchlib/src/tests/memoryindex/datastore/datastore_test.cpp index d07634c426c..de673c8c0c9 100644 --- a/searchlib/src/tests/memoryindex/datastore/datastore_test.cpp +++ b/searchlib/src/tests/memoryindex/datastore/datastore_test.cpp @@ -7,7 +7,7 @@ LOG_SETUP("datastore_test"); #include <vespa/searchlib/datastore/datastore.hpp> namespace search { -namespace btree { +namespace datastore { class MyStore : public DataStore<int, EntryRefT<3, 2> > { private: @@ -428,5 +428,5 @@ Test::Main() } } -TEST_APPHOOK(search::btree::Test); +TEST_APPHOOK(search::datastore::Test); diff --git a/searchlib/src/tests/memoryindex/datastore/featurestore_test.cpp b/searchlib/src/tests/memoryindex/datastore/featurestore_test.cpp index 87d32c90b78..87a9ab87cb1 100644 --- a/searchlib/src/tests/memoryindex/datastore/featurestore_test.cpp +++ b/searchlib/src/tests/memoryindex/datastore/featurestore_test.cpp @@ -6,6 +6,7 @@ LOG_SETUP("featurestore_test"); #include <vespa/searchlib/memoryindex/featurestore.h> using namespace search::btree; +using namespace search::datastore; using namespace search::index; namespace search diff --git a/searchlib/src/tests/memoryindex/datastore/wordstore_test.cpp b/searchlib/src/tests/memoryindex/datastore/wordstore_test.cpp index 825992b3b4f..fcf96d5afe9 100644 --- a/searchlib/src/tests/memoryindex/datastore/wordstore_test.cpp +++ b/searchlib/src/tests/memoryindex/datastore/wordstore_test.cpp @@ -5,7 +5,7 @@ LOG_SETUP("wordstore_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/searchlib/memoryindex/wordstore.h> -using namespace search::btree; +using namespace search::datastore; namespace search { namespace memoryindex { diff --git a/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp b/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp index ef8383b23c7..907e983420c 100644 --- a/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp +++ b/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp @@ -45,6 +45,7 @@ namespace search { using namespace btree; +using namespace datastore; using namespace fef; using namespace index; using queryeval::SearchIterator; @@ -510,7 +511,7 @@ public: return *this; } - btree::EntryRef + datastore::EntryRef getWordRef() { return _inserter.getWordRef(); diff --git a/searchlib/src/tests/memoryindex/document_remover/document_remover_test.cpp b/searchlib/src/tests/memoryindex/document_remover/document_remover_test.cpp index 8c6751adbeb..838e876d284 100644 --- a/searchlib/src/tests/memoryindex/document_remover/document_remover_test.cpp +++ b/searchlib/src/tests/memoryindex/document_remover/document_remover_test.cpp @@ -64,7 +64,7 @@ struct Fixture { MockRemoveListener _listener; std::vector<std::unique_ptr<WordStore>> _wordStores; - std::vector<std::map<vespalib::string, btree::EntryRef>> _wordToRefMaps; + std::vector<std::map<vespalib::string, datastore::EntryRef>> _wordToRefMaps; std::vector<std::unique_ptr<DocumentRemover>> _removers; Fixture() : _listener(), @@ -80,12 +80,12 @@ struct Fixture } _wordToRefMaps.resize(numFields); } - btree::EntryRef getWordRef(const vespalib::string &word, uint32_t fieldId) { + datastore::EntryRef getWordRef(const vespalib::string &word, uint32_t fieldId) { auto &wordToRefMap = _wordToRefMaps[fieldId]; WordStore &wordStore = *_wordStores[fieldId]; auto itr = wordToRefMap.find(word); if (itr == wordToRefMap.end()) { - btree::EntryRef ref = wordStore.addWord(word); + datastore::EntryRef ref = wordStore.addWord(word); wordToRefMap[word] = ref; return ref; } diff --git a/searchlib/src/tests/predicate/predicate_bounds_posting_list_test.cpp b/searchlib/src/tests/predicate/predicate_bounds_posting_list_test.cpp index c54e6f49cc7..0f7802d63b0 100644 --- a/searchlib/src/tests/predicate/predicate_bounds_posting_list_test.cpp +++ b/searchlib/src/tests/predicate/predicate_bounds_posting_list_test.cpp @@ -27,7 +27,7 @@ const uint64_t hash = 0x123; TEST("require that empty bounds posting list starts at 0.") { PredicateIndex index(generation_handler, generation_holder, limit_provider, config, 8); - btree::EntryRef ref; + datastore::EntryRef ref; PredicateBoundsPostingList<PredicateIndex::BTreeIterator> posting_list(index.getIntervalStore(), index.getBoundsIndex().getBTreePostingList(ref), 42); diff --git a/searchlib/src/tests/predicate/predicate_index_test.cpp b/searchlib/src/tests/predicate/predicate_index_test.cpp index e4d9aeef1f0..5a6b6240e65 100644 --- a/searchlib/src/tests/predicate/predicate_index_test.cpp +++ b/searchlib/src/tests/predicate/predicate_index_test.cpp @@ -237,7 +237,7 @@ void checkAllIntervals(Iterator posting_it, IntervalT expected_interval, for (uint32_t id = 1; id < 100u; ++id) { ASSERT_TRUE(posting_it.valid()); EXPECT_EQUAL(id, posting_it.getKey()); - btree::EntryRef ref = posting_it.getData(); + datastore::EntryRef ref = posting_it.getData(); ASSERT_TRUE(ref.valid()); uint32_t size; IntervalT single; diff --git a/searchlib/src/tests/predicate/predicate_interval_posting_list_test.cpp b/searchlib/src/tests/predicate/predicate_interval_posting_list_test.cpp index 1c44c096717..18feb30106f 100644 --- a/searchlib/src/tests/predicate/predicate_interval_posting_list_test.cpp +++ b/searchlib/src/tests/predicate/predicate_interval_posting_list_test.cpp @@ -26,7 +26,7 @@ const uint64_t hash = 0x123; TEST("require that empty posting list starts at 0.") { PredicateIndex index(generation_handler, generation_holder, limit_provider, config, 8); - btree::EntryRef ref; + datastore::EntryRef ref; PredicateIntervalPostingList<PredicateIndex::BTreeIterator> posting_list(index.getIntervalStore(), index.getIntervalIndex().getBTreePostingList(ref)); EXPECT_EQUAL(0u, posting_list.getDocId()); diff --git a/searchlib/src/tests/predicate/predicate_zstar_compressed_posting_list_test.cpp b/searchlib/src/tests/predicate/predicate_zstar_compressed_posting_list_test.cpp index 2dff14b4417..5946bc926d0 100644 --- a/searchlib/src/tests/predicate/predicate_zstar_compressed_posting_list_test.cpp +++ b/searchlib/src/tests/predicate/predicate_zstar_compressed_posting_list_test.cpp @@ -28,7 +28,7 @@ const uint64_t hash = 0x123; TEST("require that empty posting list starts at 0.") { PredicateIndex index(generation_handler, generation_holder, limit_provider, config, 8); - btree::EntryRef ref; + datastore::EntryRef ref; PredicateZstarCompressedPostingList<PredicateIndex::BTreeIterator> posting_list(index.getIntervalStore(), index.getIntervalIndex().getBTreePostingList(ref)); EXPECT_EQUAL(0u, posting_list.getDocId()); diff --git a/searchlib/src/tests/predicate/simple_index_test.cpp b/searchlib/src/tests/predicate/simple_index_test.cpp index 59e4fc53c05..f8a1d3f1366 100644 --- a/searchlib/src/tests/predicate/simple_index_test.cpp +++ b/searchlib/src/tests/predicate/simple_index_test.cpp @@ -91,7 +91,7 @@ struct Fixture { SimpleIndex<MyData>::VectorIterator getVectorPostingList(uint64_t k) { return *_index.getVectorPostingList(k); } - SimpleIndex<MyData>::BTreeIterator getBTreePostingList(btree::EntryRef ref) { + SimpleIndex<MyData>::BTreeIterator getBTreePostingList(datastore::EntryRef ref) { return _index.getBTreePostingList(ref); } void commit() { @@ -105,7 +105,7 @@ TEST_F("require that SimpleIndex can insert and remove a value.", Fixture) { f.commit(); auto it = f.lookup(key); ASSERT_TRUE(it.valid()); - btree::EntryRef ref = it.getData(); + datastore::EntryRef ref = it.getData(); auto posting_it = f.getBTreePostingList(ref); ASSERT_TRUE(posting_it.valid()); EXPECT_EQUAL(doc_id, posting_it.getKey()); @@ -130,7 +130,7 @@ TEST_F("require that SimpleIndex can insert and remove many values.", Fixture) { f.commit(); auto it = f.lookup(key); ASSERT_TRUE(it.valid()); - btree::EntryRef ref = it.getData(); + datastore::EntryRef ref = it.getData(); auto posting_it = f.getBTreePostingList(ref); for (size_t id = 1; id < 100; ++id) { ASSERT_TRUE(posting_it.valid()); @@ -174,7 +174,7 @@ TEST_FF("require that SimpleIndex can be serialized and deserialized.", Fixture, auto it = f2.lookup(key); ASSERT_TRUE(it.valid()); - btree::EntryRef ref = it.getData(); + datastore::EntryRef ref = it.getData(); auto posting_it = f1.getBTreePostingList(ref); for (uint32_t id = 1; id < 100; ++id) { ASSERT_TRUE(posting_it.valid()); @@ -195,7 +195,7 @@ TEST_F("require that SimpleIndex can update by inserting the same key twice.", F auto it = f.lookup(key); ASSERT_TRUE(it.valid()); - btree::EntryRef ref = it.getData(); + datastore::EntryRef ref = it.getData(); auto posting_it = f.getBTreePostingList(ref); ASSERT_TRUE(posting_it.valid()); EXPECT_EQUAL(doc_id, posting_it.getKey()); diff --git a/searchlib/src/vespa/searchlib/attribute/enumstore.cpp b/searchlib/src/vespa/searchlib/attribute/enumstore.cpp index 10a8b46ce80..cc50dc7b97d 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumstore.cpp +++ b/searchlib/src/vespa/searchlib/attribute/enumstore.cpp @@ -127,7 +127,7 @@ EnumStoreT<StringEntryType>::deserialize(const void *src, if (available < sz) return -1; uint32_t activeBufferId = _store.getActiveBufferId(TYPE_ID); - btree::BufferState & buffer = _store.getBufferState(activeBufferId); + datastore::BufferState & buffer = _store.getBufferState(activeBufferId); uint32_t entrySize(alignEntrySize(EntryBase::size() + sz)); if (buffer.remaining() < entrySize) { fprintf(stderr, "Out of enumstore bufferspace\n"); @@ -158,7 +158,7 @@ class btree::BTreeNodeDataWrap<btree::BTreeNoLeafData, EnumTreeTraits::LEAF_SLOTS>; template -class btree::BTreeNodeDataWrap<btree::EntryRef, +class btree::BTreeNodeDataWrap<datastore::EntryRef, EnumTreeTraits::LEAF_SLOTS>; #if 0 @@ -168,7 +168,7 @@ class btree::BTreeKeyData<EnumStoreBase::Index, template class btree::BTreeKeyData<EnumStoreBase::Index, - btree::EntryRef>; + datastore::EntryRef>; #endif template @@ -183,7 +183,7 @@ class btree::BTreeNodeT<EnumStoreBase::Index, template class btree::BTreeNodeTT<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, EnumTreeTraits::INTERNAL_SLOTS>; @@ -196,7 +196,7 @@ class btree::BTreeNodeTT<EnumStoreBase::Index, #if 0 template class btree::BTreeNodeTT<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, EnumTreeTraits::LEAF_SLOTS>; #endif @@ -214,7 +214,7 @@ class btree::BTreeLeafNode<EnumStoreBase::Index, template class btree::BTreeLeafNode<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, EnumTreeTraits::LEAF_SLOTS>; @@ -226,7 +226,7 @@ class btree::BTreeLeafNodeTemp<EnumStoreBase::Index, template class btree::BTreeLeafNodeTemp<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, EnumTreeTraits::LEAF_SLOTS>; @@ -239,7 +239,7 @@ class btree::BTreeNodeStore<EnumStoreBase::Index, template class btree::BTreeNodeStore<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, EnumTreeTraits::INTERNAL_SLOTS, EnumTreeTraits::LEAF_SLOTS>; @@ -253,7 +253,7 @@ class btree::BTreeIteratorBase<EnumStoreBase::Index, EnumTreeTraits::PATH_SIZE>; template class btree::BTreeIteratorBase<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, EnumTreeTraits::INTERNAL_SLOTS, EnumTreeTraits::LEAF_SLOTS, @@ -266,7 +266,7 @@ class btree::BTreeIterator<EnumStoreBase::Index, EnumTreeTraits>; template class btree::BTreeIterator<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, const EnumStoreComparatorWrapper, EnumTreeTraits>; @@ -278,7 +278,7 @@ class btree::BTree<EnumStoreBase::Index, EnumTreeTraits>; template class btree::BTree<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, const EnumStoreComparatorWrapper, EnumTreeTraits>; @@ -291,7 +291,7 @@ class btree::BTreeRoot<EnumStoreBase::Index, template class btree::BTreeRoot<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, const EnumStoreComparatorWrapper, EnumTreeTraits>; @@ -304,7 +304,7 @@ class btree::BTreeRootT<EnumStoreBase::Index, template class btree::BTreeRootT<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, const EnumStoreComparatorWrapper, EnumTreeTraits>; @@ -317,7 +317,7 @@ class btree::BTreeRootBase<EnumStoreBase::Index, template class btree::BTreeRootBase<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, EnumTreeTraits::INTERNAL_SLOTS, EnumTreeTraits::LEAF_SLOTS>; @@ -331,7 +331,7 @@ class btree::BTreeNodeAllocator<EnumStoreBase::Index, template class btree::BTreeNodeAllocator<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, EnumTreeTraits::INTERNAL_SLOTS, EnumTreeTraits::LEAF_SLOTS>; @@ -345,7 +345,7 @@ class btree::BTreeBuilder<EnumStoreBase::Index, template class btree::BTreeBuilder<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, EnumTreeTraits::INTERNAL_SLOTS, EnumTreeTraits::LEAF_SLOTS>; diff --git a/searchlib/src/vespa/searchlib/attribute/enumstore.h b/searchlib/src/vespa/searchlib/attribute/enumstore.h index 1fbe7f74865..12afc55467f 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumstore.h +++ b/searchlib/src/vespa/searchlib/attribute/enumstore.h @@ -131,7 +131,7 @@ public: } bool getValue(Index idx, Type & value) const; - Type getValue(uint32_t idx) const { return getValue(Index(btree::EntryRef(idx))); } + Type getValue(uint32_t idx) const { return getValue(Index(datastore::EntryRef(idx))); } Type getValue(Index idx) const { return getEntry(idx).getValue(); } virtual uint32_t getFixedSize() const { return Entry::fixedSize(); } @@ -302,7 +302,7 @@ class btree::BTreeNodeDataWrap<btree::BTreeNoLeafData, EnumTreeTraits::LEAF_SLOTS>; extern template -class btree::BTreeNodeDataWrap<btree::EntryRef, +class btree::BTreeNodeDataWrap<datastore::EntryRef, EnumTreeTraits::LEAF_SLOTS>; #if 0 @@ -312,7 +312,7 @@ class btree::BTreeKeyData<EnumStoreBase::Index, extern template class btree::BTreeKeyData<EnumStoreBase::Index, - btree::EntryRef>; + datastore::EntryRef>; #endif extern template @@ -327,7 +327,7 @@ class btree::BTreeNodeT<EnumStoreBase::Index, extern template class btree::BTreeNodeTT<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, EnumTreeTraits::INTERNAL_SLOTS>; @@ -340,7 +340,7 @@ class btree::BTreeNodeTT<EnumStoreBase::Index, #if 0 extern template class btree::BTreeNodeTT<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, EnumTreeTraits::LEAF_SLOTS>; #endif @@ -358,7 +358,7 @@ class btree::BTreeLeafNode<EnumStoreBase::Index, extern template class btree::BTreeLeafNode<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, EnumTreeTraits::LEAF_SLOTS>; @@ -370,7 +370,7 @@ class btree::BTreeLeafNodeTemp<EnumStoreBase::Index, extern template class btree::BTreeLeafNodeTemp<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, EnumTreeTraits::LEAF_SLOTS>; @@ -383,7 +383,7 @@ class btree::BTreeNodeStore<EnumStoreBase::Index, extern template class btree::BTreeNodeStore<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, EnumTreeTraits::INTERNAL_SLOTS, EnumTreeTraits::LEAF_SLOTS>; @@ -397,7 +397,7 @@ class btree::BTreeIteratorBase<EnumStoreBase::Index, EnumTreeTraits::PATH_SIZE>; extern template class btree::BTreeIteratorBase<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, EnumTreeTraits::INTERNAL_SLOTS, EnumTreeTraits::LEAF_SLOTS, @@ -410,7 +410,7 @@ class btree::BTreeIterator<EnumStoreBase::Index, EnumTreeTraits>; extern template class btree::BTreeIterator<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, const EnumStoreComparatorWrapper, EnumTreeTraits>; @@ -422,7 +422,7 @@ class btree::BTree<EnumStoreBase::Index, EnumTreeTraits>; extern template class btree::BTree<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, const EnumStoreComparatorWrapper, EnumTreeTraits>; @@ -434,7 +434,7 @@ class btree::BTreeRoot<EnumStoreBase::Index, EnumTreeTraits>; extern template class btree::BTreeRoot<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, const EnumStoreComparatorWrapper, EnumTreeTraits>; @@ -446,7 +446,7 @@ class btree::BTreeRootT<EnumStoreBase::Index, EnumTreeTraits>; extern template class btree::BTreeRootT<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, const EnumStoreComparatorWrapper, EnumTreeTraits>; @@ -458,7 +458,7 @@ class btree::BTreeRootBase<EnumStoreBase::Index, EnumTreeTraits::LEAF_SLOTS>; extern template class btree::BTreeRootBase<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, EnumTreeTraits::INTERNAL_SLOTS, EnumTreeTraits::LEAF_SLOTS>; @@ -471,7 +471,7 @@ class btree::BTreeNodeAllocator<EnumStoreBase::Index, EnumTreeTraits::LEAF_SLOTS>; extern template class btree::BTreeNodeAllocator<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, EnumTreeTraits::INTERNAL_SLOTS, EnumTreeTraits::LEAF_SLOTS>; @@ -484,7 +484,7 @@ class btree::BTreeBuilder<EnumStoreBase::Index, EnumTreeTraits::LEAF_SLOTS>; extern template class btree::BTreeBuilder<EnumStoreBase::Index, - btree::EntryRef, + datastore::EntryRef, btree::NoAggregated, EnumTreeTraits::INTERNAL_SLOTS, EnumTreeTraits::LEAF_SLOTS>; diff --git a/searchlib/src/vespa/searchlib/attribute/enumstore.hpp b/searchlib/src/vespa/searchlib/attribute/enumstore.hpp index aa0de0e8845..16945f17815 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumstore.hpp +++ b/searchlib/src/vespa/searchlib/attribute/enumstore.hpp @@ -138,7 +138,7 @@ EnumStoreT<EntryType>::deserialize(const void *src, if (available < sz) return -1; uint32_t activeBufferId = _store.getActiveBufferId(TYPE_ID); - btree::BufferState & buffer = _store.getBufferState(activeBufferId); + datastore::BufferState & buffer = _store.getBufferState(activeBufferId); uint32_t entrySize(alignEntrySize(EntryBase::size() + sz)); if (buffer.remaining() < entrySize) { abort(); // not enough space @@ -235,7 +235,7 @@ EnumStoreT<EntryType>::addEnum(Type value, typedef typename Dictionary::Iterator DictionaryIterator; uint32_t entrySize = this->getEntrySize(value); uint32_t activeBufferId = _store.getActiveBufferId(TYPE_ID); - btree::BufferState & buffer = _store.getBufferState(activeBufferId); + datastore::BufferState & buffer = _store.getBufferState(activeBufferId); #ifdef LOG_ENUM_STORE LOG(info, "addEnum(): buffer[%u]: capacity = %" PRIu64 @@ -316,7 +316,7 @@ template <typename DictionaryType> struct TreeBuilderInserter { static void insert(typename DictionaryType::Builder & builder, EnumStoreBase::Index enumIdx, - btree::EntryRef postingIdx) + datastore::EntryRef postingIdx) { (void) postingIdx; builder.insert(enumIdx, typename DictionaryType::DataType()); @@ -327,7 +327,7 @@ template <> struct TreeBuilderInserter<EnumPostingTree> { static void insert(EnumPostingTree::Builder & builder, EnumStoreBase::Index enumIdx, - btree::EntryRef postingIdx) + datastore::EntryRef postingIdx) { builder.insert(enumIdx, postingIdx); } @@ -344,7 +344,7 @@ EnumStoreT<EntryType>::reset(Builder &builder, Dictionary &dict) DictionaryBuilder treeBuilder(dict.getAllocator()); uint32_t activeBufferId = _store.getActiveBufferId(TYPE_ID); - btree::BufferState & state = _store.getBufferState(activeBufferId); + datastore::BufferState & state = _store.getBufferState(activeBufferId); // insert entries and update DictionaryBuilder const typename Builder::Uniques & uniques = builder.getUniques(); @@ -358,7 +358,7 @@ EnumStoreT<EntryType>::reset(Builder &builder, Dictionary &dict) state.pushed_back(iter->_sz); // update DictionaryBuilder with enum index and posting index - TreeBuilderInserter<Dictionary>::insert(treeBuilder, idx, btree::EntryRef(iter->_pidx)); + TreeBuilderInserter<Dictionary>::insert(treeBuilder, idx, datastore::EntryRef(iter->_pidx)); } // reset Dictionary @@ -388,7 +388,7 @@ EnumStoreT<EntryType>::performCompaction(Dictionary &dict) { typedef typename Dictionary::Iterator DictionaryIterator; uint32_t freeBufferIdx = _store.getActiveBufferId(TYPE_ID); - btree::BufferState & freeBuf = _store.getBufferState(freeBufferIdx); + datastore::BufferState & freeBuf = _store.getBufferState(freeBufferIdx); bool disabledReEnumerate = _disabledReEnumerate; uint32_t newEnum = 0; diff --git a/searchlib/src/vespa/searchlib/attribute/enumstorebase.cpp b/searchlib/src/vespa/searchlib/attribute/enumstorebase.cpp index 3fe004d65ba..554a9a1fa2d 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumstorebase.cpp +++ b/searchlib/src/vespa/searchlib/attribute/enumstorebase.cpp @@ -65,7 +65,7 @@ EnumStoreBase::reset(uint64_t initBufferSize) } uint32_t -EnumStoreBase::getBufferIndex(btree::BufferState::State status) +EnumStoreBase::getBufferIndex(datastore::BufferState::State status) { for (uint32_t i = 0; i < _store.getNumBuffers(); ++i) { if (_store.getBufferState(i)._state == status) { @@ -95,7 +95,7 @@ EnumStoreBase::getMemoryUsage() const AddressSpace EnumStoreBase::getAddressSpaceUsage() const { - const btree::BufferState &activeState = + const datastore::BufferState &activeState = _store.getBufferState(_store.getActiveBufferId(TYPE_ID)); return AddressSpace(activeState.size() - activeState.getDeadElems(), DataStoreType::RefType::offsetSize()); @@ -127,10 +127,10 @@ EnumStoreBase::trimHoldLists(generation_t firstUsed) bool EnumStoreBase::preCompact(uint64_t bytesNeeded) { - if (getBufferIndex(btree::BufferState::FREE) == Index::numBuffers()) { + if (getBufferIndex(datastore::BufferState::FREE) == Index::numBuffers()) { return false; } - btree::BufferState & activeBuf = _store.getBufferState(_store.getActiveBufferId(TYPE_ID)); + datastore::BufferState & activeBuf = _store.getBufferState(_store.getActiveBufferId(TYPE_ID)); // allocate enough space in free buffer uint64_t newSize = computeNewSize(activeBuf.size(), activeBuf._deadElems, bytesNeeded); @@ -146,7 +146,7 @@ void EnumStoreBase::fallbackResize(uint64_t bytesNeeded) { uint32_t activeBufId = _store.getActiveBufferId(TYPE_ID); - btree::BufferState &activeBuf = _store.getBufferState(activeBufId); + datastore::BufferState &activeBuf = _store.getBufferState(activeBufId); // allocate enough space in free buffer uint64_t newSize = computeNewSize(activeBuf.size(), @@ -615,7 +615,7 @@ EnumStoreDict<Dictionary>::hasData(void) const } -template class btree::DataStoreT<btree::AlignedEntryRefT<31, 4> >; +template class datastore::DataStoreT<datastore::AlignedEntryRefT<31, 4> >; template void diff --git a/searchlib/src/vespa/searchlib/attribute/enumstorebase.h b/searchlib/src/vespa/searchlib/attribute/enumstorebase.h index a920a3004a9..bdb9a578bfe 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumstorebase.h +++ b/searchlib/src/vespa/searchlib/attribute/enumstorebase.h @@ -31,7 +31,7 @@ class EnumStoreBase; class EnumStoreComparator; class EnumStoreComparatorWrapper; -typedef btree::DataStoreT<btree::AlignedEntryRefT<31, 4> > +typedef datastore::DataStoreT<datastore::AlignedEntryRefT<31, 4> > EnumStoreDataStoreType; typedef EnumStoreDataStoreType::RefType EnumStoreIndex; typedef vespalib::Array<EnumStoreIndex> EnumStoreIndexVector; @@ -43,7 +43,7 @@ typedef btree::BTree<EnumStoreIndex, btree::BTreeNoLeafData, btree::NoAggregated, const EnumStoreComparatorWrapper, EnumTreeTraits> EnumTree; -typedef btree::BTree<EnumStoreIndex, btree::EntryRef, +typedef btree::BTree<EnumStoreIndex, datastore::EntryRef, btree::NoAggregated, const EnumStoreComparatorWrapper, EnumTreeTraits> EnumPostingTree; @@ -318,14 +318,14 @@ private: protected: - class EnumBufferType : public btree::BufferType<char> { + class EnumBufferType : public datastore::BufferType<char> { private: uint64_t _initBufferSize; // in bytes bool _pendingCompact; bool _wantCompact; public: EnumBufferType(uint64_t initBufferSize) - : btree::BufferType<char>(Index::align(1), + : datastore::BufferType<char>(Index::align(1), Index::offsetSize() / Index::align(1), Index::offsetSize() / Index::align(1)), _initBufferSize(initBufferSize), @@ -347,7 +347,7 @@ protected: virtual void onFree(size_t usedElems) { - btree::BufferType<char>::onFree(usedElems); + datastore::BufferType<char>::onFree(usedElems); _pendingCompact = _wantCompact; _wantCompact = false; } @@ -390,17 +390,17 @@ protected: EntryBase getEntryBase(Index idx) const { return EntryBase(const_cast<DataStoreType &>(_store).getBufferEntry<char>(idx.bufferId(), idx.offset())); } - btree::BufferState & getBuffer(uint32_t bufferIdx) { + datastore::BufferState & getBuffer(uint32_t bufferIdx) { return _store.getBufferState(bufferIdx); } - const btree::BufferState & getBuffer(uint32_t bufferIdx) const { + const datastore::BufferState & getBuffer(uint32_t bufferIdx) const { return _store.getBufferState(bufferIdx); } bool validIndex(Index idx) const { return (idx.valid() && idx.offset() < _store.getBufferState(idx.bufferId()).size()); } - uint32_t getBufferIndex(btree::BufferState::State status); + uint32_t getBufferIndex(datastore::BufferState::State status); void postCompact(uint32_t newEnum); bool preCompact(uint64_t bytesNeeded); @@ -616,7 +616,7 @@ public: }; extern template class -btree::DataStoreT<btree::AlignedEntryRefT<31, 4> >; +datastore::DataStoreT<datastore::AlignedEntryRefT<31, 4> >; } diff --git a/searchlib/src/vespa/searchlib/attribute/i_document_weight_attribute.h b/searchlib/src/vespa/searchlib/attribute/i_document_weight_attribute.h index bf4a39b2492..0ee2ffaac1e 100644 --- a/searchlib/src/vespa/searchlib/attribute/i_document_weight_attribute.h +++ b/searchlib/src/vespa/searchlib/attribute/i_document_weight_attribute.h @@ -14,17 +14,17 @@ typedef btree::BTreeConstIterator<uint32_t, int32_t, btree::MinMaxAggregated, st struct IDocumentWeightAttribute { struct LookupResult { - const btree::EntryRef posting_idx; + const datastore::EntryRef posting_idx; const uint32_t posting_size; const int32_t min_weight; const int32_t max_weight; LookupResult() : posting_idx(), posting_size(0), min_weight(0), max_weight(0) {} - LookupResult(btree::EntryRef posting_idx_in, uint32_t posting_size_in, int32_t min_weight_in, int32_t max_weight_in) + LookupResult(datastore::EntryRef posting_idx_in, uint32_t posting_size_in, int32_t min_weight_in, int32_t max_weight_in) : posting_idx(posting_idx_in), posting_size(posting_size_in), min_weight(min_weight_in), max_weight(max_weight_in) {} }; virtual LookupResult lookup(const vespalib::string &term) const = 0; - virtual void create(btree::EntryRef idx, std::vector<DocumentWeightIterator> &dst) const = 0; - virtual DocumentWeightIterator create(btree::EntryRef idx) const = 0; + virtual void create(datastore::EntryRef idx, std::vector<DocumentWeightIterator> &dst) const = 0; + virtual DocumentWeightIterator create(datastore::EntryRef idx) const = 0; virtual ~IDocumentWeightAttribute() {} }; diff --git a/searchlib/src/vespa/searchlib/attribute/loadedvalue.h b/searchlib/src/vespa/searchlib/attribute/loadedvalue.h index baa8ecfe186..5a8d93d3cd9 100644 --- a/searchlib/src/vespa/searchlib/attribute/loadedvalue.h +++ b/searchlib/src/vespa/searchlib/attribute/loadedvalue.h @@ -60,7 +60,7 @@ public: EnumStoreBase::Index getEidx() const { - return EnumStoreBase::Index(btree::EntryRef(_value._eidx)); + return EnumStoreBase::Index(datastore::EntryRef(_value._eidx)); } void @@ -105,7 +105,7 @@ public: }; uint32_t _docId; uint32_t _idx; - btree::EntryRef _pidx; + datastore::EntryRef _pidx; private: int32_t _weight; Value _value; diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h index cc42f1e4445..9d8c57a63d2 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h @@ -32,8 +32,8 @@ private: const MultiValueNumericPostingAttribute &self; DocumentWeightAttributeAdapter(const MultiValueNumericPostingAttribute &self_in) : self(self_in) {} virtual LookupResult lookup(const vespalib::string &term) const override final; - virtual void create(btree::EntryRef idx, std::vector<DocumentWeightIterator> &dst) const override final; - virtual DocumentWeightIterator create(btree::EntryRef idx) const override final; + virtual void create(datastore::EntryRef idx, std::vector<DocumentWeightIterator> &dst) const override final; + virtual DocumentWeightIterator create(datastore::EntryRef idx) const override final; }; DocumentWeightAttributeAdapter _document_weight_attribute_adapter; diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp index c3e06976316..159ced0ee74 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp @@ -100,7 +100,7 @@ MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::lookup( dictItr.lower_bound(frozenDictionary.getRoot(), EnumIndex(), comp); if (dictItr.valid() && !comp(EnumIndex(), dictItr.getKey())) { - btree::EntryRef pidx = dictItr.getData(); + datastore::EntryRef pidx = dictItr.getData(); if (pidx.valid()) { const PostingList &plist = self.getPostingList(); auto minmax = plist.getAggregated(pidx); @@ -113,7 +113,7 @@ MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::lookup( template <typename B, typename M> void -MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::create(btree::EntryRef idx, std::vector<DocumentWeightIterator> &dst) const +MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::create(datastore::EntryRef idx, std::vector<DocumentWeightIterator> &dst) const { assert(idx.valid()); self.getPostingList().beginFrozen(idx, dst); @@ -121,7 +121,7 @@ MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::create( template <typename B, typename M> DocumentWeightIterator -MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::create(btree::EntryRef idx) const +MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::create(datastore::EntryRef idx) const { assert(idx.valid()); return self.getPostingList().beginFrozen(idx); diff --git a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h index 638e9b870e5..3ecdd128834 100644 --- a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h @@ -32,8 +32,8 @@ private: const MultiValueStringPostingAttributeT &self; DocumentWeightAttributeAdapter(const MultiValueStringPostingAttributeT &self_in) : self(self_in) {} virtual LookupResult lookup(const vespalib::string &term) const override final; - virtual void create(btree::EntryRef idx, std::vector<DocumentWeightIterator> &dst) const override final; - virtual DocumentWeightIterator create(btree::EntryRef idx) const override final; + virtual void create(datastore::EntryRef idx, std::vector<DocumentWeightIterator> &dst) const override final; + virtual DocumentWeightIterator create(datastore::EntryRef idx) const override final; }; DocumentWeightAttributeAdapter _document_weight_attribute_adapter; diff --git a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp index 62be248d60a..59d2e361691 100644 --- a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp @@ -111,7 +111,7 @@ MultiValueStringPostingAttributeT<B, T>::DocumentWeightAttributeAdapter::lookup( dictItr.lower_bound(frozenDictionary.getRoot(), EnumIndex(), comp); if (dictItr.valid() && !comp(EnumIndex(), dictItr.getKey())) { - btree::EntryRef pidx = dictItr.getData(); + datastore::EntryRef pidx = dictItr.getData(); if (pidx.valid()) { const PostingList &plist = self.getPostingList(); auto minmax = plist.getAggregated(pidx); @@ -123,7 +123,7 @@ MultiValueStringPostingAttributeT<B, T>::DocumentWeightAttributeAdapter::lookup( template <typename B, typename T> void -MultiValueStringPostingAttributeT<B, T>::DocumentWeightAttributeAdapter::create(btree::EntryRef idx, std::vector<DocumentWeightIterator> &dst) const +MultiValueStringPostingAttributeT<B, T>::DocumentWeightAttributeAdapter::create(datastore::EntryRef idx, std::vector<DocumentWeightIterator> &dst) const { assert(idx.valid()); self.getPostingList().beginFrozen(idx, dst); @@ -131,7 +131,7 @@ MultiValueStringPostingAttributeT<B, T>::DocumentWeightAttributeAdapter::create( template <typename B, typename M> DocumentWeightIterator -MultiValueStringPostingAttributeT<B, M>::DocumentWeightAttributeAdapter::create(btree::EntryRef idx) const +MultiValueStringPostingAttributeT<B, M>::DocumentWeightAttributeAdapter::create(datastore::EntryRef idx) const { assert(idx.valid()); return self.getPostingList().beginFrozen(idx); diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h index ace875a5ac2..e0bc704ee54 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h @@ -53,7 +53,7 @@ protected: typedef typename AggregationTraits::PostingList PostingList; typedef AttributeVector::DocId DocId; typedef std::map<EnumPostingPair, PostingChange<P> > PostingMap; - typedef btree::EntryRef EntryRef; + typedef datastore::EntryRef EntryRef; typedef attribute::LoadedEnumAttributeVector LoadedEnumAttributeVector; typedef EnumStoreBase::Index EnumIndex; PostingList _postingList; @@ -117,7 +117,7 @@ public: typedef typename Dictionary::Iterator DictionaryIterator; typedef EnumStoreBase::Index EnumIndex; typedef typename EnumStore::FoldedComparatorType FoldedComparatorType; - typedef btree::EntryRef EntryRef; + typedef datastore::EntryRef EntryRef; typedef typename Parent::PostingMap PostingMap; typedef typename Parent::PostingList PostingList; typedef typename PostingList::Iterator PostingIterator; diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h index 5eb8d1becd6..ed61fafdbe9 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h +++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h @@ -40,8 +40,8 @@ protected: uint64_t _numValues; // attr.getStatus().getNumValues(); bool _hasWeight; bool _useBitVector; - search::btree::EntryRef _pidx; - search::btree::EntryRef _frozenRoot; // Posting list in tree form + search::datastore::EntryRef _pidx; + search::datastore::EntryRef _frozenRoot; // Posting list in tree form float _FSTC; // Filtering Search Time Constant float _PLSTC; // Posting List Search Time Constant const EnumStoreBase &_esb; @@ -105,7 +105,7 @@ protected: typedef typename Traits::PostingList PostingList; typedef typename Traits::Posting Posting; typedef std::vector<Posting> PostingVector; - typedef btree::EntryRef EntryRef; + typedef datastore::EntryRef EntryRef; typedef typename PostingList::ConstIterator PostingConstIterator; const PostingList &_postingList; diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp index eab771a9eab..40cfd39388b 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp +++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp @@ -60,7 +60,7 @@ PostingListSearchContextT<DataT>::lookupSingle(void) getFrozenView(_postingList.getAllocator())); _frozenRoot = frozenView.getRoot(); if (!_frozenRoot.valid()) { - _pidx = btree::EntryRef(); + _pidx = datastore::EntryRef(); } } else { _gbv = bv; @@ -72,7 +72,7 @@ PostingListSearchContextT<DataT>::lookupSingle(void) getFrozenView(_postingList.getAllocator())); _frozenRoot = frozenView.getRoot(); if (!_frozenRoot.valid()) { - _pidx = btree::EntryRef(); + _pidx = datastore::EntryRef(); } } } diff --git a/searchlib/src/vespa/searchlib/attribute/postingstore.h b/searchlib/src/vespa/searchlib/attribute/postingstore.h index cc379731bf9..7c8692f97c4 100644 --- a/searchlib/src/vespa/searchlib/attribute/postingstore.h +++ b/searchlib/src/vespa/searchlib/attribute/postingstore.h @@ -20,7 +20,7 @@ class Config; class BitVectorEntry { public: - btree::EntryRef _tree; // Daisy chained reference to tree based posting list + datastore::EntryRef _tree; // Daisy chained reference to tree based posting list std::shared_ptr<GrowableBitVector> _bv; // bitvector public: @@ -70,7 +70,7 @@ template <typename DataT> class PostingStore : public PostingListTraits<DataT>::PostingStoreBase, public PostingStoreBase2 { - btree::BufferType<BitVectorEntry> _bvType; + datastore::BufferType<BitVectorEntry> _bvType; public: typedef DataT DataType; typedef typename PostingListTraits<DataT>::PostingStoreBase Parent; @@ -84,7 +84,7 @@ public: typedef typename Parent::AggregatedType AggregatedType; typedef typename Parent::BTreeTypeRefPair BTreeTypeRefPair; typedef typename Parent::Builder Builder; - typedef btree::EntryRef EntryRef; + typedef datastore::EntryRef EntryRef; typedef std::less<uint32_t> CompareT; using Parent::applyNewArray; using Parent::applyNewTree; diff --git a/searchlib/src/vespa/searchlib/btree/btreeiterator.h b/searchlib/src/vespa/searchlib/btree/btreeiterator.h index ef8c3babb25..588ca8d0ee0 100644 --- a/searchlib/src/vespa/searchlib/btree/btreeiterator.h +++ b/searchlib/src/vespa/searchlib/btree/btreeiterator.h @@ -719,6 +719,7 @@ public: using ParentType::_leafRoot; using ParentType::_compatLeafNode; using ParentType::end; + using EntryRef = datastore::EntryRef; BTreeIterator(BTreeNode::Ref root, const NodeAllocatorType &allocator) : ParentType(root, allocator) diff --git a/searchlib/src/vespa/searchlib/btree/btreenode.cpp b/searchlib/src/vespa/searchlib/btree/btreenode.cpp index 9b3d402cf53..58992c12def 100644 --- a/searchlib/src/vespa/searchlib/btree/btreenode.cpp +++ b/searchlib/src/vespa/searchlib/btree/btreenode.cpp @@ -21,7 +21,7 @@ template class BTreeKeyData<uint32_t, int32_t>; template class BTreeNodeT<uint32_t, 16>; template class BTreeNodeTT<uint32_t, uint32_t, NoAggregated, 16>; template class BTreeNodeTT<uint32_t, BTreeNoLeafData, NoAggregated, 16>; -template class BTreeNodeTT<uint32_t, EntryRef, NoAggregated, 16>; +template class BTreeNodeTT<uint32_t, datastore::EntryRef, NoAggregated, 16>; template class BTreeNodeTT<uint32_t, int32_t, MinMaxAggregated, 16>; template class BTreeInternalNode<uint32_t, NoAggregated, 16>; template class BTreeInternalNode<uint32_t, MinMaxAggregated, 16>; diff --git a/searchlib/src/vespa/searchlib/btree/btreenode.h b/searchlib/src/vespa/searchlib/btree/btreenode.h index bcf74a153bd..fadb3acdee3 100644 --- a/searchlib/src/vespa/searchlib/btree/btreenode.h +++ b/searchlib/src/vespa/searchlib/btree/btreenode.h @@ -10,14 +10,18 @@ #include <vespa/searchlib/datastore/entryref.h> namespace search { -namespace btree { +namespace datastore { -template <typename, typename, typename, size_t, size_t> -class BTreeNodeAllocator; -template <typename, typename, typename, size_t, size_t> class BTreeNodeStore; template <typename> class BufferType; template <typename> class DataStoreT; +} + +namespace btree { + +template <typename, typename, typename, size_t, size_t> class BTreeNodeAllocator; +template <typename, typename, typename, size_t, size_t> class BTreeNodeStore; + class NoAggregated; class BTreeNode { @@ -59,7 +63,7 @@ protected: } public: - typedef EntryRef Ref; + typedef datastore::EntryRef Ref; bool isLeaf() const { return _level == 0u; } @@ -485,9 +489,9 @@ public: template <typename, uint32_t> friend class BTreeNodeDataWrap; template <typename> - friend class BufferType; + friend class datastore::BufferType; template <typename> - friend class DataStoreT; + friend class datastore::DataStoreT; typedef BTreeNode::Ref Ref; typedef std::pair<Ref, InternalNodeType *> RefPair; using ParentType::_keys; @@ -641,9 +645,9 @@ public: template <typename, typename, typename, size_t, size_t> friend class BTreeNodeStore; template <typename> - friend class BufferType; + friend class datastore::BufferType; template <typename> - friend class DataStoreT; + friend class datastore::DataStoreT; typedef BTreeNode::Ref Ref; typedef std::pair<Ref, LeafNodeType *> RefPair; using ParentType::validSlots; @@ -765,7 +769,7 @@ extern template class BTreeKeyData<uint32_t, int32_t>; extern template class BTreeNodeT<uint32_t, 16>; extern template class BTreeNodeTT<uint32_t, uint32_t, NoAggregated, 16>; extern template class BTreeNodeTT<uint32_t, BTreeNoLeafData, NoAggregated, 16>; -extern template class BTreeNodeTT<uint32_t, EntryRef, NoAggregated, 16>; +extern template class BTreeNodeTT<uint32_t, datastore::EntryRef, NoAggregated, 16>; extern template class BTreeNodeTT<uint32_t, int32_t, MinMaxAggregated, 16>; extern template class BTreeInternalNode<uint32_t, NoAggregated, 16>; extern template class BTreeInternalNode<uint32_t, MinMaxAggregated, 16>; diff --git a/searchlib/src/vespa/searchlib/btree/btreenodeallocator.h b/searchlib/src/vespa/searchlib/btree/btreenodeallocator.h index 3029c287027..4a6b9b1d873 100644 --- a/searchlib/src/vespa/searchlib/btree/btreenodeallocator.h +++ b/searchlib/src/vespa/searchlib/btree/btreenodeallocator.h @@ -37,6 +37,8 @@ public: typedef vespalib::GenerationHandler::generation_t generation_t; typedef BTreeNodeStore<KeyT, DataT, AggrT, INTERNAL_SLOTS, LEAF_SLOTS> NodeStore; + using EntryRef = datastore::EntryRef; + using DataStoreBase = datastore::DataStoreBase; private: BTreeNodeAllocator(const BTreeNodeAllocator &rhs); diff --git a/searchlib/src/vespa/searchlib/btree/btreenodestore.cpp b/searchlib/src/vespa/searchlib/btree/btreenodestore.cpp index ec68cd09280..f8c2af64c2e 100644 --- a/searchlib/src/vespa/searchlib/btree/btreenodestore.cpp +++ b/searchlib/src/vespa/searchlib/btree/btreenodestore.cpp @@ -27,7 +27,6 @@ template class BTreeNodeStore<uint32_t, int32_t, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>; -typedef EntryRefT<22> MyRef; typedef BTreeNodeStore<uint32_t, uint32_t, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, @@ -39,76 +38,81 @@ typedef BTreeNodeStore<uint32_t, int32_t, MinMaxAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS> MyNodeStore3; -typedef BTreeLeafNode<uint32_t, uint32_t, NoAggregated> MyEntry1; -typedef BTreeLeafNode<uint32_t, BTreeNoLeafData, NoAggregated> MyEntry2; -typedef BTreeInternalNode<uint32_t, NoAggregated> MyEntry4; -typedef BTreeLeafNode<uint32_t, int32_t, MinMaxAggregated> MyEntry5; -typedef BTreeInternalNode<uint32_t, MinMaxAggregated> MyEntry6; +} // namespace btree + +namespace datastore { + +typedef EntryRefT<22> MyRef; +typedef btree::BTreeLeafNode<uint32_t, uint32_t, btree::NoAggregated> MyEntry1; +typedef btree::BTreeLeafNode<uint32_t, btree::BTreeNoLeafData, btree::NoAggregated> MyEntry2; +typedef btree::BTreeInternalNode<uint32_t, btree::NoAggregated> MyEntry4; +typedef btree::BTreeLeafNode<uint32_t, int32_t, btree::MinMaxAggregated> MyEntry5; +typedef btree::BTreeInternalNode<uint32_t, btree::MinMaxAggregated> MyEntry6; template std::pair<MyRef, MyEntry1 *> -DataStoreT<MyRef>::allocNewEntryCopy<MyEntry1>(uint32_t, const MyEntry1 &); +datastore::DataStoreT<MyRef>::allocNewEntryCopy<MyEntry1>(uint32_t, const MyEntry1 &); template std::pair<MyRef, MyEntry2 *> -DataStoreT<MyRef>::allocNewEntryCopy<MyEntry2>(uint32_t, const MyEntry2 &); +datastore::DataStoreT<MyRef>::allocNewEntryCopy<MyEntry2>(uint32_t, const MyEntry2 &); template std::pair<MyRef, MyEntry4 *> -DataStoreT<MyRef>::allocNewEntryCopy<MyEntry4>(uint32_t, const MyEntry4 &); +datastore::DataStoreT<MyRef>::allocNewEntryCopy<MyEntry4>(uint32_t, const MyEntry4 &); template std::pair<MyRef, MyEntry5 *> -DataStoreT<MyRef>::allocNewEntryCopy<MyEntry5>(uint32_t, const MyEntry5 &); +datastore::DataStoreT<MyRef>::allocNewEntryCopy<MyEntry5>(uint32_t, const MyEntry5 &); template std::pair<MyRef, MyEntry6 *> -DataStoreT<MyRef>::allocNewEntryCopy<MyEntry6>(uint32_t, const MyEntry6 &); +datastore::DataStoreT<MyRef>::allocNewEntryCopy<MyEntry6>(uint32_t, const MyEntry6 &); template std::pair<MyRef, MyEntry1 *> -DataStoreT<MyRef>::allocEntry<MyEntry1, BTreeNodeReclaimer>(uint32_t); +datastore::DataStoreT<MyRef>::allocEntry<MyEntry1, btree::BTreeNodeReclaimer>(uint32_t); template std::pair<MyRef, MyEntry2 *> -DataStoreT<MyRef>::allocEntry<MyEntry2, BTreeNodeReclaimer>(uint32_t); +datastore::DataStoreT<MyRef>::allocEntry<MyEntry2, btree::BTreeNodeReclaimer>(uint32_t); template std::pair<MyRef, MyEntry4 *> -DataStoreT<MyRef>::allocEntry<MyEntry4, BTreeNodeReclaimer>(uint32_t); +datastore::DataStoreT<MyRef>::allocEntry<MyEntry4, btree::BTreeNodeReclaimer>(uint32_t); template std::pair<MyRef, MyEntry5 *> -DataStoreT<MyRef>::allocEntry<MyEntry5, BTreeNodeReclaimer>(uint32_t); +datastore::DataStoreT<MyRef>::allocEntry<MyEntry5, btree::BTreeNodeReclaimer>(uint32_t); template std::pair<MyRef, MyEntry6 *> -DataStoreT<MyRef>::allocEntry<MyEntry6, BTreeNodeReclaimer>(uint32_t); +datastore::DataStoreT<MyRef>::allocEntry<MyEntry6, btree::BTreeNodeReclaimer>(uint32_t); template std::pair<MyRef, MyEntry1 *> -DataStoreT<MyRef>::allocEntryCopy<MyEntry1, BTreeNodeReclaimer>( +datastore::DataStoreT<MyRef>::allocEntryCopy<MyEntry1, btree::BTreeNodeReclaimer>( uint32_t, const MyEntry1 &); template std::pair<MyRef, MyEntry2 *> -DataStoreT<MyRef>::allocEntryCopy<MyEntry2, BTreeNodeReclaimer>( +datastore::DataStoreT<MyRef>::allocEntryCopy<MyEntry2, btree::BTreeNodeReclaimer>( uint32_t, const MyEntry2 &); template std::pair<MyRef, MyEntry4 *> -DataStoreT<MyRef>::allocEntryCopy<MyEntry4, BTreeNodeReclaimer>( +datastore::DataStoreT<MyRef>::allocEntryCopy<MyEntry4, btree::BTreeNodeReclaimer>( uint32_t, const MyEntry4 &); template std::pair<MyRef, MyEntry5 *> -DataStoreT<MyRef>::allocEntryCopy<MyEntry5, BTreeNodeReclaimer>( +datastore::DataStoreT<MyRef>::allocEntryCopy<MyEntry5, btree::BTreeNodeReclaimer>( uint32_t, const MyEntry5 &); template std::pair<MyRef, MyEntry6 *> -DataStoreT<MyRef>::allocEntryCopy<MyEntry6, BTreeNodeReclaimer>( +datastore::DataStoreT<MyRef>::allocEntryCopy<MyEntry6, btree::BTreeNodeReclaimer>( uint32_t, const MyEntry6 &); diff --git a/searchlib/src/vespa/searchlib/btree/btreenodestore.h b/searchlib/src/vespa/searchlib/btree/btreenodestore.h index 9b1b869302c..db93c680322 100644 --- a/searchlib/src/vespa/searchlib/btree/btreenodestore.h +++ b/searchlib/src/vespa/searchlib/btree/btreenodestore.h @@ -23,9 +23,9 @@ public: template <typename EntryType> -class BTreeNodeBufferType : public BufferType<EntryType> +class BTreeNodeBufferType : public datastore::BufferType<EntryType> { - typedef BufferType<EntryType> ParentType; + typedef datastore::BufferType<EntryType> ParentType; using ParentType::_emptyEntry; using ParentType::_clusterSize; public: @@ -52,13 +52,14 @@ template <typename KeyT, class BTreeNodeStore { public: - typedef DataStoreT<EntryRefT<22> > DataStoreType; + typedef datastore::DataStoreT<datastore::EntryRefT<22> > DataStoreType; typedef DataStoreType::RefType RefType; typedef BTreeInternalNode<KeyT, AggrT, INTERNAL_SLOTS> InternalNodeType; typedef BTreeLeafNode<KeyT, DataT, AggrT, LEAF_SLOTS> LeafNodeType; typedef typename InternalNodeType::RefPair InternalNodeTypeRefPair; typedef typename LeafNodeType::RefPair LeafNodeTypeRefPair; typedef vespalib::GenerationHandler::generation_t generation_t; + using EntryRef = datastore::EntryRef; enum NodeTypes { @@ -217,7 +218,7 @@ public: } // Inherit doc from DataStoreBase - DataStoreBase::MemStats getMemStats() const { + datastore::DataStoreBase::MemStats getMemStats() const { return _store.getMemStats(); } @@ -284,116 +285,120 @@ extern template class BTreeNodeStore<uint32_t, int32_t, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>; +} // namespace btree + +namespace datastore { + extern template -std::pair<EntryRefT<22>, BTreeLeafNode<uint32_t, uint32_t, NoAggregated> *> +std::pair<EntryRefT<22>, btree::BTreeLeafNode<uint32_t, uint32_t, btree::NoAggregated> *> DataStoreT<EntryRefT<22> >:: -allocNewEntryCopy<BTreeLeafNode<uint32_t, +allocNewEntryCopy<btree::BTreeLeafNode<uint32_t, uint32_t, - NoAggregated> > -(uint32_t, const BTreeLeafNode<uint32_t, uint32_t, NoAggregated> &); + btree::NoAggregated> > +(uint32_t, const btree::BTreeLeafNode<uint32_t, uint32_t, btree::NoAggregated> &); extern template -std::pair<EntryRefT<22>, BTreeLeafNode<uint32_t, BTreeNoLeafData, - NoAggregated> *> +std::pair<EntryRefT<22>, btree::BTreeLeafNode<uint32_t, btree::BTreeNoLeafData, + btree::NoAggregated> *> DataStoreT<EntryRefT<22> >:: -allocNewEntryCopy<BTreeLeafNode<uint32_t, BTreeNoLeafData, NoAggregated> >( +allocNewEntryCopy<btree::BTreeLeafNode<uint32_t, btree::BTreeNoLeafData, btree::NoAggregated> >( uint32_t, - const BTreeLeafNode<uint32_t, BTreeNoLeafData, NoAggregated> &); + const btree::BTreeLeafNode<uint32_t, btree::BTreeNoLeafData, btree::NoAggregated> &); extern template -std::pair<EntryRefT<22>, BTreeInternalNode<uint32_t, NoAggregated> *> +std::pair<EntryRefT<22>, btree::BTreeInternalNode<uint32_t, btree::NoAggregated> *> DataStoreT<EntryRefT<22> >:: -allocNewEntryCopy<BTreeInternalNode<uint32_t, NoAggregated> >( - uint32_t, const BTreeInternalNode<uint32_t, NoAggregated> &); +allocNewEntryCopy<btree::BTreeInternalNode<uint32_t, btree::NoAggregated> >( + uint32_t, const btree::BTreeInternalNode<uint32_t, btree::NoAggregated> &); extern template -std::pair<EntryRefT<22>, BTreeLeafNode<uint32_t, int32_t, MinMaxAggregated> *> +std::pair<EntryRefT<22>, btree::BTreeLeafNode<uint32_t, int32_t, btree::MinMaxAggregated> *> DataStoreT<EntryRefT<22> >:: -allocNewEntryCopy<BTreeLeafNode<uint32_t, +allocNewEntryCopy<btree::BTreeLeafNode<uint32_t, int32_t, - MinMaxAggregated> > -(uint32_t, const BTreeLeafNode<uint32_t, int32_t, MinMaxAggregated> &); + btree::MinMaxAggregated> > +(uint32_t, const btree::BTreeLeafNode<uint32_t, int32_t, btree::MinMaxAggregated> &); extern template -std::pair<EntryRefT<22>, BTreeInternalNode<uint32_t, MinMaxAggregated> *> +std::pair<EntryRefT<22>, btree::BTreeInternalNode<uint32_t, btree::MinMaxAggregated> *> DataStoreT<EntryRefT<22> >:: -allocNewEntryCopy<BTreeInternalNode<uint32_t, MinMaxAggregated> >( - uint32_t, const BTreeInternalNode<uint32_t, MinMaxAggregated> &); +allocNewEntryCopy<btree::BTreeInternalNode<uint32_t, btree::MinMaxAggregated> >( + uint32_t, const btree::BTreeInternalNode<uint32_t, btree::MinMaxAggregated> &); extern template -std::pair<EntryRefT<22>, BTreeLeafNode<uint32_t, uint32_t, NoAggregated> *> +std::pair<EntryRefT<22>, btree::BTreeLeafNode<uint32_t, uint32_t, btree::NoAggregated> *> DataStoreT<EntryRefT<22> >:: -allocEntry<BTreeLeafNode<uint32_t, uint32_t, NoAggregated>, - BTreeNodeReclaimer>(uint32_t); +allocEntry<btree::BTreeLeafNode<uint32_t, uint32_t, btree::NoAggregated>, + btree::BTreeNodeReclaimer>(uint32_t); extern template -std::pair<EntryRefT<22>, BTreeLeafNode<uint32_t, BTreeNoLeafData, - NoAggregated> *> +std::pair<EntryRefT<22>, btree::BTreeLeafNode<uint32_t, btree::BTreeNoLeafData, + btree::NoAggregated> *> DataStoreT<EntryRefT<22> >:: -allocEntry<BTreeLeafNode<uint32_t, BTreeNoLeafData, NoAggregated>, - BTreeNodeReclaimer>(uint32_t); +allocEntry<btree::BTreeLeafNode<uint32_t, btree::BTreeNoLeafData, btree::NoAggregated>, + btree::BTreeNodeReclaimer>(uint32_t); extern template -std::pair<EntryRefT<22>, BTreeInternalNode<uint32_t, NoAggregated> *> +std::pair<EntryRefT<22>, btree::BTreeInternalNode<uint32_t, btree::NoAggregated> *> DataStoreT<EntryRefT<22> >:: -allocEntry<BTreeInternalNode<uint32_t, NoAggregated>, - BTreeNodeReclaimer>(uint32_t); +allocEntry<btree::BTreeInternalNode<uint32_t, btree::NoAggregated>, + btree::BTreeNodeReclaimer>(uint32_t); extern template -std::pair<EntryRefT<22>, BTreeLeafNode<uint32_t, int32_t, MinMaxAggregated> *> +std::pair<EntryRefT<22>, btree::BTreeLeafNode<uint32_t, int32_t, btree::MinMaxAggregated> *> DataStoreT<EntryRefT<22> >:: -allocEntry<BTreeLeafNode<uint32_t, int32_t, MinMaxAggregated>, - BTreeNodeReclaimer>(uint32_t); +allocEntry<btree::BTreeLeafNode<uint32_t, int32_t, btree::MinMaxAggregated>, + btree::BTreeNodeReclaimer>(uint32_t); extern template -std::pair<EntryRefT<22>, BTreeInternalNode<uint32_t, MinMaxAggregated> *> +std::pair<EntryRefT<22>, btree::BTreeInternalNode<uint32_t, btree::MinMaxAggregated> *> DataStoreT<EntryRefT<22> >:: -allocEntry<BTreeInternalNode<uint32_t, MinMaxAggregated>, - BTreeNodeReclaimer>(uint32_t); +allocEntry<btree::BTreeInternalNode<uint32_t, btree::MinMaxAggregated>, + btree::BTreeNodeReclaimer>(uint32_t); extern template -std::pair<EntryRefT<22>, BTreeLeafNode<uint32_t, uint32_t, NoAggregated> *> +std::pair<EntryRefT<22>, btree::BTreeLeafNode<uint32_t, uint32_t, btree::NoAggregated> *> DataStoreT<EntryRefT<22> >:: -allocEntryCopy<BTreeLeafNode<uint32_t, uint32_t, NoAggregated>, - BTreeNodeReclaimer>( +allocEntryCopy<btree::BTreeLeafNode<uint32_t, uint32_t, btree::NoAggregated>, + btree::BTreeNodeReclaimer>( uint32_t, - const BTreeLeafNode<uint32_t, uint32_t, - NoAggregated> &); + const btree::BTreeLeafNode<uint32_t, uint32_t, + btree::NoAggregated> &); extern template -std::pair<EntryRefT<22>, BTreeLeafNode<uint32_t, BTreeNoLeafData, - NoAggregated> *> +std::pair<EntryRefT<22>, btree::BTreeLeafNode<uint32_t, btree::BTreeNoLeafData, + btree::NoAggregated> *> DataStoreT<EntryRefT<22> >:: -allocEntryCopy<BTreeLeafNode<uint32_t, BTreeNoLeafData, NoAggregated>, - BTreeNodeReclaimer>( +allocEntryCopy<btree::BTreeLeafNode<uint32_t, btree::BTreeNoLeafData, btree::NoAggregated>, + btree::BTreeNodeReclaimer>( uint32_t, - const BTreeLeafNode<uint32_t, BTreeNoLeafData, - NoAggregated> &); + const btree::BTreeLeafNode<uint32_t, btree::BTreeNoLeafData, + btree::NoAggregated> &); extern template -std::pair<EntryRefT<22>, BTreeInternalNode<uint32_t, NoAggregated> *> +std::pair<EntryRefT<22>, btree::BTreeInternalNode<uint32_t, btree::NoAggregated> *> DataStoreT<EntryRefT<22> >:: -allocEntryCopy<BTreeInternalNode<uint32_t, NoAggregated>, BTreeNodeReclaimer>( - uint32_t, const BTreeInternalNode<uint32_t, NoAggregated> &); +allocEntryCopy<btree::BTreeInternalNode<uint32_t, btree::NoAggregated>, btree::BTreeNodeReclaimer>( + uint32_t, const btree::BTreeInternalNode<uint32_t, btree::NoAggregated> &); extern template -std::pair<EntryRefT<22>, BTreeLeafNode<uint32_t, int32_t, MinMaxAggregated> *> +std::pair<EntryRefT<22>, btree::BTreeLeafNode<uint32_t, int32_t, btree::MinMaxAggregated> *> DataStoreT<EntryRefT<22> >:: -allocEntryCopy<BTreeLeafNode<uint32_t, int32_t, MinMaxAggregated>, - BTreeNodeReclaimer>( +allocEntryCopy<btree::BTreeLeafNode<uint32_t, int32_t, btree::MinMaxAggregated>, + btree::BTreeNodeReclaimer>( uint32_t, - const BTreeLeafNode<uint32_t, int32_t, - MinMaxAggregated> &); + const btree::BTreeLeafNode<uint32_t, int32_t, + btree::MinMaxAggregated> &); extern template -std::pair<EntryRefT<22>, BTreeInternalNode<uint32_t, MinMaxAggregated> *> +std::pair<EntryRefT<22>, btree::BTreeInternalNode<uint32_t, btree::MinMaxAggregated> *> DataStoreT<EntryRefT<22> >:: -allocEntryCopy<BTreeInternalNode<uint32_t, MinMaxAggregated>, - BTreeNodeReclaimer>( - uint32_t, const BTreeInternalNode<uint32_t, MinMaxAggregated> &); +allocEntryCopy<btree::BTreeInternalNode<uint32_t, btree::MinMaxAggregated>, + btree::BTreeNodeReclaimer>( + uint32_t, const btree::BTreeInternalNode<uint32_t, btree::MinMaxAggregated> &); -} // namespace btree +} // namespace datastore } // namespace search diff --git a/searchlib/src/vespa/searchlib/btree/btreestore.h b/searchlib/src/vespa/searchlib/btree/btreestore.h index eeac46ceaf7..d9b9f100e16 100644 --- a/searchlib/src/vespa/searchlib/btree/btreestore.h +++ b/searchlib/src/vespa/searchlib/btree/btreestore.h @@ -27,7 +27,7 @@ public: typedef KeyT KeyType; typedef DataT DataType; typedef AggrT AggregatedType; - typedef DataStoreT<EntryRefT<22> > DataStoreType; + typedef datastore::DataStoreT<datastore::EntryRefT<22> > DataStoreType; typedef DataStoreType::RefType RefType; typedef BTreeKeyData<KeyT, DataT> KeyDataType; @@ -37,8 +37,8 @@ public: TraitsT::INTERNAL_SLOTS> InternalNodeType; typedef BTreeLeafNode<KeyT, DataT, AggrT, TraitsT::LEAF_SLOTS> LeafNodeType; - typedef std::pair<EntryRef, BTreeType *> BTreeTypeRefPair; - typedef std::pair<EntryRef, KeyDataType *> KeyDataTypeRefPair; + typedef std::pair<datastore::EntryRef, BTreeType *> BTreeTypeRefPair; + typedef std::pair<datastore::EntryRef, KeyDataType *> KeyDataTypeRefPair; typedef typename InternalNodeType::RefPair InternalNodeTypeRefPair; typedef typename LeafNodeType::RefPair LeafNodeTypeRefPair; typedef vespalib::GenerationHandler::generation_t generation_t; @@ -53,6 +53,10 @@ public: TraitsT::INTERNAL_SLOTS, TraitsT::LEAF_SLOTS, AggrCalcT> Builder; + using EntryRef = datastore::EntryRef; + template <typename EntryType> + using BufferType = datastore::BufferType<EntryType>; + using BufferState = datastore::BufferState; static constexpr uint32_t clusterLimit = 8; diff --git a/searchlib/src/vespa/searchlib/datastore/bufferstate.cpp b/searchlib/src/vespa/searchlib/datastore/bufferstate.cpp index 31e3a6c3e3f..51ec0860c8b 100644 --- a/searchlib/src/vespa/searchlib/datastore/bufferstate.cpp +++ b/searchlib/src/vespa/searchlib/datastore/bufferstate.cpp @@ -6,8 +6,7 @@ using vespalib::alloc::Alloc; namespace search { - -namespace btree { +namespace datastore { BufferTypeBase::BufferTypeBase(uint32_t clusterSize, uint32_t minClusters, @@ -341,7 +340,6 @@ BufferState::fallbackResize(uint64_t newSize, std::atomic_thread_fence(std::memory_order_release); } -} // namespace btree - +} // namespace datastore } // namespace search diff --git a/searchlib/src/vespa/searchlib/datastore/bufferstate.h b/searchlib/src/vespa/searchlib/datastore/bufferstate.h index bbb8f77d5ef..adaea297970 100644 --- a/searchlib/src/vespa/searchlib/datastore/bufferstate.h +++ b/searchlib/src/vespa/searchlib/datastore/bufferstate.h @@ -11,7 +11,7 @@ #include <vespa/vespalib/util/generationhandler.h> namespace search { -namespace btree { +namespace datastore { class BufferTypeBase { @@ -262,6 +262,6 @@ private: }; -} // namespace search::btree +} // namespace search::datastore } // namespace search diff --git a/searchlib/src/vespa/searchlib/datastore/datastore.cpp b/searchlib/src/vespa/searchlib/datastore/datastore.cpp index 4af74d6f861..e39d29ef9a9 100644 --- a/searchlib/src/vespa/searchlib/datastore/datastore.cpp +++ b/searchlib/src/vespa/searchlib/datastore/datastore.cpp @@ -3,14 +3,10 @@ #include "datastore.h" #include "datastore.hpp" -namespace search -{ - -namespace btree -{ +namespace search { +namespace datastore { template class DataStoreT<EntryRefT<22> >; -} // namespace btree - +} // namespace datastore } // namespace search diff --git a/searchlib/src/vespa/searchlib/datastore/datastore.h b/searchlib/src/vespa/searchlib/datastore/datastore.h index 19ec68a550f..36928e3426b 100644 --- a/searchlib/src/vespa/searchlib/datastore/datastore.h +++ b/searchlib/src/vespa/searchlib/datastore/datastore.h @@ -4,19 +4,20 @@ #include "datastorebase.h" -namespace search -{ - -namespace btree -{ +namespace search { +namespace btree { -template <typename EntryType> +template<typename EntryType> struct DefaultReclaimer { - static void reclaim(EntryType * entry) { + static void reclaim(EntryType *entry) { (void) entry; } }; +} // namespace btree + +namespace datastore { + template <typename RefT = EntryRefT<22> > class DataStoreT : public DataStoreBase { @@ -133,6 +134,6 @@ public: extern template class DataStoreT<EntryRefT<22> >; -} // namespace search::btree +} // namespace search::datastore } // namespace search diff --git a/searchlib/src/vespa/searchlib/datastore/datastore.hpp b/searchlib/src/vespa/searchlib/datastore/datastore.hpp index 64e55b840fa..4334de34013 100644 --- a/searchlib/src/vespa/searchlib/datastore/datastore.hpp +++ b/searchlib/src/vespa/searchlib/datastore/datastore.hpp @@ -4,12 +4,8 @@ #include "datastore.h" -namespace search -{ - -namespace btree -{ - +namespace search { +namespace datastore { template <typename RefT> DataStoreT<RefT>::DataStoreT(void) @@ -243,6 +239,6 @@ DataStore<EntryType, RefT>::getEntry(EntryRef ref) const extern template class DataStoreT<EntryRefT<22> >; -} // namespace search::btree +} // namespace search::datastore } // namespace search diff --git a/searchlib/src/vespa/searchlib/datastore/datastorebase.cpp b/searchlib/src/vespa/searchlib/datastore/datastorebase.cpp index 45c68630773..26663895c09 100644 --- a/searchlib/src/vespa/searchlib/datastore/datastorebase.cpp +++ b/searchlib/src/vespa/searchlib/datastore/datastorebase.cpp @@ -4,14 +4,10 @@ using vespalib::GenerationHeldBase; -namespace search -{ +namespace search { +namespace datastore { -namespace btree -{ - -namespace -{ +namespace { /* * Minimum dead bytes in active write buffer before switching to new @@ -421,6 +417,5 @@ DataStoreBase::startCompactWorstBuffer(uint32_t typeId) } -} // namespace btree - +} // namespace datastore } // namespace search diff --git a/searchlib/src/vespa/searchlib/datastore/datastorebase.h b/searchlib/src/vespa/searchlib/datastore/datastorebase.h index f948ada3d2f..ff6bc71d5b8 100644 --- a/searchlib/src/vespa/searchlib/datastore/datastorebase.h +++ b/searchlib/src/vespa/searchlib/datastore/datastorebase.h @@ -8,12 +8,8 @@ #include <vespa/vespalib/util/generationholder.h> #include <vespa/searchlib/util/memoryusage.h> - -namespace search -{ - -namespace btree -{ +namespace search { +namespace datastore { class DataStoreBase { @@ -398,7 +394,6 @@ public: }; -} // namespace btree - +} // namespace datastore } // namespace search diff --git a/searchlib/src/vespa/searchlib/datastore/entryref.h b/searchlib/src/vespa/searchlib/datastore/entryref.h index e2d2a8d89ba..40b1053757f 100644 --- a/searchlib/src/vespa/searchlib/datastore/entryref.h +++ b/searchlib/src/vespa/searchlib/datastore/entryref.h @@ -5,7 +5,7 @@ #include <stdint.h> namespace search { -namespace btree { +namespace datastore { class EntryRef { protected: @@ -59,6 +59,6 @@ public: static uint64_t pad(uint64_t val) { return (-val & PadConstant); } }; -} // namespace search::btree +} // namespace search::datastore } // namespace search diff --git a/searchlib/src/vespa/searchlib/memoryindex/compact_document_words_store.cpp b/searchlib/src/vespa/searchlib/memoryindex/compact_document_words_store.cpp index 05f242b0928..f10e872daeb 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/compact_document_words_store.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/compact_document_words_store.cpp @@ -35,7 +35,7 @@ serialize(const Builder &builder, uint32_t *begin) } CompactDocumentWordsStore::Builder & -CompactDocumentWordsStore::Builder::insert(btree::EntryRef wordRef) +CompactDocumentWordsStore::Builder::insert(datastore::EntryRef wordRef) { _words.push_back(wordRef); return *this; @@ -97,14 +97,14 @@ CompactDocumentWordsStore::Store::~Store() _store.dropBuffers(); } -btree::EntryRef +datastore::EntryRef CompactDocumentWordsStore::Store::insert(const Builder &builder) { size_t serializedSize = getSerializedSize(builder); _store.ensureBufferCapacity(_typeId, serializedSize); uint32_t activeBufferId = _store.getActiveBufferId(_typeId); - btree::BufferState &state = _store.getBufferState(activeBufferId); + datastore::BufferState &state = _store.getBufferState(activeBufferId); size_t oldSize = state.size(); RefType ref(oldSize, activeBufferId); assert(oldSize == ref.offset()); @@ -118,7 +118,7 @@ CompactDocumentWordsStore::Store::insert(const Builder &builder) } CompactDocumentWordsStore::Iterator -CompactDocumentWordsStore::Store::get(btree::EntryRef ref) const +CompactDocumentWordsStore::Store::get(datastore::EntryRef ref) const { RefType internalRef(ref); const uint32_t *buf = _store.getBufferEntry<uint32_t>(internalRef.bufferId(), @@ -135,7 +135,7 @@ CompactDocumentWordsStore::CompactDocumentWordsStore() void CompactDocumentWordsStore::insert(const Builder &builder) { - btree::EntryRef ref = _wordsStore.insert(builder); + datastore::EntryRef ref = _wordsStore.insert(builder); auto insres = _docs.insert(std::make_pair(builder.docId(), ref)); if (!insres.second) { LOG(error, "Failed inserting remove info for docid %u", diff --git a/searchlib/src/vespa/searchlib/memoryindex/compact_document_words_store.h b/searchlib/src/vespa/searchlib/memoryindex/compact_document_words_store.h index ccddd9bd7cb..566dd918edb 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/compact_document_words_store.h +++ b/searchlib/src/vespa/searchlib/memoryindex/compact_document_words_store.h @@ -26,7 +26,7 @@ public: { public: typedef std::unique_ptr<Builder> UP; - typedef vespalib::Array<btree::EntryRef> WordRefVector; + typedef vespalib::Array<datastore::EntryRef> WordRefVector; private: uint32_t _docId; @@ -34,7 +34,7 @@ public: public: Builder(uint32_t docId_) : _docId(docId_), _words() {} - Builder &insert(btree::EntryRef wordRef); + Builder &insert(datastore::EntryRef wordRef); uint32_t docId() const { return _docId; } const WordRefVector &words() const { return _words; } }; @@ -57,7 +57,7 @@ public: Iterator(const uint32_t *buf); bool valid() const { return _valid; } Iterator &operator++(); - btree::EntryRef wordRef() const { return _wordRef; } + datastore::EntryRef wordRef() const { return _wordRef; } bool hasBackingBuf() const { return _buf != nullptr; } }; @@ -67,23 +67,23 @@ public: class Store { public: - typedef btree::DataStoreT<btree::EntryRefT<22> > DataStoreType; + typedef datastore::DataStoreT<datastore::EntryRefT<22> > DataStoreType; typedef DataStoreType::RefType RefType; private: DataStoreType _store; - btree::BufferType<uint32_t> _type; + datastore::BufferType<uint32_t> _type; const uint32_t _typeId; public: Store(); ~Store(); - btree::EntryRef insert(const Builder &builder); - Iterator get(btree::EntryRef ref) const; + datastore::EntryRef insert(const Builder &builder); + Iterator get(datastore::EntryRef ref) const; MemoryUsage getMemoryUsage() const { return _store.getMemoryUsage(); } }; - typedef vespalib::hash_map<uint32_t, btree::EntryRef> DocumentWordsMap; + typedef vespalib::hash_map<uint32_t, datastore::EntryRef> DocumentWordsMap; private: DocumentWordsMap _docs; diff --git a/searchlib/src/vespa/searchlib/memoryindex/document_remover.cpp b/searchlib/src/vespa/searchlib/memoryindex/document_remover.cpp index 9119b9aa518..ee4938da59f 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/document_remover.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/document_remover.cpp @@ -36,7 +36,7 @@ DocumentRemover::remove(uint32_t docId, IDocumentRemoveListener &listener) } void -DocumentRemover::insert(btree::EntryRef wordRef, uint32_t docId) +DocumentRemover::insert(datastore::EntryRef wordRef, uint32_t docId) { _wordFieldDocTuples.emplace_back(wordRef, docId); } diff --git a/searchlib/src/vespa/searchlib/memoryindex/document_remover.h b/searchlib/src/vespa/searchlib/memoryindex/document_remover.h index d08cf46c68e..d9435ed4fb2 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/document_remover.h +++ b/searchlib/src/vespa/searchlib/memoryindex/document_remover.h @@ -18,13 +18,13 @@ class DocumentRemover : public IDocumentInsertListener private: struct WordFieldDocTuple { - btree::EntryRef _wordRef; + datastore::EntryRef _wordRef; uint32_t _docId; WordFieldDocTuple() : _wordRef(0), _docId(0) { } - WordFieldDocTuple(btree::EntryRef wordRef, uint32_t docId) : + WordFieldDocTuple(datastore::EntryRef wordRef, uint32_t docId) : _wordRef(wordRef), _docId(docId) { } @@ -54,7 +54,7 @@ public: const CompactDocumentWordsStore &getStore() const { return _store; } // Implements IDocumentInsertListener - void insert(btree::EntryRef wordRef, uint32_t docId) override; + void insert(datastore::EntryRef wordRef, uint32_t docId) override; void flush() override; }; diff --git a/searchlib/src/vespa/searchlib/memoryindex/featurestore.cpp b/searchlib/src/vespa/searchlib/memoryindex/featurestore.cpp index 2d501ad9488..cec2098b548 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/featurestore.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/featurestore.cpp @@ -35,13 +35,13 @@ FeatureStore::writeFeatures(uint32_t packedIndex, } -btree::EntryRef +datastore::EntryRef FeatureStore::addFeatures(const uint8_t *src, uint64_t byteLen) { uint32_t pad = RefType::pad(byteLen); _store.ensureBufferCapacity(_typeId, byteLen + pad + DECODE_SAFETY); uint32_t activeBufferId = _store.getActiveBufferId(_typeId); - btree::BufferState &state = _store.getBufferState(activeBufferId); + datastore::BufferState &state = _store.getBufferState(activeBufferId); size_t oldSize = state.size(); RefType ref(oldSize, activeBufferId); uint8_t * dst = _store.getBufferEntry<uint8_t>(activeBufferId, oldSize); @@ -57,7 +57,7 @@ FeatureStore::addFeatures(const uint8_t *src, uint64_t byteLen) } -std::pair<btree::EntryRef, uint64_t> +std::pair<datastore::EntryRef, uint64_t> FeatureStore::addFeatures(uint64_t beginOffset, uint64_t endOffset) { uint64_t bitLen = (endOffset - beginOffset); @@ -72,8 +72,8 @@ FeatureStore::addFeatures(uint64_t beginOffset, uint64_t endOffset) } -btree::EntryRef -FeatureStore::moveFeatures(btree::EntryRef ref, uint64_t bitLen) +datastore::EntryRef +FeatureStore::moveFeatures(datastore::EntryRef ref, uint64_t bitLen) { const uint8_t *src = getBits(ref); uint64_t byteLen = (bitLen + 7) / 8; @@ -116,7 +116,7 @@ FeatureStore::~FeatureStore(void) } -std::pair<btree::EntryRef, uint64_t> +std::pair<datastore::EntryRef, uint64_t> FeatureStore::addFeatures(uint32_t packedIndex, const DocIdAndFeatures &features) { @@ -129,7 +129,7 @@ FeatureStore::addFeatures(uint32_t packedIndex, void -FeatureStore::getFeatures(uint32_t packedIndex, btree::EntryRef ref, +FeatureStore::getFeatures(uint32_t packedIndex, datastore::EntryRef ref, DocIdAndFeatures &features) { setupForField(packedIndex, _d); @@ -139,7 +139,7 @@ FeatureStore::getFeatures(uint32_t packedIndex, btree::EntryRef ref, size_t -FeatureStore::bitSize(uint32_t packedIndex, btree::EntryRef ref) +FeatureStore::bitSize(uint32_t packedIndex, datastore::EntryRef ref) { setupForField(packedIndex, _d); setupForUnpackFeatures(ref, _d); @@ -152,9 +152,9 @@ FeatureStore::bitSize(uint32_t packedIndex, btree::EntryRef ref) } -btree::EntryRef +datastore::EntryRef FeatureStore::moveFeatures(uint32_t packedIndex, - btree::EntryRef ref) + datastore::EntryRef ref) { uint64_t bitLen = bitSize(packedIndex, ref); return moveFeatures(ref, bitLen); diff --git a/searchlib/src/vespa/searchlib/memoryindex/featurestore.h b/searchlib/src/vespa/searchlib/memoryindex/featurestore.h index aaad7c09dd7..651997d2dfb 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/featurestore.h +++ b/searchlib/src/vespa/searchlib/memoryindex/featurestore.h @@ -14,7 +14,7 @@ namespace memoryindex { class FeatureStore { public: - typedef btree::DataStoreT<btree::AlignedEntryRefT<22, 2> > DataStoreType; + typedef datastore::DataStoreT<datastore::AlignedEntryRefT<22, 2> > DataStoreType; typedef DataStoreType::RefType RefType; typedef bitcompression::EG2PosOccEncodeContext<true> EncodeContext; typedef bitcompression::EG2PosOccDecodeContextCooked<true> @@ -44,7 +44,7 @@ private: const Schema &_schema; - btree::BufferType<uint8_t> _type; + datastore::BufferType<uint8_t> _type; const uint32_t _typeId; /** @@ -64,7 +64,7 @@ private: * @param byteLen the byte length of the buffer * @return the entry ref for the added features */ - btree::EntryRef + datastore::EntryRef addFeatures(const uint8_t * src, uint64_t byteLen); /** @@ -74,7 +74,7 @@ private: * @param endOffset the end offset into the encode context * @return the entry ref and bit length of the features */ - std::pair<btree::EntryRef, uint64_t> + std::pair<datastore::EntryRef, uint64_t> addFeatures(uint64_t beginOffset, uint64_t endOffset); /** @@ -84,7 +84,7 @@ private: * @param bitLen bit length of features to move * @return new reference to stored features */ - btree::EntryRef moveFeatures(btree::EntryRef ref, uint64_t bitLen); + datastore::EntryRef moveFeatures(datastore::EntryRef ref, uint64_t bitLen); public: @@ -107,7 +107,7 @@ public: * @return pair with reference to stored features and * size of encoded features in bits */ - std::pair<btree::EntryRef, uint64_t> + std::pair<datastore::EntryRef, uint64_t> addFeatures(uint32_t packedIndex, const DocIdAndFeatures &features); @@ -122,7 +122,7 @@ public: */ void getFeatures(uint32_t packedIndex, - btree::EntryRef ref, + datastore::EntryRef ref, DocIdAndFeatures &features); @@ -147,12 +147,12 @@ public: * @param decoder The feature decoder */ void - setupForReadFeatures(btree::EntryRef ref, DecodeContextCooked &decoder) const + setupForReadFeatures(datastore::EntryRef ref, DecodeContextCooked &decoder) const { const uint8_t * bits = getBits(ref); decoder.setByteCompr(bits); uint32_t bufferId = RefType(ref).bufferId(); - const btree::BufferState &state = _store.getBufferState(bufferId); + const datastore::BufferState &state = _store.getBufferState(bufferId); decoder.setEnd( ((_store.getBufferEntry<uint8_t>(bufferId, state.size()) - bits) + 7) / 8, @@ -167,7 +167,7 @@ public: * @param decoder The feature decoder */ void - setupForUnpackFeatures(btree::EntryRef ref, DecodeContextCooked &decoder) const + setupForUnpackFeatures(datastore::EntryRef ref, DecodeContextCooked &decoder) const { decoder.setByteCompr(getBits(ref)); } @@ -181,7 +181,7 @@ public: * @return size of features in bits */ size_t - bitSize(uint32_t packedIndex, btree::EntryRef ref); + bitSize(uint32_t packedIndex, datastore::EntryRef ref); /** * Get byte address of stored features @@ -190,7 +190,7 @@ public: * @return byte address of stored features */ const uint8_t * - getBits(btree::EntryRef ref) const + getBits(datastore::EntryRef ref) const { RefType iRef(ref); return _store.getBufferEntry<uint8_t>(iRef.bufferId(), iRef.offset()); @@ -203,9 +203,9 @@ public: * @param ref Old reference to stored features * @return New reference to stored features */ - btree::EntryRef + datastore::EntryRef moveFeatures(uint32_t packedIndex, - btree::EntryRef ref); + datastore::EntryRef ref); /** * Return a const view of the fields params used by this feature store. @@ -260,7 +260,7 @@ public: } // Inherit doc from DataStoreBase - btree::DataStoreBase::MemStats + datastore::DataStoreBase::MemStats getMemStats() const { return _store.getMemStats(); diff --git a/searchlib/src/vespa/searchlib/memoryindex/i_document_insert_listener.h b/searchlib/src/vespa/searchlib/memoryindex/i_document_insert_listener.h index 7f4b3484bcd..6172f8f21d9 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/i_document_insert_listener.h +++ b/searchlib/src/vespa/searchlib/memoryindex/i_document_insert_listener.h @@ -13,7 +13,7 @@ class IDocumentInsertListener { public: virtual ~IDocumentInsertListener() {} - virtual void insert(btree::EntryRef wordRef, uint32_t docId) = 0; + virtual void insert(datastore::EntryRef wordRef, uint32_t docId) = 0; virtual void flush() = 0; }; diff --git a/searchlib/src/vespa/searchlib/memoryindex/memoryfieldindex.cpp b/searchlib/src/vespa/searchlib/memoryindex/memoryfieldindex.cpp index ba0c8e95efa..88602a365ae 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/memoryfieldindex.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/memoryfieldindex.cpp @@ -49,12 +49,12 @@ MemoryFieldIndex::~MemoryFieldIndex(void) // XXX: Kludge for (DictionaryTree::Iterator it = _dict.begin(); it.valid(); ++it) { - btree::EntryRef pidx(it.getData()); + datastore::EntryRef pidx(it.getData()); if (pidx.valid()) { _postingListStore.clear(pidx); // Before updating ref std::atomic_thread_fence(std::memory_order_release); - it.writeData(btree::EntryRef().ref()); + it.writeData(datastore::EntryRef().ref()); } } _postingListStore.clearBuilder(); @@ -71,7 +71,7 @@ MemoryFieldIndex::PostingList::Iterator MemoryFieldIndex::find(const vespalib::stringref word) const { DictionaryTree::Iterator itr = - _dict.find(WordKey(btree::EntryRef()), + _dict.find(WordKey(datastore::EntryRef()), KeyComp(_wordStore, word)); if (itr.valid()) { return _postingListStore.begin(itr.getData()); @@ -83,7 +83,7 @@ MemoryFieldIndex::PostingList::ConstIterator MemoryFieldIndex::findFrozen(const vespalib::stringref word) const { DictionaryTree::ConstIterator itr = - _dict.getFrozenView().find(WordKey(btree::EntryRef()), + _dict.getFrozenView().find(WordKey(datastore::EntryRef()), KeyComp(_wordStore, word)); if (itr.valid()) { return _postingListStore.beginFrozen(itr.getData()); @@ -111,12 +111,12 @@ MemoryFieldIndex::compactFeatures(void) PostingList::Iterator it(tree->begin(_postingListStore.getAllocator())); for (; it.valid(); ++it) { - btree::EntryRef oldFeatures = it.getData(); + datastore::EntryRef oldFeatures = it.getData(); // Filter on which buffers to move features from when // performing incremental compaction. - btree::EntryRef newFeatures = + datastore::EntryRef newFeatures = _featureStore.moveFeatures(packedIndex, oldFeatures); #if 0 @@ -137,12 +137,12 @@ MemoryFieldIndex::compactFeatures(void) const PostingListKeyDataType *ite = shortArray + clusterSize; for (const PostingListKeyDataType *it = shortArray; it < ite; ++it) { - btree::EntryRef oldFeatures = it->getData(); + datastore::EntryRef oldFeatures = it->getData(); // Filter on which buffers to move features from when // performing incremental compaction. - btree::EntryRef newFeatures = + datastore::EntryRef newFeatures = _featureStore.moveFeatures(packedIndex, oldFeatures); #if 0 @@ -190,7 +190,7 @@ MemoryFieldIndex::dump(search::index::IndexBuilder & indexBuilder) assert(pitr.valid()); for (; pitr.valid(); ++pitr) { uint32_t docId = pitr.getKey(); - btree::EntryRef featureRef = pitr.getData(); + datastore::EntryRef featureRef = pitr.getData(); indexBuilder.startDocument(docId); _featureStore.setupForReadFeatures(featureRef, decoder); decoder.readFeatures(features); @@ -215,7 +215,7 @@ MemoryFieldIndex::dump(search::index::IndexBuilder & indexBuilder) const PostingListKeyDataType *kde = kd + clusterSize; for (; kd != kde; ++kd) { uint32_t docId = kd->_key; - btree::EntryRef featureRef = kd->getData(); + datastore::EntryRef featureRef = kd->getData(); indexBuilder.startDocument(docId); _featureStore.setupForReadFeatures(featureRef, decoder); decoder.readFeatures(features); @@ -274,7 +274,7 @@ class BTreeNodeT<memoryindex::MemoryFieldIndex::WordKey, template class BTreeNodeTT<memoryindex::MemoryFieldIndex::WordKey, - EntryRef, + datastore::EntryRef, search::btree::NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS>; diff --git a/searchlib/src/vespa/searchlib/memoryindex/memoryfieldindex.h b/searchlib/src/vespa/searchlib/memoryindex/memoryfieldindex.h index 1c16f1746a5..f6d6400555a 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/memoryfieldindex.h +++ b/searchlib/src/vespa/searchlib/memoryindex/memoryfieldindex.h @@ -33,9 +33,9 @@ public: struct WordKey { - btree::EntryRef _wordRef; + datastore::EntryRef _wordRef; - explicit WordKey(btree::EntryRef wordRef) + explicit WordKey(datastore::EntryRef wordRef) : _wordRef(wordRef) { } @@ -59,7 +59,7 @@ public: const vespalib::stringref _word; const char * - getWord(btree::EntryRef wordRef) const + getWord(datastore::EntryRef wordRef) const { if (wordRef.valid()) { return _wordStore.getWord(wordRef); @@ -100,12 +100,12 @@ private: std::unique_ptr<OrderedDocumentInserter> _inserter; public: - btree::EntryRef addWord(const vespalib::stringref word) { + datastore::EntryRef addWord(const vespalib::stringref word) { _numUniqueWords++; return _wordStore.addWord(word); } - btree::EntryRef + datastore::EntryRef addFeatures(const index::DocIdAndFeatures &features) { return _featureStore.addFeatures(_fieldId, features).first; @@ -215,7 +215,7 @@ class BTreeNodeT<memoryindex::MemoryFieldIndex::WordKey, extern template class BTreeNodeTT<memoryindex::MemoryFieldIndex::WordKey, - EntryRef, + datastore::EntryRef, search::btree::NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS>; diff --git a/searchlib/src/vespa/searchlib/memoryindex/ordereddocumentinserter.cpp b/searchlib/src/vespa/searchlib/memoryindex/ordereddocumentinserter.cpp index ca7b83a0781..d65dbdf5910 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/ordereddocumentinserter.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/ordereddocumentinserter.cpp @@ -59,7 +59,7 @@ OrderedDocumentInserter::flushWord() } //XXX: Feature store leak, removed features not marked dead PostingListStore &postingListStore(_fieldIndex.getPostingListStore()); - btree::EntryRef pidx(_dItr.getData()); + datastore::EntryRef pidx(_dItr.getData()); postingListStore.apply(pidx, &_adds[0], &_adds[0] + _adds.size(), @@ -99,10 +99,10 @@ OrderedDocumentInserter::setNextWord(const vespalib::stringref word) _dItr.binarySeek(key, cmp); } if (!_dItr.valid() || cmp(key, _dItr.getKey())) { - btree::EntryRef wordRef = _fieldIndex.addWord(_word); + datastore::EntryRef wordRef = _fieldIndex.addWord(_word); WordKey insertKey(wordRef); DictionaryTree &dTree(_fieldIndex.getDictionaryTree()); - dTree.insert(_dItr, insertKey, btree::EntryRef().ref()); + dTree.insert(_dItr, insertKey, datastore::EntryRef().ref()); } assert(_dItr.valid()); assert(_word == wordStore.getWord(_dItr.getKey()._wordRef)); @@ -116,7 +116,7 @@ OrderedDocumentInserter::add(uint32_t docId, assert(docId != noDocId); assert(_prevDocId == noDocId || _prevDocId < docId || (_prevDocId == docId && !_prevAdd)); - btree::EntryRef featureRef = _fieldIndex.addFeatures(features); + datastore::EntryRef featureRef = _fieldIndex.addFeatures(features); _adds.push_back(PostingListKeyDataType(docId, featureRef.ref())); _listener.insert(_dItr.getKey()._wordRef, docId); _prevDocId = docId; @@ -146,7 +146,7 @@ OrderedDocumentInserter::rewind() } -btree::EntryRef +datastore::EntryRef OrderedDocumentInserter::getWordRef() const { return _dItr.getKey()._wordRef; diff --git a/searchlib/src/vespa/searchlib/memoryindex/ordereddocumentinserter.h b/searchlib/src/vespa/searchlib/memoryindex/ordereddocumentinserter.h index f8ec07e305e..c2def60a2ad 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/ordereddocumentinserter.h +++ b/searchlib/src/vespa/searchlib/memoryindex/ordereddocumentinserter.h @@ -72,7 +72,7 @@ public: virtual void rewind() override; // Used by unit test - btree::EntryRef getWordRef() const; + datastore::EntryRef getWordRef() const; }; } diff --git a/searchlib/src/vespa/searchlib/memoryindex/postingiterator.cpp b/searchlib/src/vespa/searchlib/memoryindex/postingiterator.cpp index f03b476ef6e..42ce33ef3e9 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/postingiterator.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/postingiterator.cpp @@ -62,7 +62,7 @@ PostingIterator::doUnpack(uint32_t docId) assert(docId == getDocId()); assert(_itr.valid()); assert(docId == _itr.getKey()); - btree::EntryRef featureRef(_itr.getData()); + datastore::EntryRef featureRef(_itr.getData()); _featureStore.setupForUnpackFeatures(featureRef, _featureDecoder); _featureDecoder.unpackFeatures(_matchData, docId); setUnpacked(); diff --git a/searchlib/src/vespa/searchlib/memoryindex/wordstore.cpp b/searchlib/src/vespa/searchlib/memoryindex/wordstore.cpp index d1a0c155e9a..6ccdada9beb 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/wordstore.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/wordstore.cpp @@ -29,12 +29,12 @@ WordStore::~WordStore(void) _store.dropBuffers(); } -btree::EntryRef +datastore::EntryRef WordStore::addWord(const vespalib::stringref word) { _store.ensureBufferCapacity(_typeId, RefType::align(word.size() + 1)); uint32_t activeBufferId = _store.getActiveBufferId(_typeId); - btree::BufferState &state = _store.getBufferState(activeBufferId); + datastore::BufferState &state = _store.getBufferState(activeBufferId); size_t oldSize = state.size(); RefType ref(oldSize, activeBufferId); assert(oldSize == ref.offset()); diff --git a/searchlib/src/vespa/searchlib/memoryindex/wordstore.h b/searchlib/src/vespa/searchlib/memoryindex/wordstore.h index 8abd4ebb9ad..f8ff1053c3d 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/wordstore.h +++ b/searchlib/src/vespa/searchlib/memoryindex/wordstore.h @@ -11,20 +11,20 @@ namespace memoryindex { class WordStore { public: - typedef btree::DataStoreT<btree::AlignedEntryRefT<22, 2> > DataStoreType; + typedef datastore::DataStoreT<datastore::AlignedEntryRefT<22, 2> > DataStoreType; typedef DataStoreType::RefType RefType; private: DataStoreType _store; uint32_t _numWords; - btree::BufferType<char> _type; + datastore::BufferType<char> _type; const uint32_t _typeId; public: WordStore(); ~WordStore(); - btree::EntryRef addWord(const vespalib::stringref word); - const char * getWord(btree::EntryRef ref) const + datastore::EntryRef addWord(const vespalib::stringref word); + const char * getWord(datastore::EntryRef ref) const { RefType internalRef(ref); return _store.getBufferEntry<char>(internalRef.bufferId(), diff --git a/searchlib/src/vespa/searchlib/predicate/document_features_store.cpp b/searchlib/src/vespa/searchlib/predicate/document_features_store.cpp index c371b4be991..de40e2975b2 100644 --- a/searchlib/src/vespa/searchlib/predicate/document_features_store.cpp +++ b/searchlib/src/vespa/searchlib/predicate/document_features_store.cpp @@ -15,7 +15,7 @@ LOG_SETUP(".document_features_store"); using search::btree::BTreeNoLeafData; -using search::btree::EntryRef; +using search::datastore::EntryRef; using vespalib::DataBuffer; using vespalib::stringref; using std::unordered_map; @@ -153,8 +153,8 @@ void DocumentFeaturesStore::insert(const PredicateTreeAnnotations &annotations, for (const auto &range : annotations.range_features) { stringref word(range.label.data, range.label.size); KeyComp cmp(_word_store, word); - auto word_it = _word_index.find(btree::EntryRef(), cmp); - btree::EntryRef ref; + auto word_it = _word_index.find(datastore::EntryRef(), cmp); + datastore::EntryRef ref; if (word_it.valid()) { ref = word_it.getKey(); } else { diff --git a/searchlib/src/vespa/searchlib/predicate/document_features_store.h b/searchlib/src/vespa/searchlib/predicate/document_features_store.h index 8d910f8506c..e24db659c19 100644 --- a/searchlib/src/vespa/searchlib/predicate/document_features_store.h +++ b/searchlib/src/vespa/searchlib/predicate/document_features_store.h @@ -23,7 +23,7 @@ namespace predicate { class DocumentFeaturesStore { typedef memoryindex::WordStore WordStore; struct Range { - btree::EntryRef label_ref; + datastore::EntryRef label_ref; int64_t from; int64_t to; }; @@ -34,7 +34,7 @@ class DocumentFeaturesStore { const WordStore &_word_store; const vespalib::string _word; - const char *getWord(btree::EntryRef ref) const { + const char *getWord(datastore::EntryRef ref) const { return ref.valid() ? _word_store.getWord(ref) : _word.c_str(); } @@ -44,8 +44,8 @@ class DocumentFeaturesStore { _word(word) { } - bool operator()(const btree::EntryRef &lhs, - const btree::EntryRef &rhs) const { + bool operator()(const datastore::EntryRef &lhs, + const datastore::EntryRef &rhs) const { return strcmp(getWord(lhs), getWord(rhs)) < 0; } }; @@ -53,7 +53,7 @@ class DocumentFeaturesStore { typedef vespalib::hash_map<uint32_t, FeatureVector> DocumentFeaturesMap; typedef vespalib::Array<Range> RangeVector; typedef vespalib::hash_map<uint32_t, RangeVector> RangeFeaturesMap; - typedef btree::BTree<btree::EntryRef, btree::BTreeNoLeafData, + typedef btree::BTree<datastore::EntryRef, btree::BTreeNoLeafData, btree::NoAggregated, const KeyComp &> WordIndex; DocumentFeaturesMap _docs; diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_index.cpp b/searchlib/src/vespa/searchlib/predicate/predicate_index.cpp index ff69d58c534..5da30aa8dd5 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_index.cpp +++ b/searchlib/src/vespa/searchlib/predicate/predicate_index.cpp @@ -11,7 +11,7 @@ #include <vespa/log/log.h> LOG_SETUP(".predicate_index"); -using search::btree::EntryRef; +using search::datastore::EntryRef; using vespalib::DataBuffer; using std::vector; @@ -45,7 +45,7 @@ void PredicateIndex::indexDocumentFeatures( for (const auto &map_entry : interval_map) { uint64_t feature = map_entry.first; const auto &interval_list = map_entry.second; - btree::EntryRef ref = _interval_store.insert(interval_list); + datastore::EntryRef ref = _interval_store.insert(interval_list); assert(ref.valid()); addPosting<IntervalT>(feature, doc_id, ref); _cache.set(feature, doc_id, true); @@ -156,7 +156,7 @@ void PredicateIndex::indexEmptyDocument(uint32_t doc_id) namespace { void removeFromIndex( - uint64_t feature, uint32_t doc_id, SimpleIndex<btree::EntryRef> &index, PredicateIntervalStore &interval_store) + uint64_t feature, uint32_t doc_id, SimpleIndex<datastore::EntryRef> &index, PredicateIntervalStore &interval_store) { auto result = index.removeFromPostingList(feature, doc_id); if (result.second) { // Posting was removed @@ -168,7 +168,7 @@ void removeFromIndex( class DocIdIterator : public PopulateInterface::Iterator { public: - using BTreeIterator = SimpleIndex<btree::EntryRef>::BTreeIterator; + using BTreeIterator = SimpleIndex<datastore::EntryRef>::BTreeIterator; DocIdIterator(BTreeIterator it) : _it(it) { } int32_t getNext() override { diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_index.h b/searchlib/src/vespa/searchlib/predicate/predicate_index.h index 3673f4378ad..f9aaf4ede0d 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_index.h +++ b/searchlib/src/vespa/searchlib/predicate/predicate_index.h @@ -22,8 +22,8 @@ class PredicateTreeAnnotations; * posting lists for matching. */ class PredicateIndex : public PopulateInterface { - typedef SimpleIndex<btree::EntryRef> IntervalIndex; - typedef SimpleIndex<btree::EntryRef> BoundsIndex; + typedef SimpleIndex<datastore::EntryRef> IntervalIndex; + typedef SimpleIndex<datastore::EntryRef> BoundsIndex; typedef btree::BTree<uint32_t, btree::BTreeNoLeafData> BTreeSet; template <typename IntervalT> using FeatureMap = std::unordered_map<uint64_t, std::vector<IntervalT>>; @@ -36,8 +36,8 @@ public: typedef std::unique_ptr<PredicateIndex> UP; typedef vespalib::GenerationHandler GenerationHandler; typedef vespalib::GenerationHolder GenerationHolder; - using BTreeIterator = SimpleIndex<btree::EntryRef>::BTreeIterator; - using VectorIterator = SimpleIndex<btree::EntryRef>::VectorIterator; + using BTreeIterator = SimpleIndex<datastore::EntryRef>::BTreeIterator; + using VectorIterator = SimpleIndex<datastore::EntryRef>::VectorIterator; static const vespalib::string z_star_attribute_name; static const uint64_t z_star_hash; static const vespalib::string z_star_compressed_attribute_name; @@ -57,7 +57,7 @@ private: template <typename IntervalT> void addPosting(uint64_t feature, uint32_t doc_id, - btree::EntryRef ref); + datastore::EntryRef ref); template <typename IntervalT> void indexDocumentFeatures(uint32_t doc_id, const FeatureMap<IntervalT> &interval_map); @@ -124,7 +124,7 @@ public: void adjustDocIdLimit(uint32_t docId); }; -extern template class SimpleIndex<btree::EntryRef>; +extern template class SimpleIndex<datastore::EntryRef>; } // namespace predicate } // namespace search diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_interval_store.cpp b/searchlib/src/vespa/searchlib/predicate/predicate_interval_store.cpp index f3f41c38e53..969b27c90dc 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_interval_store.cpp +++ b/searchlib/src/vespa/searchlib/predicate/predicate_interval_store.cpp @@ -11,8 +11,8 @@ #include <vespa/log/log.h> LOG_SETUP(".predicate_interval_store"); -using search::btree::BufferState; -using search::btree::EntryRef; +using search::datastore::BufferState; +using search::datastore::EntryRef; using std::vector; namespace search { @@ -23,8 +23,8 @@ PredicateIntervalStore::Entry<T> PredicateIntervalStore::allocNewEntry( uint32_t type_id, uint32_t size) { _store.ensureBufferCapacity(type_id, size); uint32_t active_buffer_id = _store.getActiveBufferId(type_id); - btree::BufferState &state = _store.getBufferState(active_buffer_id); - assert(state._state == btree::BufferState::ACTIVE); + datastore::BufferState &state = _store.getBufferState(active_buffer_id); + assert(state._state == datastore::BufferState::ACTIVE); size_t old_size = state.size(); T *buf = _store.getBufferEntry<T>(active_buffer_id, old_size); state.pushed_back(size); @@ -60,16 +60,16 @@ PredicateIntervalStore::~PredicateIntervalStore() { // anyway. // template <typename IntervalT> -btree::EntryRef PredicateIntervalStore::insert( +datastore::EntryRef PredicateIntervalStore::insert( const vector<IntervalT> &intervals) { const uint32_t size = entrySize<IntervalT>() * intervals.size(); if (size == 0) { - return btree::EntryRef(); + return datastore::EntryRef(); } uint32_t *buffer; - btree::EntryRef ref; + datastore::EntryRef ref; if (size == 1 && intervals[0].interval <= RefCacheType::DATA_REF_MASK) { - return btree::EntryRef(intervals[0].interval); + return datastore::EntryRef(intervals[0].interval); } uint32_t cached_ref = _ref_cache.find( reinterpret_cast<const uint32_t *>(&intervals[0]), size); diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_interval_store.h b/searchlib/src/vespa/searchlib/predicate/predicate_interval_store.h index 1dcd9a81a6b..b18e1960eb4 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_interval_store.h +++ b/searchlib/src/vespa/searchlib/predicate/predicate_interval_store.h @@ -19,12 +19,12 @@ class Interval; class PredicateIntervalStore { class DataStoreAdapter; typedef PredicateRefCache<DataStoreAdapter, 8> RefCacheType; - typedef btree::DataStoreT<btree::EntryRefT<18, 6>> DataStoreType; + typedef datastore::DataStoreT<datastore::EntryRefT<18, 6>> DataStoreType; typedef DataStoreType::RefType RefType; using generation_t = vespalib::GenerationHandler::generation_t; DataStoreType _store; - btree::BufferType<uint32_t> _size1Type; + datastore::BufferType<uint32_t> _size1Type; class DataStoreAdapter { const DataStoreType &_store; @@ -62,7 +62,7 @@ public: * IntervalT is either Interval or IntervalWithBounds. */ template <typename IntervalT> - btree::EntryRef insert(const std::vector<IntervalT> &intervals); + datastore::EntryRef insert(const std::vector<IntervalT> &intervals); /** * Removes an entry. The entry remains accessible until commit @@ -72,7 +72,7 @@ public: * Remove is currently disabled, as the ref cache is assumed to * keep the total number of different entries low. */ - void remove(btree::EntryRef ref); + void remove(datastore::EntryRef ref); void trimHoldLists(generation_t used_generation); @@ -92,7 +92,7 @@ public: * single interval optimization. */ template <typename IntervalT> - const IntervalT *get(btree::EntryRef btree_ref, + const IntervalT *get(datastore::EntryRef btree_ref, uint32_t &size_out, IntervalT *single_buf) const { diff --git a/searchlib/src/vespa/searchlib/predicate/simple_index.cpp b/searchlib/src/vespa/searchlib/predicate/simple_index.cpp index a0051855c6a..fa6fbcd1d90 100644 --- a/searchlib/src/vespa/searchlib/predicate/simple_index.cpp +++ b/searchlib/src/vespa/searchlib/predicate/simple_index.cpp @@ -19,7 +19,7 @@ void log_debug(vespalib::string &str) { } // namespace simpleindex -template class SimpleIndex<btree::EntryRef>; +template class SimpleIndex<datastore::EntryRef>; } // namespace predicate } // namespace search diff --git a/searchlib/src/vespa/searchlib/predicate/simple_index.h b/searchlib/src/vespa/searchlib/predicate/simple_index.h index b61f31f79a0..ebe8da593aa 100644 --- a/searchlib/src/vespa/searchlib/predicate/simple_index.h +++ b/searchlib/src/vespa/searchlib/predicate/simple_index.h @@ -146,7 +146,7 @@ template <typename Posting, typename Key = uint64_t, typename DocId = uint32_t> class SimpleIndex { public: - using Dictionary = btree::BTree<Key, btree::EntryRef, btree::NoAggregated>; + using Dictionary = btree::BTree<Key, datastore::EntryRef, btree::NoAggregated>; using DictionaryIterator = typename Dictionary::ConstIterator; using BTreeStore = btree::BTreeStore< DocId, Posting, btree::NoAggregated, std::less<DocId>, btree::BTreeDefaultTraits>; @@ -169,17 +169,17 @@ private: const SimpleIndexConfig _config; const DocIdLimitProvider &_limit_provider; - void insertIntoPosting(btree::EntryRef &ref, Key key, DocId doc_id, const Posting &posting); - void insertIntoVectorPosting(btree::EntryRef ref, Key key, DocId doc_id, const Posting &posting); - void removeFromVectorPostingList(btree::EntryRef ref, Key key, DocId doc_id); + void insertIntoPosting(datastore::EntryRef &ref, Key key, DocId doc_id, const Posting &posting); + void insertIntoVectorPosting(datastore::EntryRef ref, Key key, DocId doc_id, const Posting &posting); + void removeFromVectorPostingList(datastore::EntryRef ref, Key key, DocId doc_id); void pruneBelowThresholdVectors(); - void createVectorIfOverThreshold(btree::EntryRef ref, Key key); - bool removeVectorIfBelowThreshold(btree::EntryRef ref, typename VectorStore::Iterator &it); + void createVectorIfOverThreshold(datastore::EntryRef ref, Key key); + bool removeVectorIfBelowThreshold(datastore::EntryRef ref, typename VectorStore::Iterator &it); void logVector(const char *action, Key key, size_t document_count, double ratio, size_t vector_length) const; double getDocumentRatio(size_t document_count, uint32_t doc_id_limit) const; - size_t getDocumentCount(btree::EntryRef ref) const; + size_t getDocumentCount(datastore::EntryRef ref) const; bool shouldCreateVectorPosting(size_t size, double ratio) const; bool shouldRemoveVectorPosting(size_t size, double ratio) const; size_t getVectorPostingSize(const PostingVector &vector) const { @@ -211,17 +211,17 @@ public: void transferHoldLists(generation_t generation); MemoryUsage getMemoryUsage() const; template <typename FunctionType> - void foreach_frozen_key(btree::EntryRef ref, Key key, FunctionType func) const; + void foreach_frozen_key(datastore::EntryRef ref, Key key, FunctionType func) const; DictionaryIterator lookup(Key key) const { return _dictionary.getFrozenView().find(key); } - size_t getPostingListSize(btree::EntryRef ref) const { + size_t getPostingListSize(datastore::EntryRef ref) const { return _btree_posting_lists.frozenSize(ref); } - BTreeIterator getBTreePostingList(btree::EntryRef ref) const { + BTreeIterator getBTreePostingList(datastore::EntryRef ref) const { return _btree_posting_lists.beginFrozen(ref); } @@ -240,7 +240,7 @@ public: template<typename Posting, typename Key, typename DocId> template<typename FunctionType> void SimpleIndex<Posting, Key, DocId>::foreach_frozen_key( - btree::EntryRef ref, Key key, FunctionType func) const { + datastore::EntryRef ref, Key key, FunctionType func) const { auto it = _vector_posting_lists.getFrozenView().find(key); double ratio = getDocumentRatio(getDocumentCount(ref), _limit_provider.getDocIdLimit()); if (it.valid() && ratio > _config.foreach_vector_threshold) { diff --git a/searchlib/src/vespa/searchlib/predicate/simple_index.hpp b/searchlib/src/vespa/searchlib/predicate/simple_index.hpp index ca597708735..1298791e95e 100644 --- a/searchlib/src/vespa/searchlib/predicate/simple_index.hpp +++ b/searchlib/src/vespa/searchlib/predicate/simple_index.hpp @@ -13,7 +13,7 @@ namespace simpleindex { template <typename Posting, typename Key, typename DocId> void SimpleIndex<Posting, Key, DocId>::insertIntoPosting( - btree::EntryRef &ref, Key key, DocId doc_id, const Posting &posting) { + datastore::EntryRef &ref, Key key, DocId doc_id, const Posting &posting) { bool ok = _btree_posting_lists.insert(ref, doc_id, posting); if (!ok) { _btree_posting_lists.remove(ref, doc_id); @@ -26,7 +26,7 @@ void SimpleIndex<Posting, Key, DocId>::insertIntoPosting( template <typename Posting, typename Key, typename DocId> void SimpleIndex<Posting, Key, DocId>::insertIntoVectorPosting( - btree::EntryRef ref, Key key, DocId doc_id, const Posting &posting) { + datastore::EntryRef ref, Key key, DocId doc_id, const Posting &posting) { assert(doc_id < _limit_provider.getDocIdLimit()); auto it = _vector_posting_lists.find(key); if (it.valid()) { @@ -44,7 +44,7 @@ SimpleIndex<Posting, Key, DocId>::~SimpleIndex() { _btree_posting_lists.disableElemHoldList(); for (auto it = _dictionary.begin(); it.valid(); ++it) { - btree::EntryRef ref(it.getData()); + datastore::EntryRef ref(it.getData()); if (ref.valid()) { _btree_posting_lists.clear(ref); } @@ -75,7 +75,7 @@ void SimpleIndex<Posting, Key, DocId>::serialize( assert(sizeof(DocId) <= sizeof(uint32_t)); buffer.writeInt32(_dictionary.size()); for (auto it = _dictionary.begin(); it.valid(); ++it) { - btree::EntryRef ref = it.getData(); + datastore::EntryRef ref = it.getData(); buffer.writeInt32(_btree_posting_lists.size(ref)); // 0 if !valid() auto posting_it = _btree_posting_lists.begin(ref); if (!posting_it.valid()) @@ -117,7 +117,7 @@ void SimpleIndex<Posting, Key, DocId>::deserialize( } postings.emplace_back(doc_id, deserializer.deserialize(buffer)); } - btree::EntryRef ref; + datastore::EntryRef ref; _btree_posting_lists.apply(ref, &postings[0], &postings[postings.size()], 0, 0); builder.insert(key, ref); @@ -130,7 +130,7 @@ template <typename Posting, typename Key, typename DocId> void SimpleIndex<Posting, Key, DocId>::addPosting(Key key, DocId doc_id, const Posting &posting) { auto iter = _dictionary.find(key); - btree::EntryRef ref; + datastore::EntryRef ref; if (iter.valid()) { ref = iter.getData(); insertIntoPosting(ref, key, doc_id, posting); @@ -164,7 +164,7 @@ SimpleIndex<Posting, Key, DocId>::removeFromPostingList(Key key, DocId doc_id) { } Posting posting = posting_it.getData(); - btree::EntryRef original_ref(ref); + datastore::EntryRef original_ref(ref); _btree_posting_lists.remove(ref, doc_id); removeFromVectorPostingList(ref, key, doc_id); if (!ref.valid()) { // last posting was removed @@ -178,7 +178,7 @@ SimpleIndex<Posting, Key, DocId>::removeFromPostingList(Key key, DocId doc_id) { template <typename Posting, typename Key, typename DocId> void SimpleIndex<Posting, Key, DocId>::removeFromVectorPostingList( - btree::EntryRef ref, Key key, DocId doc_id) { + datastore::EntryRef ref, Key key, DocId doc_id) { auto it = _vector_posting_lists.find(key); if (it.valid()) { if (!removeVectorIfBelowThreshold(ref, it)) { @@ -226,7 +226,7 @@ void SimpleIndex<Posting, Key, DocId>::logVector( } template <typename Posting, typename Key, typename DocId> -void SimpleIndex<Posting, Key, DocId>::createVectorIfOverThreshold(btree::EntryRef ref, Key key) { +void SimpleIndex<Posting, Key, DocId>::createVectorIfOverThreshold(datastore::EntryRef ref, Key key) { uint32_t doc_id_limit = _limit_provider.getDocIdLimit(); size_t size = getDocumentCount(ref); double ratio = getDocumentRatio(size, doc_id_limit); @@ -242,7 +242,7 @@ void SimpleIndex<Posting, Key, DocId>::createVectorIfOverThreshold(btree::EntryR template <typename Posting, typename Key, typename DocId> bool SimpleIndex<Posting, Key, DocId>::removeVectorIfBelowThreshold( - btree::EntryRef ref, typename VectorStore::Iterator &it) { + datastore::EntryRef ref, typename VectorStore::Iterator &it) { size_t size = getDocumentCount(ref); double ratio = getDocumentRatio(size, _limit_provider.getDocIdLimit()); if (shouldRemoveVectorPosting(size, ratio)) { @@ -263,7 +263,7 @@ double SimpleIndex<Posting, Key, DocId>::getDocumentRatio(size_t document_count, }; template <typename Posting, typename Key, typename DocId> -size_t SimpleIndex<Posting, Key, DocId>::getDocumentCount(btree::EntryRef ref) const { +size_t SimpleIndex<Posting, Key, DocId>::getDocumentCount(datastore::EntryRef ref) const { return _btree_posting_lists.size(ref); }; diff --git a/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.cpp index 6ad7766441a..add0a616631 100644 --- a/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.cpp @@ -33,7 +33,7 @@ typedef PredicateBlueprint::BoundsEntry BoundsEntry; template <typename Entry> void pushValueDictionaryEntry(const Entry &entry, - const SimpleIndex<btree::EntryRef> &interval_index, + const SimpleIndex<datastore::EntryRef> &interval_index, vector<IntervalEntry> &interval_entries) { const std::string &hash_str = entry.getKey() + "=" + entry.getValue(); uint64_t feature = PredicateHash::hash64(hash_str); @@ -46,8 +46,8 @@ void pushValueDictionaryEntry(const Entry &entry, } struct MyRangeHandler { - const SimpleIndex<btree::EntryRef> &interval_index; - const SimpleIndex<btree::EntryRef> &bounds_index; + const SimpleIndex<datastore::EntryRef> &interval_index; + const SimpleIndex<datastore::EntryRef> &bounds_index; vector<IntervalEntry> &interval_entries; vector<BoundsEntry> &bounds_entries; uint64_t subquery_bitmap; @@ -82,7 +82,7 @@ void pushRangeDictionaryEntries( expander.expand(entry.getKey(), entry.getValue(), handler); } -void pushZStarPostingList(const SimpleIndex<btree::EntryRef> &interval_index, +void pushZStarPostingList(const SimpleIndex<datastore::EntryRef> &interval_index, vector<IntervalEntry> &interval_entries) { uint64_t feature = PredicateIndex::z_star_hash; auto iterator = interval_index.lookup(feature); @@ -214,7 +214,7 @@ namespace { void lookupPostingLists(const std::vector<DictEntry> &dict_entries, std::vector<VectorIteratorEntry> &vector_iterators, std::vector<BTreeIteratorEntry> &btree_iterators, - const SimpleIndex<btree::EntryRef> &index) + const SimpleIndex<datastore::EntryRef> &index) { for (const auto &entry : dict_entries) { auto vector_iterator = index.getVectorPostingList(entry.feature); diff --git a/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h b/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h index 85f2b9ec04f..d8be2e45b54 100644 --- a/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h +++ b/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h @@ -21,13 +21,13 @@ namespace queryeval { class PredicateBlueprint : public ComplexLeafBlueprint { public: struct IntervalEntry { - btree::EntryRef entry_ref; + datastore::EntryRef entry_ref; uint64_t subquery; size_t size; uint64_t feature; }; struct BoundsEntry { - btree::EntryRef entry_ref; + datastore::EntryRef entry_ref; uint32_t value_diff; uint64_t subquery; size_t size; @@ -54,8 +54,8 @@ public: createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool strict) const override; private: - using BTreeIterator = predicate::SimpleIndex<btree::EntryRef>::BTreeIterator; - using VectorIterator = predicate::SimpleIndex<btree::EntryRef>::VectorIterator; + using BTreeIterator = predicate::SimpleIndex<datastore::EntryRef>::BTreeIterator; + using VectorIterator = predicate::SimpleIndex<datastore::EntryRef>::VectorIterator; template <typename T> using optional = std::experimental::optional<T>; using Alloc = vespalib::alloc::Alloc; @@ -79,7 +79,7 @@ private: std::vector<IntervalEntry> _interval_dict_entries; std::vector<BoundsEntry> _bounds_dict_entries; - btree::EntryRef _zstar_dict_entry; + datastore::EntryRef _zstar_dict_entry; std::vector<IntervalIteratorEntry<BTreeIterator>> _interval_btree_iterators; std::vector<IntervalIteratorEntry<VectorIterator>> _interval_vector_iterators; diff --git a/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.cpp b/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.cpp index 1110acabc0b..7bd23b0a1e2 100644 --- a/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.cpp +++ b/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.cpp @@ -25,7 +25,7 @@ namespace attribute { constexpr size_t MIN_BUFFER_CLUSTERS = 1024; DenseTensorStore::BufferType::BufferType() - : btree::BufferType<char>(RefType::align(1), + : datastore::BufferType<char>(RefType::align(1), MIN_BUFFER_CLUSTERS, RefType::offsetSize() / RefType::align(1)), _unboundDimSizesSize(0u) @@ -95,7 +95,7 @@ DenseTensorStore::getNumCells(const void *buffer) const namespace { -void allocateSpaceForFirstUnboundDimSizesInBuffer(char *&buffer, size_t &oldSize, btree::BufferState &state, size_t alignedUnboundDimSizesSize) { +void allocateSpaceForFirstUnboundDimSizesInBuffer(char *&buffer, size_t &oldSize, datastore::BufferState &state, size_t alignedUnboundDimSizesSize) { memset(buffer, 0, alignedUnboundDimSizesSize); state.pushed_back(alignedUnboundDimSizesSize); state._deadElems += alignedUnboundDimSizesSize; @@ -119,7 +119,7 @@ DenseTensorStore::allocRawBuffer(size_t numCells) size_t ensureSize = alignedBufSize + alignedUnboundDimSizesSize; _store.ensureBufferCapacity(_typeId, ensureSize); uint32_t activeBufferId = _store.getActiveBufferId(_typeId); - btree::BufferState &state = _store.getBufferState(activeBufferId); + datastore::BufferState &state = _store.getBufferState(activeBufferId); size_t oldSize = state.size(); char *buffer = _store.getBufferEntry<char>(activeBufferId, oldSize); if (oldSize <= alignedUnboundDimSizesSize) { diff --git a/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.h b/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.h index fdaf70e5c46..72db4d73968 100644 --- a/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.h +++ b/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.h @@ -29,11 +29,11 @@ class DenseTensorStore : public TensorStore { public: // 32 entry alignment, entry type is char => 32 bytes alignment - using RefType = btree::AlignedEntryRefT<22, 5>; - using DataStoreType = btree::DataStoreT<RefType>; + using RefType = datastore::AlignedEntryRefT<22, 5>; + using DataStoreType = datastore::DataStoreT<RefType>; using ValueType = vespalib::eval::ValueType; - class BufferType : public btree::BufferType<char> + class BufferType : public datastore::BufferType<char> { uint32_t _unboundDimSizesSize; public: diff --git a/searchlib/src/vespa/searchlib/tensor/generic_tensor_store.cpp b/searchlib/src/vespa/searchlib/tensor/generic_tensor_store.cpp index a6b0c327244..e89ac679549 100644 --- a/searchlib/src/vespa/searchlib/tensor/generic_tensor_store.cpp +++ b/searchlib/src/vespa/searchlib/tensor/generic_tensor_store.cpp @@ -61,7 +61,7 @@ GenericTensorStore::allocRawBuffer(uint32_t size) size_t bufSize = RefType::align(extSize); _store.ensureBufferCapacity(_typeId, bufSize); uint32_t activeBufferId = _store.getActiveBufferId(_typeId); - btree::BufferState &state = _store.getBufferState(activeBufferId); + datastore::BufferState &state = _store.getBufferState(activeBufferId); size_t oldSize = state.size(); char *bufferEntryWritePtr = _store.getBufferEntry<char>(activeBufferId, oldSize); diff --git a/searchlib/src/vespa/searchlib/tensor/generic_tensor_store.h b/searchlib/src/vespa/searchlib/tensor/generic_tensor_store.h index 4dbe7427daa..d0afb2bbb2f 100644 --- a/searchlib/src/vespa/searchlib/tensor/generic_tensor_store.h +++ b/searchlib/src/vespa/searchlib/tensor/generic_tensor_store.h @@ -18,11 +18,11 @@ namespace attribute { class GenericTensorStore : public TensorStore { public: - using RefType = btree::AlignedEntryRefT<22, 2>; - using DataStoreType = btree::DataStoreT<RefType>; + using RefType = datastore::AlignedEntryRefT<22, 2>; + using DataStoreType = datastore::DataStoreT<RefType>; private: DataStoreType _concreteStore; - btree::BufferType<char> _bufferType; + datastore::BufferType<char> _bufferType; public: GenericTensorStore(); diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_store.cpp b/searchlib/src/vespa/searchlib/tensor/tensor_store.cpp index 94bdeeee52a..26360126d07 100644 --- a/searchlib/src/vespa/searchlib/tensor/tensor_store.cpp +++ b/searchlib/src/vespa/searchlib/tensor/tensor_store.cpp @@ -10,7 +10,7 @@ namespace attribute { constexpr size_t MIN_BUFFER_CLUSTERS = 1024; -TensorStore::TensorStore(btree::DataStoreBase &store) +TensorStore::TensorStore(datastore::DataStoreBase &store) : _store(store), _typeId(0) { diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_store.h b/searchlib/src/vespa/searchlib/tensor/tensor_store.h index f930b8b0dd2..0aa859b9433 100644 --- a/searchlib/src/vespa/searchlib/tensor/tensor_store.h +++ b/searchlib/src/vespa/searchlib/tensor/tensor_store.h @@ -22,16 +22,16 @@ namespace attribute { class TensorStore { public: - using EntryRef = btree::EntryRef; + using EntryRef = datastore::EntryRef; typedef vespalib::GenerationHandler::generation_t generation_t; using Tensor = vespalib::tensor::Tensor; protected: - btree::DataStoreBase &_store; + datastore::DataStoreBase &_store; const uint32_t _typeId; public: - TensorStore(btree::DataStoreBase &store); + TensorStore(datastore::DataStoreBase &store); virtual ~TensorStore(); diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.h b/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.h index 111f3b6ba54..dfe1b41abde 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.h +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.h @@ -21,7 +21,7 @@ public: typedef memoryindex::Dictionary::PostingList Tree; typedef Tree::NodeAllocatorType NodeAllocator; typedef memoryindex::FeatureStore FeatureStore; - typedef btree::EntryRef EntryRef; + typedef datastore::EntryRef EntryRef; typedef index::Schema Schema; typedef bitcompression::PosOccFieldsParams PosOccFieldsParams; |