summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <tegge@oath.com>2017-08-16 12:53:19 +0000
committerTor Egge <tegge@oath.com>2017-08-16 12:53:19 +0000
commit4eac0da97c002dcea37d77350e7a541e12fa2da2 (patch)
tree4257071ca9fd88687519926496424e4db15c8d31 /searchlib
parentacfef4e09234fddf4b1cb57d7458352b0e867ad4 (diff)
Consolidate naming: limit, numDocs => docIdLimit
Add syncMappings() method.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp3
-rw-r--r--searchlib/src/vespa/searchlib/attribute/reference_mappings.cpp19
-rw-r--r--searchlib/src/vespa/searchlib/attribute/reference_mappings.h13
3 files changed, 21 insertions, 14 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp
index 487037a881b..1f75777eedd 100644
--- a/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp
@@ -340,8 +340,7 @@ ReferenceAttribute::populateReferencedLids()
saver.foreach_key([&store,&mapper,this](EntryRef ref)
{ const Reference &entry = store.get(ref);
entry.setLid(mapper.mapGidToLid(entry.gid()));
- _referenceMappings.syncReverseMappingIndices(entry);
- _referenceMappings.syncForwardMapping(entry);
+ _referenceMappings.syncMappings(entry);
});
}
commit();
diff --git a/searchlib/src/vespa/searchlib/attribute/reference_mappings.cpp b/searchlib/src/vespa/searchlib/attribute/reference_mappings.cpp
index f699b2e2c07..175dc05396d 100644
--- a/searchlib/src/vespa/searchlib/attribute/reference_mappings.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/reference_mappings.cpp
@@ -50,6 +50,13 @@ ReferenceMappings::syncReverseMappingIndices(const Reference &entry)
}
void
+ReferenceMappings::syncMappings(const Reference &entry)
+{
+ syncReverseMappingIndices(entry);
+ syncForwardMapping(entry);
+}
+
+void
ReferenceMappings::removeReverseMapping(const Reference &entry, uint32_t lid)
{
EntryRef revMapIdx = entry.revMapIdx();
@@ -96,9 +103,9 @@ ReferenceMappings::notifyGidToLidChange(const Reference &entry, uint32_t referen
}
void
-ReferenceMappings::onAddDocs(uint32_t limit)
+ReferenceMappings::onAddDocs(uint32_t docIdLimit)
{
- _referencedLids.reserve(limit);
+ _referencedLids.reserve(docIdLimit);
}
void
@@ -108,16 +115,16 @@ ReferenceMappings::addDoc()
}
void
-ReferenceMappings::onLoad(uint32_t numDocs)
+ReferenceMappings::onLoad(uint32_t docIdLimit)
{
_referencedLids.clear();
- _referencedLids.unsafe_reserve(numDocs);
+ _referencedLids.unsafe_reserve(docIdLimit);
}
void
-ReferenceMappings::shrink(uint32_t limit)
+ReferenceMappings::shrink(uint32_t docIdLimit)
{
- _referencedLids.shrink(limit);
+ _referencedLids.shrink(docIdLimit);
}
}
diff --git a/searchlib/src/vespa/searchlib/attribute/reference_mappings.h b/searchlib/src/vespa/searchlib/attribute/reference_mappings.h
index 925aae25719..9880bf44efc 100644
--- a/searchlib/src/vespa/searchlib/attribute/reference_mappings.h
+++ b/searchlib/src/vespa/searchlib/attribute/reference_mappings.h
@@ -33,6 +33,9 @@ class ReferenceMappings
// vector containing referenced lid given referencing lid
RcuVectorBase<uint32_t> _referencedLids;
+ void syncForwardMapping(const Reference &entry);
+ void syncReverseMappingIndices(const Reference &entry);
+
public:
using ReferencedLids = vespalib::ConstArrayRef<uint32_t>;
@@ -51,17 +54,15 @@ public:
// Handle mapping changes
void notifyGidToLidChange(const Reference &entry, uint32_t referencedLid);
- void syncReverseMappingIndices(const Reference &entry);
void removeReverseMapping(const Reference &entry, uint32_t lid);
void addReverseMapping(const Reference &entry, uint32_t lid);
+ void syncMappings(const Reference &entry);
// Maintain size of mapping from lid to referenced lid
- void onAddDocs(uint32_t limit);
+ void onAddDocs(uint32_t docIdLimit);
void addDoc();
- void onLoad(uint32_t numDocs);
- void shrink(uint32_t limit);
-
- void syncForwardMapping(const Reference &entry);
+ void onLoad(uint32_t docIdLimit);
+ void shrink(uint32_t docIdLimit);
// Setup mapping after load
void buildReverseMapping(const Reference &entry, const std::vector<ReverseMapping::KeyDataType> &adds);