summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2020-11-25 12:24:02 +0000
committerGeir Storli <geirst@verizonmedia.com>2020-11-25 12:24:02 +0000
commitaa903bfbf23d3b855d50de185a15d8061825c778 (patch)
tree3e198180e8af127ee262d497bfb96ff730fad58e /storage
parent0a3e84915073809b90ba7f0adb475321f7e2d576 (diff)
Change control and data destination to use mbus::Route directly.
Diffstat (limited to 'storage')
-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
3 files changed, 29 insertions, 29 deletions
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