From 9c21ba2339433de72b58a99c856a68dd4de71d4e Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Tue, 29 Sep 2020 15:18:38 +0200 Subject: Add support for setting storage chain builder for distributor node. --- storage/src/vespa/storage/storageserver/distributornode.cpp | 6 +++++- storage/src/vespa/storage/storageserver/distributornode.h | 5 ++++- .../src/vespa/storageserver/app/distributorprocess.cpp | 12 ++++++++++-- .../src/vespa/storageserver/app/distributorprocess.h | 4 ++++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/storage/src/vespa/storage/storageserver/distributornode.cpp b/storage/src/vespa/storage/storageserver/distributornode.cpp index 3d1f9bbaf2e..8c2441b5eed 100644 --- a/storage/src/vespa/storage/storageserver/distributornode.cpp +++ b/storage/src/vespa/storage/storageserver/distributornode.cpp @@ -20,7 +20,8 @@ DistributorNode::DistributorNode( DistributorNodeContext& context, ApplicationGenerationFetcher& generationFetcher, NeedActiveState activeState, - StorageLink::UP communicationManager) + StorageLink::UP communicationManager, + std::unique_ptr storage_chain_builder) : StorageNode(configUri, context, generationFetcher, std::unique_ptr(new HostInfo()), communicationManager.get() == 0 ? NORMAL @@ -32,6 +33,9 @@ DistributorNode::DistributorNode( _manageActiveBucketCopies(activeState == NEED_ACTIVE_BUCKET_STATES_SET), _retrievedCommunicationManager(std::move(communicationManager)) { + if (storage_chain_builder) { + set_storage_chain_builder(std::move(storage_chain_builder)); + } try{ initialize(); } catch (const vespalib::NetworkSetupFailureException & e) { diff --git a/storage/src/vespa/storage/storageserver/distributornode.h b/storage/src/vespa/storage/storageserver/distributornode.h index 39614674bb5..2a5149aa8ac 100644 --- a/storage/src/vespa/storage/storageserver/distributornode.h +++ b/storage/src/vespa/storage/storageserver/distributornode.h @@ -15,6 +15,8 @@ namespace storage { +class IStorageChainBuilder; + class DistributorNode : public StorageNode, private UniqueTimeCalculator @@ -38,7 +40,8 @@ public: DistributorNodeContext&, ApplicationGenerationFetcher& generationFetcher, NeedActiveState, - std::unique_ptr communicationManager); + std::unique_ptr communicationManager, + std::unique_ptr storage_chain_builder); ~DistributorNode() override; const lib::NodeType& getNodeType() const override { return lib::NodeType::DISTRIBUTOR; } diff --git a/storageserver/src/vespa/storageserver/app/distributorprocess.cpp b/storageserver/src/vespa/storageserver/app/distributorprocess.cpp index d9972116559..e448c7c68bc 100644 --- a/storageserver/src/vespa/storageserver/app/distributorprocess.cpp +++ b/storageserver/src/vespa/storageserver/app/distributorprocess.cpp @@ -2,6 +2,7 @@ #include "distributorprocess.h" #include +#include #include #include @@ -11,7 +12,8 @@ namespace storage { DistributorProcess::DistributorProcess(const config::ConfigUri & configUri) : Process(configUri), - _activeFlag(DistributorNode::NO_NEED_FOR_ACTIVE_STATES) + _activeFlag(DistributorNode::NO_NEED_FOR_ACTIVE_STATES), + _storage_chain_builder() { } @@ -73,9 +75,15 @@ DistributorProcess::configUpdated() void DistributorProcess::createNode() { - _node.reset(new DistributorNode(_configUri, _context, *this, _activeFlag, StorageLink::UP())); + _node = std::make_unique(_configUri, _context, *this, _activeFlag, StorageLink::UP(), std::move(_storage_chain_builder)); _node->handleConfigChange(*_distributorConfigHandler->getConfig()); _node->handleConfigChange(*_visitDispatcherConfigHandler->getConfig()); } +void +DistributorProcess::set_storage_chain_builder(std::unique_ptr builder) +{ + _storage_chain_builder = std::move(builder); +} + } // storage diff --git a/storageserver/src/vespa/storageserver/app/distributorprocess.h b/storageserver/src/vespa/storageserver/app/distributorprocess.h index 4a2289e6151..21e7e9b534a 100644 --- a/storageserver/src/vespa/storageserver/app/distributorprocess.h +++ b/storageserver/src/vespa/storageserver/app/distributorprocess.h @@ -12,6 +12,8 @@ namespace storage { +class IStorageChainBuilder; + class DistributorProcess final : public Process { DistributorNodeContext _context; DistributorNode::NeedActiveState _activeFlag; @@ -20,6 +22,7 @@ class DistributorProcess final : public Process { _distributorConfigHandler; config::ConfigHandle::UP _visitDispatcherConfigHandler; + std::unique_ptr _storage_chain_builder; public: explicit DistributorProcess(const config::ConfigUri & configUri); @@ -35,6 +38,7 @@ public: std::string getComponentName() const override { return "distributor"; } virtual DistributorNodeContext& getDistributorContext() { return _context; } + void set_storage_chain_builder(std::unique_ptr builder); }; } // storage -- cgit v1.2.3