diff options
author | Henning Baldersheim <balder@oath.com> | 2018-06-11 19:02:04 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@oath.com> | 2018-06-11 19:42:40 +0200 |
commit | 62230d6b0155d96abf0dc8662681c53679942b82 (patch) | |
tree | 3ce92cd122d4d69e50ef7a1b2287cb6ac60673d5 /searchcore | |
parent | 8fca37dad58eb97bd8cc34cf1b72bda0226ba31f (diff) |
Use a explicit type to avoid confusion on what an intger number mean. ComponentId or ExecutorId.
Diffstat (limited to 'searchcore')
3 files changed, 18 insertions, 16 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp index 2d78f837ecf..239f91b449f 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp @@ -21,6 +21,7 @@ LOG_SETUP(".proton.server.attributeadapter"); using namespace document; using namespace search; using search::attribute::ImportedAttributeVector; +using ExecutorId = search::ISequencedTaskExecutor::ExecutorId; namespace proton { @@ -50,7 +51,7 @@ AttributeWriter::WriteField::buildFieldPath(const DocumentType &docType) _fieldPath = std::move(fp); } -AttributeWriter::WriteContext::WriteContext(uint32_t executorId) +AttributeWriter::WriteContext::WriteContext(ExecutorId executorId) : _executorId(executorId), _fields(), _hasStructFieldAttribute(false) @@ -214,15 +215,15 @@ struct BatchUpdateTask : public vespalib::Executor::Task { class FieldContext { - vespalib::string _name; - uint32_t _executorId; - AttributeVector *_attr; + vespalib::string _name; + ExecutorId _executorId; + AttributeVector *_attr; public: FieldContext(ISequencedTaskExecutor &writer, AttributeVector *attr); ~FieldContext(); bool operator<(const FieldContext &rhs) const; - uint32_t getExecutorId() const { return _executorId; } + ExecutorId getExecutorId() const { return _executorId; } AttributeVector *getAttribute() const { return _attr; } }; @@ -554,7 +555,7 @@ AttributeWriter::update(SerialNum serialNum, const DocumentUpdate &upd, Document // document and attribute. if (attrp->getStatus().getLastSyncToken() >= serialNum) continue; - args[_attributeFieldWriter.getExecutorId(attrp->getName())]->_updates.emplace_back(attrp, &fupd); + args[_attributeFieldWriter.getExecutorId(attrp->getName()).getId()]->_updates.emplace_back(attrp, &fupd); LOG(debug, "About to apply update for docId %u in attribute vector '%s'.", lid, attrp->getName().c_str()); } // NOTE: The lifetime of the field update will be ensured by keeping the document update alive @@ -562,7 +563,7 @@ AttributeWriter::update(SerialNum serialNum, const DocumentUpdate &upd, Document for (uint32_t id(0); id < args.size(); id++) { if ( ! args[id]->_updates.empty()) { args[id]->_onWriteDone = onWriteDone; - _attributeFieldWriter.executeTask(id, std::move(args[id])); + _attributeFieldWriter.executeTask(ExecutorId(id), std::move(args[id])); } } diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h index bed2a7cb23d..f89089ed335 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h @@ -5,6 +5,7 @@ #include "i_attribute_writer.h" #include <vespa/searchcore/proton/common/commit_time_tracker.h> #include <vespa/document/base/fieldpath.h> +#include <vespa/searchlib/common/isequencedtaskexecutor.h> namespace document { class DocumentType; } @@ -25,6 +26,7 @@ private: const IAttributeManager::SP _mgr; search::ISequencedTaskExecutor &_attributeFieldWriter; const std::vector<search::AttributeVector *> &_writableAttributes; + using ExecutorId = search::ISequencedTaskExecutor::ExecutorId; public: class WriteField { @@ -41,17 +43,17 @@ public: }; class WriteContext { - uint32_t _executorId; + ExecutorId _executorId; std::vector<WriteField> _fields; bool _hasStructFieldAttribute; public: - WriteContext(uint32_t executorId); + WriteContext(ExecutorId executorId); WriteContext(WriteContext &&rhs); ~WriteContext(); WriteContext &operator=(WriteContext &&rhs); void buildFieldPaths(const DocumentType &docType); void add(AttributeVector &attr); - uint32_t getExecutorId() const { return _executorId; } + ExecutorId getExecutorId() const { return _executorId; } const std::vector<WriteField> &getFields() const { return _fields; } bool hasStructFieldAttribute() const { return _hasStructFieldAttribute; } }; diff --git a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_listener.h b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_listener.h index 0e9298e3e51..d4c349bd1d7 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_listener.h +++ b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_listener.h @@ -7,7 +7,6 @@ #include <vespa/searchlib/common/sequencedtaskexecutor.h> #include <vespa/searchcore/proton/common/monitored_refcount.h> - namespace proton { /* @@ -16,12 +15,12 @@ namespace proton { */ class GidToLidChangeListener : public IGidToLidChangeListener { - search::ISequencedTaskExecutor &_attributeFieldWriter; - uint32_t _executorId; + search::ISequencedTaskExecutor &_attributeFieldWriter; + search::ISequencedTaskExecutor::ExecutorId _executorId; std::shared_ptr<search::attribute::ReferenceAttribute> _attr; - MonitoredRefCount &_refCount; - vespalib::string _name; - vespalib::string _docTypeName; + MonitoredRefCount &_refCount; + vespalib::string _name; + vespalib::string _docTypeName; public: GidToLidChangeListener(search::ISequencedTaskExecutor &attributeFieldWriter, |