summaryrefslogtreecommitdiffstats
path: root/messagebus
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-07-24 14:59:54 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2017-07-24 14:59:54 +0000
commit17f9f8870efd698d1f82508d582a0dc9026453cd (patch)
tree1ce2c93fc297b0c9f2ccf7d0a441769e02b52d52 /messagebus
parent28cab783cf426758b4f878fcc523fddfef52eb6d (diff)
make_vespa_string -> make_string.
Diffstat (limited to 'messagebus')
-rw-r--r--messagebus/src/vespa/messagebus/routing/hopspec.cpp6
-rw-r--r--messagebus/src/vespa/messagebus/routing/policydirective.cpp9
-rw-r--r--messagebus/src/vespa/messagebus/routing/resender.cpp3
-rw-r--r--messagebus/src/vespa/messagebus/routing/routedirective.cpp5
-rw-r--r--messagebus/src/vespa/messagebus/routing/routespec.cpp4
-rw-r--r--messagebus/src/vespa/messagebus/routing/routingnode.cpp64
-rw-r--r--messagebus/src/vespa/messagebus/routing/routingspec.cpp4
-rw-r--r--messagebus/src/vespa/messagebus/routing/routingtablespec.cpp10
-rw-r--r--messagebus/src/vespa/messagebus/routing/verbatimdirective.cpp3
9 files changed, 48 insertions, 60 deletions
diff --git a/messagebus/src/vespa/messagebus/routing/hopspec.cpp b/messagebus/src/vespa/messagebus/routing/hopspec.cpp
index 4e05c5c7b90..ba18c24c92d 100644
--- a/messagebus/src/vespa/messagebus/routing/hopspec.cpp
+++ b/messagebus/src/vespa/messagebus/routing/hopspec.cpp
@@ -3,6 +3,8 @@
#include "routingspec.h"
#include <vespa/vespalib/util/stringfmt.h>
+using vespalib::make_string;
+
namespace mbus {
HopSpec::HopSpec(const string &name, const string &selector) :
@@ -46,9 +48,9 @@ HopSpec::toConfig(string &cfg, const string &prefix) const
}
uint32_t numRecipients = _recipients.size();
if (numRecipients > 0) {
- cfg.append(prefix).append("recipient[").append(vespalib::make_vespa_string("%d", numRecipients)).append("]\n");
+ cfg.append(prefix).append("recipient[").append(make_string("%d", numRecipients)).append("]\n");
for (uint32_t i = 0; i < numRecipients; ++i) {
- cfg.append(prefix).append("recipient[").append(vespalib::make_vespa_string("%d", i)).append("] ");
+ cfg.append(prefix).append("recipient[").append(make_string("%d", i)).append("] ");
cfg.append(RoutingSpec::toConfigString(_recipients[i])).append("\n");
}
}
diff --git a/messagebus/src/vespa/messagebus/routing/policydirective.cpp b/messagebus/src/vespa/messagebus/routing/policydirective.cpp
index 2c03cbfac03..3a95520a18b 100644
--- a/messagebus/src/vespa/messagebus/routing/policydirective.cpp
+++ b/messagebus/src/vespa/messagebus/routing/policydirective.cpp
@@ -2,6 +2,8 @@
#include "policydirective.h"
#include <vespa/vespalib/util/stringfmt.h>
+using vespalib::make_string;
+
namespace mbus {
PolicyDirective::PolicyDirective(const vespalib::stringref &name, const vespalib::stringref &param) :
@@ -15,16 +17,15 @@ string
PolicyDirective::toString() const
{
if (_param.empty()) {
- return vespalib::make_vespa_string("[%s]", _name.c_str());
+ return make_string("[%s]", _name.c_str());
}
- return vespalib::make_vespa_string("[%s:%s]", _name.c_str(), _param.c_str());
+ return make_string("[%s:%s]", _name.c_str(), _param.c_str());
}
string
PolicyDirective::toDebugString() const
{
- return vespalib::make_vespa_string("PolicyDirective(name = '%s', param = '%s')",
- _name.c_str(), _param.c_str());
+ return make_string("PolicyDirective(name = '%s', param = '%s')", _name.c_str(), _param.c_str());
}
} // mbus
diff --git a/messagebus/src/vespa/messagebus/routing/resender.cpp b/messagebus/src/vespa/messagebus/routing/resender.cpp
index 6608ef7012c..048d81b697e 100644
--- a/messagebus/src/vespa/messagebus/routing/resender.cpp
+++ b/messagebus/src/vespa/messagebus/routing/resender.cpp
@@ -85,8 +85,7 @@ Resender::scheduleRetry(RoutingNode &node)
node.prepareForRetry(); // consumes the reply
node.getTrace().trace(
TraceLevel::COMPONENT,
- vespalib::make_vespa_string("Message scheduled for retry %u in %.2f seconds.",
- retry, delay));
+ vespalib::make_string("Message scheduled for retry %u in %.2f seconds.", retry, delay));
msg.setRetry(retry);
_queue.push(Entry((uint64_t)(_time.MilliSecsToNow() + delay * 1000), &node));
return true;
diff --git a/messagebus/src/vespa/messagebus/routing/routedirective.cpp b/messagebus/src/vespa/messagebus/routing/routedirective.cpp
index a54ce78bea2..c926c20fb1c 100644
--- a/messagebus/src/vespa/messagebus/routing/routedirective.cpp
+++ b/messagebus/src/vespa/messagebus/routing/routedirective.cpp
@@ -22,14 +22,13 @@ RouteDirective::matches(const IHopDirective &dir) const
string
RouteDirective::toString() const
{
- return vespalib::make_vespa_string("route:%s", _name.c_str());
+ return vespalib::make_string("route:%s", _name.c_str());
}
string
RouteDirective::toDebugString() const
{
- return vespalib::make_vespa_string("RouteDirective(name = '%s')",
- _name.c_str());
+ return vespalib::make_string("RouteDirective(name = '%s')", _name.c_str());
}
} // mbus
diff --git a/messagebus/src/vespa/messagebus/routing/routespec.cpp b/messagebus/src/vespa/messagebus/routing/routespec.cpp
index 1f3ed380bee..4762dd4a394 100644
--- a/messagebus/src/vespa/messagebus/routing/routespec.cpp
+++ b/messagebus/src/vespa/messagebus/routing/routespec.cpp
@@ -36,9 +36,9 @@ RouteSpec::toConfig(string &cfg, const string &prefix) const
cfg.append(prefix).append("name ").append(RoutingSpec::toConfigString(_name)).append("\n");
uint32_t numHops = _hops.size();
if (numHops > 0) {
- cfg.append(prefix).append("hop[").append(vespalib::make_vespa_string("%d", numHops)).append("]\n");
+ cfg.append(prefix).append("hop[").append(vespalib::make_string("%d", numHops)).append("]\n");
for (uint32_t i = 0; i < numHops; ++i) {
- cfg.append(prefix).append("hop[").append(vespalib::make_vespa_string("%d", i)).append("] ");
+ cfg.append(prefix).append("hop[").append(vespalib::make_string("%d", i)).append("] ");
cfg.append(RoutingSpec::toConfigString(_hops[i])).append("\n");
}
}
diff --git a/messagebus/src/vespa/messagebus/routing/routingnode.cpp b/messagebus/src/vespa/messagebus/routing/routingnode.cpp
index a3a9936b7d2..0f24b47cb94 100644
--- a/messagebus/src/vespa/messagebus/routing/routingnode.cpp
+++ b/messagebus/src/vespa/messagebus/routing/routingnode.cpp
@@ -8,9 +8,12 @@
#include <vespa/messagebus/errorcode.h>
#include <vespa/messagebus/tracelevel.h>
#include <vespa/vespalib/util/atomic.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/messagebus/network/inetwork.h>
#include <stack>
+using vespalib::make_string;
+
namespace mbus {
RoutingNode::RoutingNode(MessageBus &mbus, INetwork &net, Resender *resender,
@@ -287,20 +290,16 @@ RoutingNode::notifyMerge()
// Execute the {@link RoutingPolicy#merge(RoutingContext)} method of the current routing policy. If a
// policy fails to produce a reply, this attaches an error reply to this node.
const PolicyDirective &dir = _routingContext->getDirective();
- _trace.trace(TraceLevel::SPLIT_MERGE, vespalib::make_vespa_string(
- "Routing policy '%s' merging replies.",
- dir.getName().c_str()));
+ _trace.trace(TraceLevel::SPLIT_MERGE, make_string("Routing policy '%s' merging replies.", dir.getName().c_str()));
try {
_policy->merge(*_routingContext);
} catch (const std::exception &e) {
- setError(ErrorCode::POLICY_ERROR, vespalib::make_vespa_string(
- "Policy '%s' threw an exception; %s",
- dir.getName().c_str(), e.what()));
+ setError(ErrorCode::POLICY_ERROR, make_string("Policy '%s' threw an exception; %s",
+ dir.getName().c_str(), e.what()));
}
if (_reply.get() == NULL) {
- setError(ErrorCode::APP_FATAL_ERROR, vespalib::make_vespa_string(
- "Routing policy '%s' failed to merge replies.",
- dir.getName().c_str()));
+ setError(ErrorCode::APP_FATAL_ERROR, make_string("Routing policy '%s' failed to merge replies.",
+ dir.getName().c_str()));
}
// Notifies the parent node.
@@ -392,8 +391,7 @@ RoutingNode::lookupHop()
const HopBlueprint *hop = table->getHop(name);
configureFromBlueprint(*hop);
_trace.trace(TraceLevel::SPLIT_MERGE,
- vespalib::make_vespa_string("Recognized '%s' as %s.",
- name.c_str(), hop->toString().c_str()));
+ make_string("Recognized '%s' as %s.", name.c_str(), hop->toString().c_str()));
return true;
}
}
@@ -409,14 +407,13 @@ RoutingNode::lookupRoute()
RouteDirective &dir = static_cast<RouteDirective&>(*hop.getDirective(0));
if (table.get() == NULL || !table->hasRoute(dir.getName())) {
setError(ErrorCode::ILLEGAL_ROUTE,
- vespalib::make_vespa_string("Route '%s' does not exist.",
- dir.getName().c_str()));
+ make_string("Route '%s' does not exist.", dir.getName().c_str()));
return false;
}
insertRoute(*table->getRoute(dir.getName()));
_trace.trace(TraceLevel::SPLIT_MERGE,
- vespalib::make_vespa_string("Route '%s' retrieved by directive; new route is '%s'.",
- dir.getName().c_str(), _route.toString().c_str()));
+ make_string("Route '%s' retrieved by directive; new route is '%s'.",
+ dir.getName().c_str(), _route.toString().c_str()));
return true;
}
if (table.get() != NULL) {
@@ -424,8 +421,7 @@ RoutingNode::lookupRoute()
if (table->hasRoute(name)) {
insertRoute(*table->getRoute(name));
_trace.trace(TraceLevel::SPLIT_MERGE,
- vespalib::make_vespa_string("Recognized '%s' as route '%s'.",
- name.c_str(), _route.toString().c_str()));
+ make_string("Recognized '%s' as route '%s'.", name.c_str(), _route.toString().c_str()));
return true;
}
}
@@ -480,36 +476,27 @@ RoutingNode::executePolicySelect()
const PolicyDirective &dir = _routingContext->getDirective();
_policy = _mbus.getRoutingPolicy(_msg.getProtocol(), dir.getName(), dir.getParam());
if (_policy.get() == NULL) {
- setError(ErrorCode::UNKNOWN_POLICY, vespalib::make_vespa_string(
- "Protocol '%s' could not create routing policy "
- "'%s' with parameter '%s'.",
- _msg.getProtocol().c_str(), dir.getName().c_str(),
- dir.getParam().c_str()));
+ setError(ErrorCode::UNKNOWN_POLICY, make_string(
+ "Protocol '%s' could not create routing policy '%s' with parameter '%s'.",
+ _msg.getProtocol().c_str(), dir.getName().c_str(), dir.getParam().c_str()));
return false;
}
- _trace.trace(TraceLevel::SPLIT_MERGE, vespalib::make_vespa_string(
- "Running routing policy '%s'.",
- dir.getName().c_str()));
+ _trace.trace(TraceLevel::SPLIT_MERGE, make_string("Running routing policy '%s'.", dir.getName().c_str()));
try {
_policy->select(*_routingContext);
} catch (const std::exception &e) {
- setError(ErrorCode::POLICY_ERROR, vespalib::make_vespa_string(
- "Policy '%s' threw an exception; %s",
- dir.getName().c_str(), e.what()));
+ setError(ErrorCode::POLICY_ERROR, make_string("Policy '%s' threw an exception; %s",
+ dir.getName().c_str(), e.what()));
return false;
}
if (_children.empty()) {
if (_reply.get() == NULL) {
setError(ErrorCode::NO_SERVICES_FOR_ROUTE,
- vespalib::make_vespa_string(
- "Policy '%s' selected no recipients for "
- "route '%s'.",
- dir.getName().c_str(), _route.toString().c_str()));
+ make_string("Policy '%s' selected no recipients for route '%s'.",
+ dir.getName().c_str(), _route.toString().c_str()));
} else {
_trace.trace(TraceLevel::SPLIT_MERGE,
- vespalib::make_vespa_string(
- "Policy '%s' assigned a reply to this branch.",
- dir.getName().c_str()));
+ make_string("Policy '%s' assigned a reply to this branch.", dir.getName().c_str()));
}
return false;
}
@@ -519,8 +506,8 @@ RoutingNode::executePolicySelect()
RoutingNode *child = *it;
Hop &hop = child->_route.getHop(0);
child->_trace.trace(TraceLevel::SPLIT_MERGE,
- vespalib::make_vespa_string("Component '%s' selected by policy '%s'.",
- hop.toString().c_str(), dir.getName().c_str()));
+ make_string("Component '%s' selected by policy '%s'.",
+ hop.toString().c_str(), dir.getName().c_str()));
}
return true;
}
@@ -535,7 +522,7 @@ RoutingNode::resolveChildren(uint32_t childDepth)
{
RoutingNode *child = *it;
child->_trace.trace(TraceLevel::SPLIT_MERGE,
- vespalib::make_vespa_string("Resolving '%s'.", child->_route.toString().c_str()));
+ make_string("Resolving '%s'.", child->_route.toString().c_str()));
child->_isActive = (child->_reply.get() == NULL);
if (child->_isActive) {
++numActiveChildren;
@@ -591,4 +578,3 @@ RoutingNode::shouldIgnoreResult()
}
} // namespace mbus
-
diff --git a/messagebus/src/vespa/messagebus/routing/routingspec.cpp b/messagebus/src/vespa/messagebus/routing/routingspec.cpp
index 8079bb5c83e..55cde6c6d82 100644
--- a/messagebus/src/vespa/messagebus/routing/routingspec.cpp
+++ b/messagebus/src/vespa/messagebus/routing/routingspec.cpp
@@ -45,9 +45,9 @@ RoutingSpec::toConfig(string &cfg, const string &prefix) const
{
uint32_t numTables = _tables.size();
if (numTables > 0) {
- cfg.append(prefix).append("routingtable[").append(vespalib::make_vespa_string("%d", numTables)).append("]\n");
+ cfg.append(prefix).append("routingtable[").append(vespalib::make_string("%d", numTables)).append("]\n");
for (uint32_t i = 0; i < numTables; ++i) {
- _tables[i].toConfig(cfg, vespalib::make_vespa_string("%sroutingtable[%d].", prefix.c_str(), i));
+ _tables[i].toConfig(cfg, vespalib::make_string("%sroutingtable[%d].", prefix.c_str(), i));
}
}
}
diff --git a/messagebus/src/vespa/messagebus/routing/routingtablespec.cpp b/messagebus/src/vespa/messagebus/routing/routingtablespec.cpp
index 08ebdc4ec0c..40e99bf3ef7 100644
--- a/messagebus/src/vespa/messagebus/routing/routingtablespec.cpp
+++ b/messagebus/src/vespa/messagebus/routing/routingtablespec.cpp
@@ -2,6 +2,8 @@
#include "routingspec.h"
#include <vespa/vespalib/util/stringfmt.h>
+using vespalib::make_string;
+
namespace mbus {
RoutingTableSpec::RoutingTableSpec(const string &protocol) :
@@ -34,16 +36,16 @@ RoutingTableSpec::toConfig(string &cfg, const string &prefix) const
cfg.append(prefix).append("protocol ").append(RoutingSpec::toConfigString(_protocol)).append("\n");
uint32_t numHops = _hops.size();
if (numHops > 0) {
- cfg.append(prefix).append("hop[").append(vespalib::make_vespa_string("%d", numHops)).append("]\n");
+ cfg.append(prefix).append("hop[").append(make_string("%d", numHops)).append("]\n");
for (uint32_t i = 0; i < numHops; ++i) {
- _hops[i].toConfig(cfg, vespalib::make_vespa_string("%shop[%d].", prefix.c_str(), i));
+ _hops[i].toConfig(cfg, make_string("%shop[%d].", prefix.c_str(), i));
}
}
uint32_t numRoutes = _routes.size();
if (numRoutes > 0) {
- cfg.append(prefix).append("route[").append(vespalib::make_vespa_string("%d", numRoutes)).append("]\n");
+ cfg.append(prefix).append("route[").append(make_string("%d", numRoutes)).append("]\n");
for (uint32_t i = 0; i < numRoutes; ++i) {
- _routes[i].toConfig(cfg, vespalib::make_vespa_string("%sroute[%d].", prefix.c_str(), i));
+ _routes[i].toConfig(cfg, make_string("%sroute[%d].", prefix.c_str(), i));
}
}
}
diff --git a/messagebus/src/vespa/messagebus/routing/verbatimdirective.cpp b/messagebus/src/vespa/messagebus/routing/verbatimdirective.cpp
index d1c0f4c9986..86f50d897a5 100644
--- a/messagebus/src/vespa/messagebus/routing/verbatimdirective.cpp
+++ b/messagebus/src/vespa/messagebus/routing/verbatimdirective.cpp
@@ -28,8 +28,7 @@ VerbatimDirective::toString() const
string
VerbatimDirective::toDebugString() const
{
- return vespalib::make_vespa_string("VerbatimDirective(image = '%s')",
- _image.c_str());
+ return vespalib::make_string("VerbatimDirective(image = '%s')", _image.c_str());
}
} // mbus