diff options
author | Henning Baldersheim <balder@oath.com> | 2018-06-14 09:34:11 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@oath.com> | 2018-06-14 09:34:11 +0200 |
commit | 747bda75a444c866d8e4752315e6949fd23194bd (patch) | |
tree | f18662aa3fa25f69febd9bb2eed58dd2acee8064 /searchcore | |
parent | 02875a82a322965ba4079e2be168eba6b7b41c40 (diff) |
Reduce code visibility and C++11ification.
Diffstat (limited to 'searchcore')
29 files changed, 119 insertions, 122 deletions
diff --git a/searchcore/src/apps/vespa-transactionlog-inspect/vespa-transactionlog-inspect.cpp b/searchcore/src/apps/vespa-transactionlog-inspect/vespa-transactionlog-inspect.cpp index 17f1faffbba..8ffe4807427 100644 --- a/searchcore/src/apps/vespa-transactionlog-inspect/vespa-transactionlog-inspect.cpp +++ b/searchcore/src/apps/vespa-transactionlog-inspect/vespa-transactionlog-inspect.cpp @@ -1,8 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/config/helper/configgetter.h> - #include <vespa/searchcore/proton/server/replaypacketdispatcher.h> +#include <vespa/searchcore/proton/feedoperation/operations.h> #include <vespa/searchlib/common/fileheadercontext.h> #include <vespa/searchlib/transactionlog/translogclient.h> #include <vespa/searchlib/transactionlog/translogserver.h> diff --git a/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp b/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp index f06bb124eb8..958be6a4686 100644 --- a/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp +++ b/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp @@ -1,15 +1,16 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> -LOG_SETUP("combiningfeedview_test"); #include <vespa/document/test/make_bucket_space.h> -#include <vespa/searchcore/proton/feedoperation/moveoperation.h> +#include <vespa/searchcore/proton/feedoperation/operations.h> #include <vespa/searchcore/proton/server/combiningfeedview.h> #include <vespa/searchcore/proton/test/test.h> #include <vespa/searchlib/common/idestructorcallback.h> #include <vespa/document/update/documentupdate.h> #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/log/log.h> +LOG_SETUP("combiningfeedview_test"); + using document::DocumentTypeRepo; using document::DocumentUpdate; using document::test::makeBucketSpace; @@ -22,8 +23,8 @@ typedef std::vector<IFeedView::SP> FeedViewVector; struct MyStreamHandler : public NewConfigOperation::IStreamHandler { - virtual void serializeConfig(SerialNum, vespalib::nbostream &) override {} - virtual void deserializeConfig(SerialNum, vespalib::nbostream &) override {} + void serializeConfig(SerialNum, vespalib::nbostream &) override {} + void deserializeConfig(SerialNum, vespalib::nbostream &) override {} }; diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp index bab6aff821f..760f7457d33 100644 --- a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp +++ b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp @@ -14,6 +14,7 @@ #include <vespa/searchcore/proton/reference/i_document_db_reference_resolver.h> #include <vespa/searchcore/proton/reprocessing/i_reprocessing_task.h> #include <vespa/searchcore/proton/reprocessing/reprocessingrunner.h> +#include <vespa/searchcore/proton/feedoperation/operations.h> #include <vespa/searchcore/proton/server/bootstrapconfig.h> #include <vespa/searchcore/proton/server/document_subdb_explorer.h> #include <vespa/searchcore/proton/server/emptysearchview.h> diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp index 111b4047da3..d21e5abe30b 100644 --- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp @@ -11,6 +11,7 @@ #include <vespa/searchcore/proton/server/isummaryadapter.h> #include <vespa/searchcore/proton/server/matchview.h> #include <vespa/searchcore/proton/server/searchable_feed_view.h> +#include <vespa/searchcore/proton/feedoperation/operations.h> #include <vespa/searchcore/proton/test/document_meta_store_context_observer.h> #include <vespa/searchcore/proton/test/dummy_document_store.h> #include <vespa/searchcore/proton/test/dummy_summary_manager.h> diff --git a/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp b/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp index e8247a52199..d07c29ead69 100644 --- a/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp +++ b/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp @@ -9,6 +9,8 @@ #include <vespa/searchcore/proton/server/putdonecontext.h> #include <vespa/searchcore/proton/server/removedonecontext.h> #include <vespa/searchcore/proton/server/storeonlyfeedview.h> +#include <vespa/searchcore/proton/feedoperation/moveoperation.h> +#include <vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.h> #include <vespa/searchcore/proton/reference/dummy_gid_to_lid_change_handler.h> #include <vespa/searchcore/proton/test/mock_summary_adapter.h> #include <vespa/searchcore/proton/test/thread_utils.h> diff --git a/searchcore/src/tests/proton/server/feedstates_test.cpp b/searchcore/src/tests/proton/server/feedstates_test.cpp index dfa461e2b57..f206ffc9b17 100644 --- a/searchcore/src/tests/proton/server/feedstates_test.cpp +++ b/searchcore/src/tests/proton/server/feedstates_test.cpp @@ -1,8 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. // Unit tests for feedstates. -#include <vespa/log/log.h> -LOG_SETUP("feedstates_test"); #include <vespa/document/base/documentid.h> #include <vespa/document/base/testdocrepo.h> @@ -11,6 +9,7 @@ LOG_SETUP("feedstates_test"); #include <vespa/searchcore/proton/server/feedstates.h> #include <vespa/searchcore/proton/server/ireplayconfig.h> #include <vespa/searchcore/proton/server/memoryconfigstore.h> +#include <vespa/searchcore/proton/feedoperation/removeoperation.h> #include <vespa/searchcore/proton/test/dummy_feed_view.h> #include <vespa/searchlib/common/serialnum.h> #include <vespa/vespalib/objects/nbostream.h> @@ -18,6 +17,9 @@ LOG_SETUP("feedstates_test"); #include <vespa/vespalib/util/buffer.h> #include <vespa/searchcore/proton/bucketdb/bucketdbhandler.h> +#include <vespa/log/log.h> +LOG_SETUP("feedstates_test"); + using document::BucketId; using document::DocumentId; using document::DocumentTypeRepo; @@ -83,7 +85,7 @@ Fixture::Fixture() state("doctypename", feed_view_ptr, _bucketDBHandler, replay_config, config_store) { } -Fixture::~Fixture() {} +Fixture::~Fixture() = default; struct RemoveOperationContext @@ -107,7 +109,7 @@ RemoveOperationContext::RemoveOperationContext(search::SerialNum serial) packet.reset(new Packet()); packet->add(Packet::Entry(serial, FeedOperation::REMOVE, buf)); } -RemoveOperationContext::~RemoveOperationContext() {} +RemoveOperationContext::~RemoveOperationContext() = default; TEST_F("require that active FeedView can change during replay", Fixture) { RemoveOperationContext opCtx(10); diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/compact_lid_space_operation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/compact_lid_space_operation.cpp index cd906891b92..c2a3439388a 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/compact_lid_space_operation.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/compact_lid_space_operation.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "compact_lid_space_operation.h" +#include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/util/stringfmt.h> namespace proton { @@ -27,8 +28,7 @@ CompactLidSpaceOperation::serialize(vespalib::nbostream& os) const } void -CompactLidSpaceOperation::deserialize(vespalib::nbostream& is, - const document::DocumentTypeRepo&) +CompactLidSpaceOperation::deserialize(vespalib::nbostream& is, const document::DocumentTypeRepo&) { is >> _subDbId; is >> _lidLimit; diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/feedoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/feedoperation.h index 8a00c739126..77b95547bd0 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/feedoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/feedoperation.h @@ -2,10 +2,10 @@ #pragma once #include <vespa/searchlib/common/serialnum.h> -#include <vespa/vespalib/objects/nbostream.h> +#include <vespa/vespalib/stllike/string.h> namespace document { class DocumentTypeRepo; } - +namespace vespalib { class nbostream; } namespace proton { class FeedOperation diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/lidvectorcontext.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/lidvectorcontext.cpp index 71a701bdb40..67e4d1b4287 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/lidvectorcontext.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/lidvectorcontext.cpp @@ -2,6 +2,7 @@ #include "lidvectorcontext.h" #include <vespa/searchlib/common/bitvector.h> +#include <vespa/vespalib/objects/nbostream.h> #include <vespa/log/log.h> LOG_SETUP(".proton.feedoperation.lidvectorcontext"); diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/lidvectorcontext.h b/searchcore/src/vespa/searchcore/proton/feedoperation/lidvectorcontext.h index b432bbcf20a..b307e50da0a 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/lidvectorcontext.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/lidvectorcontext.h @@ -2,9 +2,10 @@ #pragma once #include <vespa/searchlib/query/base.h> -#include <vespa/vespalib/objects/nbostream.h> #include <vector> +namespace vespalib { class nbostream; } + namespace proton { class LidVectorContext @@ -29,5 +30,4 @@ public: size_t getNumLids() const { return _result.size(); } }; -} // namespace proton - +} diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/newconfigoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/newconfigoperation.h index b7b041135d4..144aa534bf7 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/newconfigoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/newconfigoperation.h @@ -2,30 +2,29 @@ #pragma once #include "feedoperation.h" -#include <vespa/vespalib/objects/nbostream.h> namespace proton { + namespace feedoperation { + struct IStreamHandler { + virtual ~IStreamHandler() {} + virtual void serializeConfig(search::SerialNum serialNum, vespalib::nbostream &os) = 0; + virtual void deserializeConfig(search::SerialNum serialNum, vespalib::nbostream &is) = 0; + }; + } + class NewConfigOperation : public FeedOperation { public: - struct IStreamHandler { - virtual ~IStreamHandler() {} - virtual void serializeConfig(SerialNum serialNum, - vespalib::nbostream &os) = 0; - virtual void deserializeConfig(SerialNum serialNum, - vespalib::nbostream &is) = 0; - }; + using IStreamHandler = feedoperation::IStreamHandler; private: IStreamHandler &_streamHandler; public: - NewConfigOperation(SerialNum serialNum, - IStreamHandler &streamHandler); - virtual ~NewConfigOperation() {} - virtual void serialize(vespalib::nbostream &os) const override; - virtual void deserialize(vespalib::nbostream &is, - const document::DocumentTypeRepo &repo) override; - virtual vespalib::string toString() const override; + NewConfigOperation(SerialNum serialNum, IStreamHandler &streamHandler); + ~NewConfigOperation() override {} + void serialize(vespalib::nbostream &os) const override; + void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) override; + vespalib::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.cpp index eea693e4680..69f754cd594 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.cpp @@ -2,6 +2,7 @@ #include "pruneremoveddocumentsoperation.h" #include <vespa/vespalib/util/stringfmt.h> +#include <vespa/vespalib/objects/nbostream.h> #include <cassert> #include <vespa/log/log.h> @@ -22,8 +23,7 @@ PruneRemovedDocumentsOperation::PruneRemovedDocumentsOperation() PruneRemovedDocumentsOperation:: -PruneRemovedDocumentsOperation(DocumentIdT docIdLimit, - uint32_t subDbId) +PruneRemovedDocumentsOperation(DocumentIdT docIdLimit, uint32_t subDbId) : RemoveDocumentsOperation(FeedOperation::PRUNE_REMOVED_DOCUMENTS), _subDbId(subDbId) { @@ -44,8 +44,7 @@ PruneRemovedDocumentsOperation::serialize(vespalib::nbostream &os) const void -PruneRemovedDocumentsOperation::deserialize(vespalib::nbostream &is, - const DocumentTypeRepo &) +PruneRemovedDocumentsOperation::deserialize(vespalib::nbostream &is, const DocumentTypeRepo &) { is >> _subDbId; deserializeLidsToRemove(is); diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/removedocumentsoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/removedocumentsoperation.cpp index 6aa479611d1..ef482a19ca3 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/removedocumentsoperation.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/removedocumentsoperation.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "removedocumentsoperation.h" +#include <vespa/vespalib/objects/nbostream.h> namespace proton { @@ -16,11 +17,9 @@ RemoveDocumentsOperation::serializeLidsToRemove(vespalib::nbostream &os) const { uint32_t mapSize = _lidsToRemoveMap.size(); os << mapSize; - for (LidsToRemoveMap::const_iterator - it = _lidsToRemoveMap.begin(), ite = _lidsToRemoveMap.end(); - it != ite; ++it) { - os << it->first; - it->second->serialize(os); + for (const auto & entry : _lidsToRemoveMap) { + os << entry.first; + entry.second->serialize(os); } } diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/spoolerreplayoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/spoolerreplayoperation.cpp index f3ef73f4d90..16ddedc4745 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/spoolerreplayoperation.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/spoolerreplayoperation.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "spoolerreplayoperation.h" +#include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/util/stringfmt.h> using vespalib::make_string; @@ -14,10 +15,7 @@ SpoolerReplayOperation::SpoolerReplayOperation(Type type) { } - -SpoolerReplayOperation::SpoolerReplayOperation(Type type, - SerialNum serialNum, - SerialNum spoolerSerialNum) +SpoolerReplayOperation::SpoolerReplayOperation(Type type, SerialNum serialNum, SerialNum spoolerSerialNum) : FeedOperation(type), _spoolerSerialNum(spoolerSerialNum) { @@ -39,11 +37,8 @@ SpoolerReplayOperation::deserialize(vespalib::nbostream &is) } vespalib::string SpoolerReplayOperation::toString() const { - return make_string( - "SpoolerReplay%s(spoolerSerialNum=%" PRIu64 - ", serialNum=%" PRIu64 ")", - getType() == SPOOLER_REPLAY_START ? "Start" : "Complete", - _spoolerSerialNum, getSerialNum()); + return make_string("SpoolerReplay%s(spoolerSerialNum=%" PRIu64", serialNum=%" PRIu64 ")", + getType() == SPOOLER_REPLAY_START ? "Start" : "Complete", _spoolerSerialNum, getSerialNum()); } @@ -53,8 +48,7 @@ SpoolerReplayStartOperation::SpoolerReplayStartOperation() } -SpoolerReplayStartOperation::SpoolerReplayStartOperation(SerialNum serialNum, - SerialNum spoolerSerialNum) +SpoolerReplayStartOperation::SpoolerReplayStartOperation(SerialNum serialNum, SerialNum spoolerSerialNum) : SpoolerReplayOperation(FeedOperation::SPOOLER_REPLAY_START, serialNum, spoolerSerialNum) @@ -70,12 +64,8 @@ SpoolerReplayCompleteOperation::SpoolerReplayCompleteOperation() SpoolerReplayCompleteOperation::SpoolerReplayCompleteOperation(SerialNum serialNum, SerialNum spoolerSerialNum) - : SpoolerReplayOperation(FeedOperation::SPOOLER_REPLAY_COMPLETE, - serialNum, - spoolerSerialNum) + : SpoolerReplayOperation(FeedOperation::SPOOLER_REPLAY_COMPLETE, serialNum, spoolerSerialNum) { } - - } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/spoolerreplayoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/spoolerreplayoperation.h index 028d01dec20..028ad1c6bfa 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/spoolerreplayoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/spoolerreplayoperation.h @@ -11,15 +11,12 @@ private: SerialNum _spoolerSerialNum; protected: SpoolerReplayOperation(Type type); - SpoolerReplayOperation(Type type, - SerialNum serialNum, - SerialNum spoolerSerialNum); + SpoolerReplayOperation(Type type, SerialNum serialNum, SerialNum spoolerSerialNum); public: - virtual ~SpoolerReplayOperation() {} + ~SpoolerReplayOperation() override {} SerialNum getSpoolerSerialNum() const { return _spoolerSerialNum; } - virtual void serialize(vespalib::nbostream &os) const override; - virtual void deserialize(vespalib::nbostream &is, - const document::DocumentTypeRepo &) override { + void serialize(vespalib::nbostream &os) const override; + void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &) override { deserialize(is); } void deserialize(vespalib::nbostream &is); @@ -38,8 +35,7 @@ public: * @param serialNum the current serial number of the transaction log. * @param spoolerSerialNum the serial number of the first entry of the spooler log replay. */ - SpoolerReplayStartOperation(SerialNum serialNum, - SerialNum spoolerSerialNum); + SpoolerReplayStartOperation(SerialNum serialNum, SerialNum spoolerSerialNum); }; @@ -54,8 +50,7 @@ public: * @param serialNum the current serial number of the transaction log. * @param spoolerSerialNum the serial number of the last entry of the spooler log replay. */ - SpoolerReplayCompleteOperation(SerialNum serialNum, - SerialNum spoolerSerialNum); + SpoolerReplayCompleteOperation(SerialNum serialNum, SerialNum spoolerSerialNum); }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/wipehistoryoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/wipehistoryoperation.cpp index d7f38a0cc52..c5e6acd80ed 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/wipehistoryoperation.cpp +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/wipehistoryoperation.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "wipehistoryoperation.h" +#include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/util/stringfmt.h> using vespalib::make_string; @@ -9,29 +10,29 @@ namespace proton { WipeHistoryOperation::WipeHistoryOperation() : FeedOperation(FeedOperation::WIPE_HISTORY), - _wipeTimeLimit(0) { + _wipeTimeLimit(0) +{ } WipeHistoryOperation::WipeHistoryOperation(SerialNum serialNum, fastos::TimeStamp wipeTimeLimit) : FeedOperation(FeedOperation::WIPE_HISTORY), - _wipeTimeLimit(wipeTimeLimit) { + _wipeTimeLimit(wipeTimeLimit) +{ setSerialNum(serialNum); } void WipeHistoryOperation::serialize(vespalib::nbostream &str) const { str << _wipeTimeLimit; } -void WipeHistoryOperation::deserialize(vespalib::nbostream &str, - const document::DocumentTypeRepo &) { +void WipeHistoryOperation::deserialize(vespalib::nbostream &str, const document::DocumentTypeRepo &) { fastos::TimeStamp::TimeT t; str >> t; _wipeTimeLimit = t; } vespalib::string WipeHistoryOperation::toString() const { - return make_string("WipeHistory(wipeTimeLimit=%" PRIu64 - ", serialNum=%" PRIu64 ")", + return make_string("WipeHistory(wipeTimeLimit=%" PRIu64 ", serialNum=%" PRIu64 ")", _wipeTimeLimit.ns(), getSerialNum()); } diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/wipehistoryoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/wipehistoryoperation.h index 80b551dbd92..0cf7256bf27 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/wipehistoryoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/wipehistoryoperation.h @@ -12,14 +12,13 @@ class WipeHistoryOperation : public FeedOperation { public: WipeHistoryOperation(); WipeHistoryOperation(SerialNum serialNum, fastos::TimeStamp wipeTimeLimit); - virtual ~WipeHistoryOperation() {} + ~WipeHistoryOperation() override {} fastos::TimeStamp getWipeTimeLimit() const { return _wipeTimeLimit; } - virtual void serialize(vespalib::nbostream &str) const override; - virtual void deserialize(vespalib::nbostream &str, - const document::DocumentTypeRepo &) override; - virtual vespalib::string toString() const override; + void serialize(vespalib::nbostream &str) const override; + void deserialize(vespalib::nbostream &str, const document::DocumentTypeRepo &) override; + vespalib::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp index 987218beefa..6ed801154d8 100644 --- a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp @@ -3,7 +3,7 @@ #include "combiningfeedview.h" #include <vespa/document/fieldvalue/document.h> #include <vespa/searchcore/proton/documentmetastore/i_document_meta_store.h> -#include <vespa/searchcore/proton/feedoperation/moveoperation.h> +#include <vespa/searchcore/proton/feedoperation/operations.h> #include <vespa/searchlib/common/idestructorcallback.h> #include <vespa/log/log.h> @@ -13,17 +13,15 @@ using document::DocumentTypeRepo; using document::DocumentId; using search::IDestructorCallback; -namespace proton -{ +namespace proton { -namespace -{ +namespace { std::shared_ptr<const DocumentTypeRepo> getRepo(const std::vector<IFeedView::SP> &views) { for (const auto &view : views) { - if (view.get() == NULL) + if (view.get() == nullptr) continue; return view->getDocumentTypeRepo(); } diff --git a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.h b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.h index 6644f21a3b7..3546fdbea71 100644 --- a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.h +++ b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.h @@ -3,21 +3,14 @@ #pragma once #include "ifeedview.h" -#include <vespa/searchcore/proton/common/feedtoken.h> -#include <vespa/searchcore/proton/feedoperation/deletebucketoperation.h> -#include <vespa/searchcore/proton/feedoperation/joinbucketsoperation.h> -#include <vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.h> -#include <vespa/searchcore/proton/feedoperation/putoperation.h> -#include <vespa/searchcore/proton/feedoperation/removeoperation.h> -#include <vespa/searchcore/proton/feedoperation/splitbucketoperation.h> -#include <vespa/searchcore/proton/feedoperation/updateoperation.h> -#include <vespa/searchcore/proton/feedoperation/createbucketoperation.h> -#include <vespa/searchlib/common/serialnum.h> #include "replaypacketdispatcher.h" #include "ibucketstatecalculator.h" +#include <vespa/searchcore/proton/common/feedtoken.h> +#include <vespa/searchlib/common/serialnum.h> namespace proton { +class DocumentOperation; class CombiningFeedView : public IFeedView { diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index 61ce0e6dc6f..ad7a2d57c89 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -17,6 +17,7 @@ #include <vespa/searchcore/proton/attribute/imported_attributes_repo.h> #include <vespa/searchcore/proton/common/eventlogger.h> #include <vespa/searchcore/proton/common/statusreport.h> +#include <vespa/searchcore/proton/feedoperation/noopoperation.h> #include <vespa/searchcore/proton/index/index_writer.h> #include <vespa/searchcore/proton/initializer/task_runner.h> #include <vespa/searchcore/proton/metrics/attribute_metrics_collection.h> diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_feed_view.cpp b/searchcore/src/vespa/searchcore/proton/server/fast_access_feed_view.cpp index 6364e772f94..1c2406b2acf 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fast_access_feed_view.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_feed_view.cpp @@ -5,6 +5,7 @@ #include "operationdonecontext.h" #include "removedonecontext.h" #include "putdonecontext.h" +#include <vespa/searchcore/proton/feedoperation/operations.h> #include <vespa/searchlib/common/isequencedtaskexecutor.h> using document::Document; @@ -71,7 +72,7 @@ FastAccessFeedView::FastAccessFeedView(const StoreOnlyFeedView::Context &storeOn _docIdLimit(ctx._docIdLimit) {} -FastAccessFeedView::~FastAccessFeedView() {} +FastAccessFeedView::~FastAccessFeedView() = default; void FastAccessFeedView::handleCompactLidSpace(const CompactLidSpaceOperation &op) diff --git a/searchcore/src/vespa/searchcore/proton/server/feedstate.h b/searchcore/src/vespa/searchcore/proton/server/feedstate.h index 472f5cb224f..fa0a1702499 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedstate.h +++ b/searchcore/src/vespa/searchcore/proton/server/feedstate.h @@ -25,6 +25,7 @@ private: Type _type; protected: + using FeedOperationUP = std::unique_ptr<FeedOperation>; void throwExceptionInReceive(const vespalib::string &docType, uint64_t serialRangeFrom, uint64_t serialRangeTo, size_t packetSize); void throwExceptionInHandleOperation(const vespalib::string &docType, const FeedOperation &op); @@ -38,7 +39,7 @@ public: Type getType() const { return _type; } vespalib::string getName() const; - virtual void handleOperation(FeedToken token, std::unique_ptr<FeedOperation> op) = 0; + virtual void handleOperation(FeedToken token, FeedOperationUP op) = 0; virtual void receive(const PacketWrapper::SP &wrap, vespalib::Executor &executor) = 0; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp b/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp index f0866347f59..ae323bc93df 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp @@ -6,6 +6,7 @@ #include "ireplayconfig.h" #include "replaypacketdispatcher.h" #include <vespa/searchcore/proton/bucketdb/ibucketdbhandler.h> +#include <vespa/searchcore/proton/feedoperation/operations.h> #include <vespa/searchcore/proton/common/eventlogger.h> #include <vespa/searchlib/common/idestructorcallback.h> #include <vespa/vespalib/util/closuretask.h> diff --git a/searchcore/src/vespa/searchcore/proton/server/feedstates.h b/searchcore/src/vespa/searchcore/proton/server/feedstates.h index 963a78d0d6b..a9224669d87 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedstates.h +++ b/searchcore/src/vespa/searchcore/proton/server/feedstates.h @@ -28,16 +28,13 @@ public: { } - virtual void handleOperation(FeedToken, FeedOperation::UP op) override { + void handleOperation(FeedToken, FeedOperationUP op) override { throwExceptionInHandleOperation(_doc_type_name, *op); } - virtual void - receive(const PacketWrapper::SP &wrap, vespalib::Executor &) override { - throwExceptionInReceive(_doc_type_name.c_str(), - wrap->packet.range().from(), - wrap->packet.range().to(), - wrap->packet.size()); + void receive(const PacketWrapper::SP &wrap, vespalib::Executor &) override { + throwExceptionInReceive(_doc_type_name.c_str(), wrap->packet.range().from(), + wrap->packet.range().to(), wrap->packet.size()); } }; @@ -57,12 +54,11 @@ public: IReplayConfig &replay_config, FeedConfigStore &config_store); - virtual void handleOperation(FeedToken, FeedOperation::UP op) override { + void handleOperation(FeedToken, FeedOperationUP op) override { throwExceptionInHandleOperation(_doc_type_name, *op); } - virtual void receive(const PacketWrapper::SP &wrap, - vespalib::Executor &executor) override; + void receive(const PacketWrapper::SP &wrap, vespalib::Executor &executor) override; }; @@ -79,15 +75,13 @@ public: _handler(handler) { } - void handleOperation(FeedToken token, FeedOperation::UP op) override { + void handleOperation(FeedToken token, FeedOperationUP op) override { _handler.performOperation(std::move(token), std::move(op)); } void receive(const PacketWrapper::SP &wrap, vespalib::Executor &) override { - throwExceptionInReceive(_handler.getDocTypeName().c_str(), - wrap->packet.range().from(), - wrap->packet.range().to(), - wrap->packet.size()); + throwExceptionInReceive(_handler.getDocTypeName().c_str(), wrap->packet.range().from(), + wrap->packet.range().to(), wrap->packet.size()); } }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/ireplaypackethandler.h b/searchcore/src/vespa/searchcore/proton/server/ireplaypackethandler.h index 210ece3a36a..e93821e2a36 100644 --- a/searchcore/src/vespa/searchcore/proton/server/ireplaypackethandler.h +++ b/searchcore/src/vespa/searchcore/proton/server/ireplaypackethandler.h @@ -2,10 +2,28 @@ #pragma once -#include <vespa/searchcore/proton/feedoperation/operations.h> +namespace document { class DocumentTypeRepo; } namespace proton { +class PutOperation; +class RemoveOperation; +class UpdateOperation; +class NoopOperation; +class NewConfigOperation; +class WipeHistoryOperation; +class DeleteBucketOperation; +class SplitBucketOperation; +class JoinBucketsOperation; +class PruneRemovedDocumentsOperation; +class SpoolerReplayStartOperation; +class SpoolerReplayCompleteOperation; +class MoveOperation; +class CreateBucketOperation; +class CompactLidSpaceOperation; + +namespace feedoperation { class IStreamHandler; } + /** * Interface used to handle the various feed operations during * replay of the transaction log. @@ -29,7 +47,7 @@ struct IReplayPacketHandler virtual void replay(const CreateBucketOperation &op) = 0; virtual void replay(const CompactLidSpaceOperation &op) = 0; - virtual NewConfigOperation::IStreamHandler &getNewConfigStreamHandler() = 0; + virtual feedoperation::IStreamHandler &getNewConfigStreamHandler() = 0; virtual const document::DocumentTypeRepo &getDeserializeRepo() = 0; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/replaypacketdispatcher.cpp b/searchcore/src/vespa/searchcore/proton/server/replaypacketdispatcher.cpp index cdb42906fc2..42451f08315 100644 --- a/searchcore/src/vespa/searchcore/proton/server/replaypacketdispatcher.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/replaypacketdispatcher.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "replaypacketdispatcher.h" +#include <vespa/searchcore/proton/feedoperation/operations.h> #include <vespa/vespalib/util/exceptions.h> #include <vespa/document/util/serializableexceptions.h> diff --git a/searchcore/src/vespa/searchcore/proton/server/replaypacketdispatcher.h b/searchcore/src/vespa/searchcore/proton/server/replaypacketdispatcher.h index fc6f99471d8..771a79ddad9 100644 --- a/searchcore/src/vespa/searchcore/proton/server/replaypacketdispatcher.h +++ b/searchcore/src/vespa/searchcore/proton/server/replaypacketdispatcher.h @@ -7,6 +7,7 @@ namespace proton { +class FeedOperation; /** * Utility class that deserializes packet entries into feed operations * during replay from the transaction log and dispatches the feed operations @@ -22,14 +23,11 @@ private: void replay(OperationType &op, vespalib::nbostream &is, const Packet::Entry &entry); protected: - virtual void - store(const FeedOperation &op); + virtual void store(const FeedOperation &op); public: ReplayPacketDispatcher(IReplayPacketHandler &handler); - - virtual - ~ReplayPacketDispatcher(); + virtual ~ReplayPacketDispatcher(); void replayEntry(const Packet::Entry &entry); }; diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp index 29615b0daf9..22ff1b90de4 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp @@ -13,6 +13,7 @@ #include <vespa/searchcore/proton/documentmetastore/ilidreusedelayer.h> #include <vespa/searchcore/proton/reference/i_gid_to_lid_change_handler.h> #include <vespa/searchcore/proton/attribute/ifieldupdatecallback.h> +#include <vespa/searchcore/proton/feedoperation/operations.h> #include <vespa/searchlib/common/isequencedtaskexecutor.h> #include <vespa/document/datatype/documenttype.h> diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h index 825e14b4368..37f67399f4d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h @@ -13,7 +13,7 @@ #include <vespa/searchcore/proton/common/feeddebugger.h> #include <vespa/searchcore/proton/documentmetastore/documentmetastore.h> #include <vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h> -#include <vespa/searchcore/proton/feedoperation/feedoperation.h> +#include <vespa/searchcore/proton/feedoperation/lidvectorcontext.h> #include <vespa/searchcore/proton/persistenceengine/resulthandler.h> #include <vespa/searchcore/proton/reference/pending_notify_remove_done.h> #include <vespa/searchcorespi/index/ithreadingservice.h> @@ -23,7 +23,6 @@ namespace search { class IDestructorCallback; } -namespace document { class GLobalId; } namespace proton { @@ -35,6 +34,8 @@ class RemoveDoneContext; class CommitTimeTracker; class IGidToLidChangeHandler; class IFieldUpdateCallback; +class RemoveDocumentsOperation; +class DocumentOperation; namespace documentmetastore { class ILidReuseDelayer; } |