aboutsummaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-11-25 16:52:57 +0100
committerGitHub <noreply@github.com>2020-11-25 16:52:57 +0100
commit3ca30562411372bb23d3d871a24111e20f79892b (patch)
treedff3e2d37a539dabc9477247554e7387bbb7b401 /storage
parent9b6a40a34d92bb723587b55fad9b4954dc5f275d (diff)
parente9e1b5ef1e6cd77ff5e198ac2ff70449499371af (diff)
Merge pull request #15466 from vespa-engine/geirst/simplify-storage-message-address
Simplify storage message address
Diffstat (limited to 'storage')
-rw-r--r--storage/src/vespa/storage/storageserver/communicationmanager.cpp4
-rw-r--r--storage/src/vespa/storage/visiting/visitor.cpp13
-rw-r--r--storage/src/vespa/storage/visiting/visitor.h18
-rw-r--r--storage/src/vespa/storage/visiting/visitorthread.cpp27
4 files changed, 31 insertions, 31 deletions
diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.cpp b/storage/src/vespa/storage/storageserver/communicationmanager.cpp
index 33f50b7934e..c296f215c8c 100644
--- a/storage/src/vespa/storage/storageserver/communicationmanager.cpp
+++ b/storage/src/vespa/storage/storageserver/communicationmanager.cpp
@@ -584,7 +584,7 @@ CommunicationManager::sendCommand(
cmd->setRetryEnabled(false);
cmd->setTimeRemaining(msg->getTimeout());
cmd->setTrace(msg->steal_trace());
- sendMessageBusMessage(msg, std::move(cmd), address.getRoute());
+ sendMessageBusMessage(msg, std::move(cmd), address.to_mbus_route());
}
break;
}
@@ -603,7 +603,7 @@ CommunicationManager::sendCommand(
std::lock_guard lock(_messageBusSentLock);
_messageBusSent[msg->getMsgId()] = msg;
}
- sendMessageBusMessage(msg, std::move(mbusMsg), address.getRoute());
+ sendMessageBusMessage(msg, std::move(mbusMsg), address.to_mbus_route());
break;
} else {
LOGBM(warning, "This type of message can't be sent via messagebus");
diff --git a/storage/src/vespa/storage/visiting/visitor.cpp b/storage/src/vespa/storage/visiting/visitor.cpp
index 7cb61e6d0a8..16a9b26a754 100644
--- a/storage/src/vespa/storage/visiting/visitor.cpp
+++ b/storage/src/vespa/storage/visiting/visitor.cpp
@@ -222,7 +222,7 @@ Visitor::sendMessage(documentapi::DocumentMessage::UP cmd)
{
assert(cmd.get());
if (!isRunning()) return;
- cmd->setRoute(_dataDestination->getRoute());
+ cmd->setRoute(*_dataDestination);
cmd->setPriority(_documentPriority);
@@ -291,7 +291,7 @@ Visitor::sendInfoMessage(documentapi::VisitorInfoMessage::UP cmd)
if (!isRunning()) return;
if (_controlDestination->toString().length()) {
- cmd->setRoute(_controlDestination->getRoute());
+ cmd->setRoute(*_controlDestination);
cmd->setPriority(_documentPriority);
cmd->setTimeRemaining(std::chrono::milliseconds(_visitorInfoTimeout.getTime()));
auto& msgMeta = _visitorTarget.insertMessage(std::move(cmd));
@@ -554,8 +554,8 @@ Visitor::start(api::VisitorId id, api::StorageMessage::Id cmdId,
void
Visitor::attach(std::shared_ptr<api::StorageCommand> initiatingCmd,
- const api::StorageMessageAddress& controlAddress,
- const api::StorageMessageAddress& dataAddress,
+ const mbus::Route& controlAddress,
+ const mbus::Route& dataAddress,
framework::MilliSecTime timeout)
{
_priority = initiatingCmd->getPriority();
@@ -569,9 +569,8 @@ Visitor::attach(std::shared_ptr<api::StorageCommand> initiatingCmd,
_traceLevel = _initiatingCmd->getTrace().getLevel();
{
// Set new address
- _controlDestination.reset(
- new api::StorageMessageAddress(controlAddress));
- _dataDestination.reset(new api::StorageMessageAddress(dataAddress));
+ _controlDestination = std::make_unique<mbus::Route>(controlAddress);
+ _dataDestination = std::make_unique<mbus::Route>(dataAddress);
}
LOG(debug, "Visitor '%s' has control destination %s and data "
"destination %s.",
diff --git a/storage/src/vespa/storage/visiting/visitor.h b/storage/src/vespa/storage/visiting/visitor.h
index 8a1f675a4c5..8eb02e6ccfc 100644
--- a/storage/src/vespa/storage/visiting/visitor.h
+++ b/storage/src/vespa/storage/visiting/visitor.h
@@ -330,8 +330,8 @@ protected:
documentapi::Priority::Value _documentPriority;
std::string _id;
- std::unique_ptr<api::StorageMessageAddress> _controlDestination;
- std::unique_ptr<api::StorageMessageAddress> _dataDestination;
+ std::unique_ptr<mbus::Route> _controlDestination;
+ std::unique_ptr<mbus::Route> _dataDestination;
std::shared_ptr<document::select::Node> _documentSelection;
std::string _documentSelectionString;
vdslib::VisitorStatistics _visitorStatistics;
@@ -355,10 +355,12 @@ public:
framework::MicroSecTime getStartTime() const { return _startTime; }
api::VisitorId getVisitorId() const { return _visitorId; }
const std::string& getVisitorName() const { return _id; }
- const api::StorageMessageAddress* getControlDestination() const
- { return _controlDestination.get(); } // Can't be null if attached
- const api::StorageMessageAddress* getDataDestination() const
- { return _dataDestination.get(); } // Can't be null if attached
+ const mbus::Route* getControlDestination() const {
+ return _controlDestination.get(); // Can't be null if attached
+ }
+ const mbus::Route* getDataDestination() const {
+ return _dataDestination.get(); // Can't be null if attached
+ }
void setMaxPending(unsigned int maxPending)
{ _visitorOptions._maxPending = maxPending; }
@@ -471,8 +473,8 @@ public:
documentapi::Priority::Value);
void attach(std::shared_ptr<api::StorageCommand> initiatingCmd,
- const api::StorageMessageAddress& controlAddress,
- const api::StorageMessageAddress& dataAddress,
+ const mbus::Route& controlAddress,
+ const mbus::Route& dataAddress,
framework::MilliSecTime timeout);
void handleDocumentApiReply(mbus::Reply::UP reply,
diff --git a/storage/src/vespa/storage/visiting/visitorthread.cpp b/storage/src/vespa/storage/visiting/visitorthread.cpp
index 50f7e76b149..2839d3566aa 100644
--- a/storage/src/vespa/storage/visiting/visitorthread.cpp
+++ b/storage/src/vespa/storage/visiting/visitorthread.cpp
@@ -382,19 +382,18 @@ VisitorThread::createVisitor(vespalib::stringref libName,
}
namespace {
- std::unique_ptr<api::StorageMessageAddress>
- getDataAddress(const api::CreateVisitorCommand& cmd)
- {
- return std::make_unique<api::StorageMessageAddress>(
- mbus::Route::parse(cmd.getDataDestination()));
- }
- std::unique_ptr<api::StorageMessageAddress>
- getControlAddress(const api::CreateVisitorCommand& cmd)
- {
- return std::make_unique<api::StorageMessageAddress>(
- mbus::Route::parse(cmd.getControlDestination()));
- }
+std::unique_ptr<mbus::Route>
+getDataAddress(const api::CreateVisitorCommand& cmd)
+{
+ return std::make_unique<mbus::Route>(mbus::Route::parse(cmd.getDataDestination()));
+}
+
+std::unique_ptr<mbus::Route>
+getControlAddress(const api::CreateVisitorCommand& cmd)
+{
+ return std::make_unique<mbus::Route>(mbus::Route::parse(cmd.getControlDestination()));
+}
void
validateDocumentSelection(const document::DocumentTypeRepo& repo,
@@ -424,8 +423,8 @@ VisitorThread::onCreateVisitor(
assert(_currentlyRunningVisitor == _visitors.end());
ReturnCode result(ReturnCode::OK);
std::unique_ptr<document::select::Node> docSelection;
- std::unique_ptr<api::StorageMessageAddress> controlAddress;
- std::unique_ptr<api::StorageMessageAddress> dataAddress;
+ std::unique_ptr<mbus::Route> controlAddress;
+ std::unique_ptr<mbus::Route> dataAddress;
std::shared_ptr<Visitor> visitor;
do {
// If no buckets are specified, fail command