diff options
author | Tor Egge <Tor.Egge@oath.com> | 2017-11-10 16:55:44 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2017-11-10 16:55:44 +0000 |
commit | 0083a9f6278315d1686700072b4879ea5ffca46b (patch) | |
tree | 21e60394ba21fc24e658f9b121953fb3453f6e68 | |
parent | 3665c480590ead529527d5bfc9f2445e0eabdfa3 (diff) |
Add using statements for OutdatedNodes and OutdatedNodesMap in nested
namespace.
Reduce number of arguments to PendingBucketSpaceDbTransition constructor.
7 files changed, 37 insertions, 18 deletions
diff --git a/storage/src/vespa/storage/distributor/bucketdbupdater.h b/storage/src/vespa/storage/distributor/bucketdbupdater.h index 6399519e5f8..ee07c46754f 100644 --- a/storage/src/vespa/storage/distributor/bucketdbupdater.h +++ b/storage/src/vespa/storage/distributor/bucketdbupdater.h @@ -7,6 +7,7 @@ #include "distributormessagesender.h" #include "pendingclusterstate.h" #include "distributor_bucket_space_component.h" +#include "outdated_nodes_map.h" #include <vespa/document/bucket/bucketid.h> #include <vespa/storageapi/messageapi/returncode.h> #include <vespa/storageapi/message/bucket.h> @@ -27,8 +28,8 @@ class BucketDBUpdater : public framework::StatusReporter, public api::MessageHandler { public: - using OutdatedNodes = std::unordered_set<uint16_t>; - using OutdatedNodesMap = std::unordered_map<document::BucketSpace, OutdatedNodes, document::BucketSpace::hash>; + using OutdatedNodes = dbtransition::OutdatedNodes; + using OutdatedNodesMap = dbtransition::OutdatedNodesMap; BucketDBUpdater(Distributor& owner, DistributorBucketSpaceRepo &bucketSpaceRepo, DistributorBucketSpace& bucketSpace, diff --git a/storage/src/vespa/storage/distributor/outdated_nodes.h b/storage/src/vespa/storage/distributor/outdated_nodes.h new file mode 100644 index 00000000000..fddb1806d82 --- /dev/null +++ b/storage/src/vespa/storage/distributor/outdated_nodes.h @@ -0,0 +1,11 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +#include <unordered_set> + +namespace storage::distributor::dbtransition { + +using OutdatedNodes = std::unordered_set<uint16_t>; + +} diff --git a/storage/src/vespa/storage/distributor/outdated_nodes_map.h b/storage/src/vespa/storage/distributor/outdated_nodes_map.h new file mode 100644 index 00000000000..8d08b20732b --- /dev/null +++ b/storage/src/vespa/storage/distributor/outdated_nodes_map.h @@ -0,0 +1,13 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +#include "outdated_nodes.h" +#include <vespa/document/bucket/bucketspace.h> +#include <unordered_map> + +namespace storage::distributor::dbtransition { + +using OutdatedNodesMap = std::unordered_map<document::BucketSpace, OutdatedNodes, document::BucketSpace::hash>; + +} diff --git a/storage/src/vespa/storage/distributor/pending_bucket_space_db_transition.cpp b/storage/src/vespa/storage/distributor/pending_bucket_space_db_transition.cpp index 506c2b1e4a3..ed9c8bc222b 100644 --- a/storage/src/vespa/storage/distributor/pending_bucket_space_db_transition.cpp +++ b/storage/src/vespa/storage/distributor/pending_bucket_space_db_transition.cpp @@ -18,11 +18,9 @@ using lib::NodeState; PendingBucketSpaceDbTransition::PendingBucketSpaceDbTransition(const PendingClusterState &pendingClusterState, DistributorBucketSpace &distributorBucketSpace, - int distributorIndex, bool distributionChanged, const OutdatedNodes &outdatedNodes, std::shared_ptr<const ClusterInformation> clusterInfo, - const lib::ClusterState &prevClusterState, const lib::ClusterState &newClusterState, api::Timestamp creationTimestamp) : _entries(), @@ -31,12 +29,12 @@ PendingBucketSpaceDbTransition::PendingBucketSpaceDbTransition(const PendingClus _missingEntries(), _clusterInfo(std::move(clusterInfo)), _outdatedNodes(newClusterState.getNodeCount(NodeType::STORAGE)), - _prevClusterState(prevClusterState), + _prevClusterState(_clusterInfo->getClusterState()), _newClusterState(newClusterState), _creationTimestamp(creationTimestamp), _pendingClusterState(pendingClusterState), _distributorBucketSpace(distributorBucketSpace), - _distributorIndex(distributorIndex), + _distributorIndex(_clusterInfo->getDistributorIndex()), _bucketOwnershipTransfer(distributionChanged) { if (distributorChanged()) { diff --git a/storage/src/vespa/storage/distributor/pending_bucket_space_db_transition.h b/storage/src/vespa/storage/distributor/pending_bucket_space_db_transition.h index 0619218b6a4..903f9b762fb 100644 --- a/storage/src/vespa/storage/distributor/pending_bucket_space_db_transition.h +++ b/storage/src/vespa/storage/distributor/pending_bucket_space_db_transition.h @@ -2,8 +2,8 @@ #pragma once #include "pending_bucket_space_db_transition_entry.h" +#include "outdated_nodes.h" #include <vespa/storage/bucketdb/bucketdatabase.h> -#include <unordered_set> namespace storage::api { class RequestBucketInfoReply; } namespace storage::lib { class ClusterState; class State; } @@ -24,7 +24,7 @@ class PendingBucketSpaceDbTransition : public BucketDatabase::MutableEntryProces public: using Entry = dbtransition::Entry; using EntryList = std::vector<Entry>; - using OutdatedNodes = std::unordered_set<uint16_t>; + using OutdatedNodes = dbtransition::OutdatedNodes; private: using Range = std::pair<uint32_t, uint32_t>; @@ -46,7 +46,7 @@ private: const api::Timestamp _creationTimestamp; const PendingClusterState &_pendingClusterState; DistributorBucketSpace &_distributorBucketSpace; - int _distributorIndex; + uint16_t _distributorIndex; bool _bucketOwnershipTransfer; // BucketDataBase::MutableEntryProcessor API @@ -92,11 +92,9 @@ private: public: PendingBucketSpaceDbTransition(const PendingClusterState &pendingClusterState, DistributorBucketSpace &distributorBucketSpace, - int distributorIndex, bool distributionChanged, const OutdatedNodes &outdatedNodes, std::shared_ptr<const ClusterInformation> clusterInfo, - const lib::ClusterState &prevClusterState, const lib::ClusterState &newClusterState, api::Timestamp creationTimestamp); ~PendingBucketSpaceDbTransition(); diff --git a/storage/src/vespa/storage/distributor/pendingclusterstate.cpp b/storage/src/vespa/storage/distributor/pendingclusterstate.cpp index f8a80569e1d..daa85822264 100644 --- a/storage/src/vespa/storage/distributor/pendingclusterstate.cpp +++ b/storage/src/vespa/storage/distributor/pendingclusterstate.cpp @@ -76,10 +76,8 @@ PendingClusterState::initializeBucketSpaceTransitions(bool distributionChanged, const auto &outdatedNodes = (onItr == outdatedNodesMap.end()) ? emptyOutdatedNodes : onItr->second; auto pendingTransition = std::make_unique<PendingBucketSpaceDbTransition> - (*this, *elem.second, - _sender.getDistributorIndex(), distributionChanged, - outdatedNodes, - _clusterInfo, _prevClusterState, _newClusterState, _creationTimestamp); + (*this, *elem.second, distributionChanged, outdatedNodes, + _clusterInfo, _newClusterState, _creationTimestamp); if (pendingTransition->getBucketOwnershipTransfer()) { _bucketOwnershipTransfer = true; } diff --git a/storage/src/vespa/storage/distributor/pendingclusterstate.h b/storage/src/vespa/storage/distributor/pendingclusterstate.h index 460f25324d4..7a23d48c9fd 100644 --- a/storage/src/vespa/storage/distributor/pendingclusterstate.h +++ b/storage/src/vespa/storage/distributor/pendingclusterstate.h @@ -9,7 +9,7 @@ #include <vespa/storageframework/generic/clock/clock.h> #include <vespa/vdslib/distribution/distribution.h> #include <vespa/vespalib/util/xmlserializable.h> -#include <unordered_set> +#include "outdated_nodes_map.h" #include <unordered_map> #include <deque> @@ -25,8 +25,8 @@ class DistributorBucketSpaceRepo; */ class PendingClusterState : public vespalib::XmlSerializable { public: - using OutdatedNodes = std::unordered_set<uint16_t>; - using OutdatedNodesMap = std::unordered_map<document::BucketSpace, OutdatedNodes, document::BucketSpace::hash>; + using OutdatedNodes = dbtransition::OutdatedNodes; + using OutdatedNodesMap = dbtransition::OutdatedNodesMap; struct Summary { Summary(const std::string& prevClusterState, const std::string& newClusterState, uint32_t processingTime); Summary(const Summary &); |