summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHÃ¥vard Pettersen <havardpe@gmail.com>2017-08-24 10:49:23 +0200
committerGitHub <noreply@github.com>2017-08-24 10:49:22 +0200
commit94b86e00a183b4a87b708d2d075d27311a112d15 (patch)
tree6871ee417395f8efe74636b17f39c7886caefb36
parent556d96bf088eaf8ffcba608157a5d888a8efc3f4 (diff)
parentbe27e02909429150076fc5e2a1cc0d5ded724092 (diff)
Merge pull request #3198 from vespa-engine/balder/stick-to-make_string-all-over
Balder/stick to make string all over
-rw-r--r--documentapi/src/vespa/documentapi/common.h1
-rw-r--r--messagebus/src/tests/advancedrouting/advancedrouting.cpp4
-rw-r--r--messagebus/src/tests/messagebus/messagebus.cpp12
-rw-r--r--messagebus/src/tests/messageordering/messageordering.cpp14
-rw-r--r--messagebus/src/tests/routingcontext/routingcontext.cpp37
-rw-r--r--messagebus/src/tests/serviceaddress/serviceaddress.cpp1
-rw-r--r--messagebus/src/tests/shutdown/shutdown.cpp1
-rw-r--r--messagebus/src/vespa/messagebus/testlib/custompolicy.cpp7
-rw-r--r--messagebus/src/vespa/messagebus/testlib/custompolicy.h1
-rw-r--r--persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp14
-rw-r--r--searchcore/src/apps/tests/persistenceconformance_test.cpp5
-rw-r--r--searchcore/src/tests/proton/documentdb/documentdb_test.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/proton.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/tlcproxy.cpp10
-rw-r--r--searchlib/src/tests/transactionlog/translogclient_test.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/features/foreachfeature.cpp11
-rw-r--r--searchlib/src/vespa/searchlib/fef/parametervalidator.cpp26
-rw-r--r--searchlib/src/vespa/searchlib/parsequery/simplequerystack.cpp36
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/common.cpp5
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/common.h5
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/domain.cpp11
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/domain.h5
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp66
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/domainpart.h18
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/nosyncproxy.h4
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/session.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/session.h5
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/syncproxy.h8
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/trans_log_server_explorer.cpp9
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/trans_log_server_explorer.h6
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/translogserver.h8
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/translogserverapp.cpp14
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/translogserverapp.h10
-rw-r--r--storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp2
-rw-r--r--storage/src/vespa/storage/common/bucketoperationlogger.cpp4
-rw-r--r--storage/src/vespa/storage/common/bucketoperationlogger.h6
-rw-r--r--storage/src/vespa/storage/distributor/bucketdbupdater.cpp2
-rw-r--r--storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp6
-rw-r--r--storage/src/vespa/storage/distributor/pendingclusterstate.cpp2
-rw-r--r--storage/src/vespa/storage/distributor/persistencemessagetracker.cpp2
-rw-r--r--storage/src/vespa/storage/persistence/bucketownershipnotifier.cpp2
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp4
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp2
-rw-r--r--storage/src/vespa/storage/persistence/persistencethread.cpp6
-rw-r--r--vbench/src/vbench/core/string.cpp9
-rw-r--r--vespalib/src/tests/stringfmt/fmt.cpp53
-rw-r--r--vespalib/src/vespa/vespalib/util/stringfmt.cpp19
-rw-r--r--vespalib/src/vespa/vespalib/util/stringfmt.h2
-rw-r--r--vespalib/src/vespa/vespalib/util/vstringfmt.h19
51 files changed, 173 insertions, 337 deletions
diff --git a/documentapi/src/vespa/documentapi/common.h b/documentapi/src/vespa/documentapi/common.h
index 10b43f40394..86652b10dca 100644
--- a/documentapi/src/vespa/documentapi/common.h
+++ b/documentapi/src/vespa/documentapi/common.h
@@ -2,7 +2,6 @@
#pragma once
#include <vespa/vespalib/stllike/string.h>
-#include <vespa/vespalib/util/vstringfmt.h>
namespace documentapi {
diff --git a/messagebus/src/tests/advancedrouting/advancedrouting.cpp b/messagebus/src/tests/advancedrouting/advancedrouting.cpp
index eed792ebf7c..e847fdf3222 100644
--- a/messagebus/src/tests/advancedrouting/advancedrouting.cpp
+++ b/messagebus/src/tests/advancedrouting/advancedrouting.cpp
@@ -11,7 +11,7 @@
#include <vespa/messagebus/testlib/slobrok.h>
#include <vespa/messagebus/testlib/testserver.h>
#include <vespa/vespalib/testkit/testapp.h>
-#include <vespa/vespalib/util/vstringfmt.h>
+#include <vespa/vespalib/util/stringfmt.h>
using namespace mbus;
@@ -126,7 +126,7 @@ Test::testAdvanced(TestData &data)
.addHop(HopSpec("bar", "dst/bar"))
.addHop(HopSpec("baz", "dst/baz"))
.addRoute(RouteSpec("baz").addHop("baz"))));
- string route = vespalib::make_vespa_string("[Custom:%s,bar,route:baz,dst/cox,?dst/unknown]",
+ string route = vespalib::make_string("[Custom:%s,bar,route:baz,dst/cox,?dst/unknown]",
data._fooSession->getConnectionSpec().c_str());
EXPECT_TRUE(data._srcSession->send(createMessage("msg"), Route::parse(route)).isAccepted());
diff --git a/messagebus/src/tests/messagebus/messagebus.cpp b/messagebus/src/tests/messagebus/messagebus.cpp
index bcd5d662cea..7434941a900 100644
--- a/messagebus/src/tests/messagebus/messagebus.cpp
+++ b/messagebus/src/tests/messagebus/messagebus.cpp
@@ -2,25 +2,17 @@
#include <vespa/messagebus/destinationsession.h>
#include <vespa/messagebus/emptyreply.h>
-#include <vespa/messagebus/error.h>
#include <vespa/messagebus/errorcode.h>
#include <vespa/messagebus/intermediatesession.h>
#include <vespa/messagebus/messagebus.h>
#include <vespa/messagebus/routablequeue.h>
-#include <vespa/messagebus/routing/route.h>
#include <vespa/messagebus/routing/routingcontext.h>
-#include <vespa/messagebus/routing/routingnodeiterator.h>
-#include <vespa/messagebus/routing/routingspec.h>
-#include <vespa/messagebus/sourcesession.h>
-#include <vespa/messagebus/sourcesessionparams.h>
-#include <vespa/messagebus/testlib/receptor.h>
#include <vespa/messagebus/testlib/simplemessage.h>
#include <vespa/messagebus/testlib/simpleprotocol.h>
-#include <vespa/messagebus/testlib/simplereply.h>
#include <vespa/messagebus/testlib/slobrok.h>
#include <vespa/messagebus/testlib/testserver.h>
#include <vespa/vespalib/testkit/testapp.h>
-#include <vespa/vespalib/util/vstringfmt.h>
+#include <vespa/vespalib/util/stringfmt.h>
using namespace mbus;
@@ -377,7 +369,7 @@ Test::testDirectHop()
// Send using name.
ASSERT_TRUE(client->session->send(
Message::UP(new SimpleMessage("empty")),
- Route().addHop(vespalib::make_vespa_string("search/r.%d/c.%d/session", row, col)))
+ Route().addHop(vespalib::make_string("search/r.%d/c.%d/session", row, col)))
.isAccepted());
assertDst(*dst);
assertSrc(*client);
diff --git a/messagebus/src/tests/messageordering/messageordering.cpp b/messagebus/src/tests/messageordering/messageordering.cpp
index 9df36b349a1..7ea31701127 100644
--- a/messagebus/src/tests/messageordering/messageordering.cpp
+++ b/messagebus/src/tests/messageordering/messageordering.cpp
@@ -1,19 +1,13 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/messagebus/messagebus.h>
-#include <vespa/messagebus/sourcesession.h>
-#include <vespa/messagebus/destinationsession.h>
#include <vespa/messagebus/testlib/slobrok.h>
#include <vespa/messagebus/testlib/testserver.h>
-#include <vespa/messagebus/routing/routingspec.h>
#include <vespa/messagebus/testlib/receptor.h>
-#include <vespa/messagebus/sourcesessionparams.h>
#include <vespa/messagebus/testlib/simplemessage.h>
#include <vespa/messagebus/testlib/simplereply.h>
-#include <vespa/messagebus/testlib/simpleprotocol.h>
#include <vespa/messagebus/errorcode.h>
-#include <vespa/vespalib/util/vstringfmt.h>
-#include <stdexcept>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/log/log.h>
LOG_SETUP("messageordering_test");
@@ -54,7 +48,7 @@ public:
vespalib::MonitorGuard lock(_mon);
- vespalib::string expected(vespalib::make_vespa_string("%d", _messageCounter));
+ vespalib::string expected(vespalib::make_string("%d", _messageCounter));
LOG(debug, "Got message %p with %s, expecting %s",
msg.get(),
simpleMsg.getValue().c_str(),
@@ -117,7 +111,7 @@ VerifyReplyReceptor::handleReply(Reply::UP reply)
}
LOG(warning, "%s", ss.str().c_str());
} else {
- vespalib::string expected(vespalib::make_vespa_string("%d", _replyCount));
+ vespalib::string expected(vespalib::make_string("%d", _replyCount));
SimpleReply& simpleReply(static_cast<SimpleReply&>(*reply));
if (simpleReply.getValue() != expected) {
std::stringstream ss;
@@ -171,7 +165,7 @@ Test::Main()
// send messages on client
const int messageCount = 10000;
for (int i = 0; i < messageCount; ++i) {
- vespalib::string str(vespalib::make_vespa_string("%d", i));
+ vespalib::string str(vespalib::make_string("%d", i));
//FastOS_Thread::Sleep(1);
SimpleMessage::UP msg(new SimpleMessage(str, true, commonMessageId));
msg->getTrace().setLevel(9);
diff --git a/messagebus/src/tests/routingcontext/routingcontext.cpp b/messagebus/src/tests/routingcontext/routingcontext.cpp
index 3cf8be32f04..12ed456b5a6 100644
--- a/messagebus/src/tests/routingcontext/routingcontext.cpp
+++ b/messagebus/src/tests/routingcontext/routingcontext.cpp
@@ -10,7 +10,8 @@
#include <vespa/messagebus/testlib/slobrok.h>
#include <vespa/messagebus/testlib/testserver.h>
#include <vespa/vespalib/testkit/testapp.h>
-#include <vespa/vespalib/util/vstringfmt.h>
+#include <vespa/vespalib/util/stringfmt.h>
+
using namespace mbus;
@@ -20,7 +21,7 @@ using namespace mbus;
//
////////////////////////////////////////////////////////////////////////////////
-using vespalib::make_vespa_string;
+using vespalib::make_string;
static const double TIMEOUT = 120;
@@ -74,32 +75,32 @@ CustomPolicy::select(RoutingContext &ctx)
const std::vector<Route> &all = ctx.getAllRecipients();
if (_factory._expectedAll.size() == all.size()) {
- ctx.trace(1, make_vespa_string("Got %d expected recipients.", (uint32_t)all.size()));
+ ctx.trace(1, make_string("Got %d expected recipients.", (uint32_t)all.size()));
for (std::vector<Route>::const_iterator it = all.begin();
it != all.end(); ++it)
{
if (find(_factory._expectedAll.begin(), _factory._expectedAll.end(), it->toString()) != _factory._expectedAll.end()) {
- ctx.trace(1, make_vespa_string("Got expected recipient '%s'.", it->toString().c_str()));
+ ctx.trace(1, make_string("Got expected recipient '%s'.", it->toString().c_str()));
} else {
reply->addError(Error(ErrorCode::APP_FATAL_ERROR,
- make_vespa_string("Matched recipient '%s' not expected.",
- it->toString().c_str())));
+ make_string("Matched recipient '%s' not expected.",
+ it->toString().c_str())));
}
}
} else {
reply->addError(Error(ErrorCode::APP_FATAL_ERROR,
- make_vespa_string("Expected %d recipients, got %d.",
- (uint32_t)_factory._expectedAll.size(),
- (uint32_t)all.size())));
+ make_string("Expected %d recipients, got %d.",
+ (uint32_t)_factory._expectedAll.size(),
+ (uint32_t)all.size())));
}
if (ctx.getNumRecipients() == all.size()) {
for (uint32_t i = 0; i < all.size(); ++i) {
if (all[i].toString() == ctx.getRecipient(i).toString()) {
- ctx.trace(1, make_vespa_string("getRecipient(%d) matches getAllRecipients()[%d]", i, i));
+ ctx.trace(1, make_string("getRecipient(%d) matches getAllRecipients()[%d]", i, i));
} else {
reply->addError(Error(ErrorCode::APP_FATAL_ERROR,
- make_vespa_string("getRecipient(%d) differs from getAllRecipients()[%d]", i, i)));
+ make_string("getRecipient(%d) differs from getAllRecipients()[%d]", i, i)));
}
}
} else {
@@ -110,23 +111,23 @@ CustomPolicy::select(RoutingContext &ctx)
std::vector<Route> matched;
ctx.getMatchedRecipients(matched);
if (_factory._expectedMatched.size() == matched.size()) {
- ctx.trace(1, make_vespa_string("Got %d expected recipients.", (uint32_t)matched.size()));
+ ctx.trace(1, make_string("Got %d expected recipients.", (uint32_t)matched.size()));
for (std::vector<Route>::iterator it = matched.begin();
it != matched.end(); ++it)
{
if (find(_factory._expectedMatched.begin(), _factory._expectedMatched.end(), it->toString()) != _factory._expectedMatched.end()) {
- ctx.trace(1, make_vespa_string("Got matched recipient '%s'.", it->toString().c_str()));
+ ctx.trace(1, make_string("Got matched recipient '%s'.", it->toString().c_str()));
} else {
reply->addError(Error(ErrorCode::APP_FATAL_ERROR,
- make_vespa_string("Matched recipient '%s' not expected.",
- it->toString().c_str())));
+ make_string("Matched recipient '%s' not expected.",
+ it->toString().c_str())));
}
}
} else {
reply->addError(Error(ErrorCode::APP_FATAL_ERROR,
- make_vespa_string("Expected %d matched recipients, got %d.",
- (uint32_t)_factory._expectedMatched.size(),
- (uint32_t)matched.size())));
+ make_string("Expected %d matched recipients, got %d.",
+ (uint32_t)_factory._expectedMatched.size(),
+ (uint32_t)matched.size())));
}
if (!reply->hasErrors() && _factory._forward) {
diff --git a/messagebus/src/tests/serviceaddress/serviceaddress.cpp b/messagebus/src/tests/serviceaddress/serviceaddress.cpp
index f2f5f5eca76..15a2e9fdac8 100644
--- a/messagebus/src/tests/serviceaddress/serviceaddress.cpp
+++ b/messagebus/src/tests/serviceaddress/serviceaddress.cpp
@@ -17,7 +17,6 @@
#include <vespa/messagebus/routing/routingspec.h>
#include <vespa/messagebus/network/rpcservice.h>
#include <vespa/messagebus/sourcesessionparams.h>
-#include <vespa/vespalib/util/vstringfmt.h>
using namespace mbus;
diff --git a/messagebus/src/tests/shutdown/shutdown.cpp b/messagebus/src/tests/shutdown/shutdown.cpp
index 7bb636cc87e..b5e6cac970e 100644
--- a/messagebus/src/tests/shutdown/shutdown.cpp
+++ b/messagebus/src/tests/shutdown/shutdown.cpp
@@ -12,7 +12,6 @@
#include <vespa/messagebus/testlib/testserver.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/exceptions.h>
-#include <vespa/vespalib/util/vstringfmt.h>
using namespace mbus;
diff --git a/messagebus/src/vespa/messagebus/testlib/custompolicy.cpp b/messagebus/src/vespa/messagebus/testlib/custompolicy.cpp
index 866183769cd..c65e4147389 100644
--- a/messagebus/src/vespa/messagebus/testlib/custompolicy.cpp
+++ b/messagebus/src/vespa/messagebus/testlib/custompolicy.cpp
@@ -1,11 +1,10 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <boost/tokenizer.hpp>
+#include "custompolicy.h"
+#include "simpleprotocol.h"
#include <vespa/messagebus/emptyreply.h>
#include <vespa/messagebus/errorcode.h>
#include <vespa/messagebus/routing/routingcontext.h>
-#include <vespa/vespalib/util/vstringfmt.h>
-#include "custompolicy.h"
-#include "simpleprotocol.h"
+#include <boost/tokenizer.hpp>
#include <vespa/log/log.h>
LOG_SETUP(".custompolicy");
diff --git a/messagebus/src/vespa/messagebus/testlib/custompolicy.h b/messagebus/src/vespa/messagebus/testlib/custompolicy.h
index 827c17f1d23..78c851d175c 100644
--- a/messagebus/src/vespa/messagebus/testlib/custompolicy.h
+++ b/messagebus/src/vespa/messagebus/testlib/custompolicy.h
@@ -3,6 +3,7 @@
#include "simpleprotocol.h"
#include <vespa/messagebus/routing/iroutingpolicy.h>
+#include <vespa/messagebus/routing/route.h>
namespace mbus {
diff --git a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp
index 489af79d595..43e1e3e60a1 100644
--- a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp
+++ b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp
@@ -5,19 +5,19 @@
#include <vespa/document/base/documentid.h>
#include <vespa/document/fieldvalue/document.h>
#include <vespa/vespalib/util/crc.h>
-#include <vespa/vespalib/util/vstringfmt.h>
#include <vespa/document/fieldset/fieldsetrepo.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
#include <algorithm>
-using std::binary_search;
-using std::lower_bound;
-
#include <vespa/log/log.h>
LOG_SETUP(".dummypersistence");
+using vespalib::make_string;
+using std::binary_search;
+using std::lower_bound;
+
namespace storage::spi::dummy {
BucketContent::BucketContent()
@@ -678,10 +678,8 @@ DummyPersistence::iterate(IteratorId id, uint64_t maxByteSize, Context& ctx) con
it->_leftToIterate.pop_back();
}
if (ctx.shouldTrace(9)) {
- ctx.trace(9, vespalib::make_vespa_string("finished iterate(), returning %zu "
- "documents with %u bytes of data",
- entries.size(),
- currentSize));
+ ctx.trace(9, make_string("finished iterate(), returning %zu documents with %u bytes of data",
+ entries.size(), currentSize));
}
LOG(debug, "finished iterate(%zu, %zu), returning %zu documents "
"with %u bytes of data. %u docs cloned in fast path",
diff --git a/searchcore/src/apps/tests/persistenceconformance_test.cpp b/searchcore/src/apps/tests/persistenceconformance_test.cpp
index d52e491709c..b642dc77919 100644
--- a/searchcore/src/apps/tests/persistenceconformance_test.cpp
+++ b/searchcore/src/apps/tests/persistenceconformance_test.cpp
@@ -1,7 +1,5 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/log/log.h>
-LOG_SETUP("persistenceconformance_test");
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/config-imported-fields.h>
@@ -27,7 +25,10 @@ LOG_SETUP("persistenceconformance_test");
#include <tests/proton/common/dummydbowner.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/searchcore/proton/common/hw_info.h>
+#include <vespa/fastos/file.h>
+#include <vespa/log/log.h>
+LOG_SETUP("persistenceconformance_test");
using namespace config;
using namespace proton;
diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
index 2a5dfff372a..483e725927d 100644
--- a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
@@ -27,6 +27,8 @@
#include <vespa/document/datatype/documenttype.h>
#include <vespa/vespalib/data/slime/slime.h>
#include <vespa/vespalib/testkit/test_kit.h>
+#include <vespa/fastos/file.h>
+
using document::DocumentType;
using document::DocumentTypeRepo;
diff --git a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp
index 3750ba03f50..cbfdb4895cc 100644
--- a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp
@@ -5,7 +5,6 @@
#include "feedstates.h"
#include "i_feed_handler_owner.h"
#include "ifeedview.h"
-#include "replaypacketdispatcher.h"
#include "tlcproxy.h"
#include <vespa/document/datatype/documenttype.h>
#include <vespa/documentapi/messagebus/documentprotocol.h>
diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
index a5b0cfd1d53..ed350453da2 100644
--- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
@@ -26,6 +26,7 @@
#include <vespa/vespalib/util/closuretask.h>
#include <vespa/vespalib/util/host_name.h>
#include <vespa/vespalib/util/random.h>
+#include <dirent.h>
#include <vespa/searchlib/aggregation/forcelink.hpp>
#include <vespa/searchlib/expression/forcelink.hpp>
diff --git a/searchcore/src/vespa/searchcore/proton/server/tlcproxy.cpp b/searchcore/src/vespa/searchcore/proton/server/tlcproxy.cpp
index 8dfcfead3c2..c377be9f73d 100644
--- a/searchcore/src/vespa/searchcore/proton/server/tlcproxy.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/tlcproxy.cpp
@@ -1,22 +1,20 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "tlcproxy.h"
-#include <vespa/vespalib/objects/nbostream.h>
-#include <vespa/searchlib/common/bitvector.h>
-#include <vespa/document/bucket/bucketid.h>
#include <vespa/vespalib/util/exceptions.h>
+
#include <vespa/log/log.h>
LOG_SETUP(".proton.server.tlcproxy");
using vespalib::nbostream;
+using search::transactionlog::Packet;
namespace proton {
void TlcProxy::commit(search::SerialNum serialNum, search::transactionlog::Type type, const vespalib::nbostream &buf)
{
- search::transactionlog::Packet::Entry
- entry(serialNum, type, vespalib::ConstBufferRef(buf.c_str(), buf.size()));
- search::transactionlog::Packet packet;
+ Packet::Entry entry(serialNum, type, vespalib::ConstBufferRef(buf.c_str(), buf.size()));
+ Packet packet;
packet.add(entry);
packet.close();
if (_tlsDirectWriter != NULL) {
diff --git a/searchlib/src/tests/transactionlog/translogclient_test.cpp b/searchlib/src/tests/transactionlog/translogclient_test.cpp
index 4156cb15966..74b0761320f 100644
--- a/searchlib/src/tests/transactionlog/translogclient_test.cpp
+++ b/searchlib/src/tests/transactionlog/translogclient_test.cpp
@@ -4,8 +4,10 @@
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/objects/identifiable.h>
#include <vespa/searchlib/index/dummyfileheadercontext.h>
-#include <vespa/log/log.h>
+#include <vespa/fastos/file.h>
#include <map>
+
+#include <vespa/log/log.h>
LOG_SETUP("translogclient_test");
using namespace search;
diff --git a/searchlib/src/vespa/searchlib/features/foreachfeature.cpp b/searchlib/src/vespa/searchlib/features/foreachfeature.cpp
index 3cef8c12c6c..a67d8001a36 100644
--- a/searchlib/src/vespa/searchlib/features/foreachfeature.cpp
+++ b/searchlib/src/vespa/searchlib/features/foreachfeature.cpp
@@ -4,18 +4,16 @@
#include "valuefeature.h"
#include "utils.h"
-#include <boost/algorithm/string/replace.hpp>
#include <vespa/searchlib/fef/properties.h>
#include <vespa/vespalib/util/stringfmt.h>
-#include <vespa/vespalib/util/vstringfmt.h>
+#include <boost/algorithm/string/replace.hpp>
#include <vespa/log/log.h>
LOG_SETUP(".features.foreachfeature");
using namespace search::fef;
-namespace search {
-namespace features {
+namespace search::features {
template <typename CO, typename OP>
ForeachExecutor<CO, OP>::ForeachExecutor(const CO & condition, uint32_t numInputs) :
@@ -149,7 +147,7 @@ ForeachBlueprint::setup(const IIndexEnvironment & env,
if (_dimension == TERMS) {
uint32_t maxTerms = util::strToNum<uint32_t>(env.getProperties().lookup(getBaseName(), "maxTerms").get("16"));
for (uint32_t i = 0; i < maxTerms; ++i) {
- defineInput(boost::algorithm::replace_all_copy(feature, variable, vespalib::make_vespa_string("%u", i)));
+ defineInput(boost::algorithm::replace_all_copy(feature, variable, vespalib::make_string("%u", i)));
++_num_inputs;
}
} else {
@@ -186,5 +184,4 @@ ForeachBlueprint::createExecutor(const IQueryEnvironment &, vespalib::Stash &sta
}
-} // namespace features
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp b/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp
index f357df250b4..62c9efc6739 100644
--- a/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp
+++ b/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp
@@ -3,13 +3,12 @@
#include "parametervalidator.h"
#include "fieldtype.h"
#include "fieldinfo.h"
-#include <vespa/vespalib/util/vstringfmt.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <boost/lexical_cast.hpp>
-using vespalib::make_vespa_string;
+using vespalib::make_string;
-namespace search {
-namespace fef {
+namespace search::fef {
using CollectionType = FieldInfo::CollectionType;
@@ -56,27 +55,27 @@ ParameterValidator::validateField(ParameterType::Enum type, ParameterCollection:
{
const FieldInfo * field = _indexEnv.getFieldByName(_params[i]);
if (field == NULL) {
- throw ValidateException(make_vespa_string("Param[%zu]: Field '%s' was not found in the index environment",
+ throw ValidateException(make_string("Param[%zu]: Field '%s' was not found in the index environment",
i, _params[i].c_str()));
}
if (type == ParameterType::INDEX_FIELD) {
if (field->type() != FieldType::INDEX) {
- throw ValidateException(make_vespa_string("Param[%zu]: Expected field '%s' to be an index field, but it was not",
+ throw ValidateException(make_string("Param[%zu]: Expected field '%s' to be an index field, but it was not",
i, _params[i].c_str()));
}
} else if (type == ParameterType::ATTRIBUTE_FIELD) {
if (field->type() != FieldType::ATTRIBUTE) {
- throw ValidateException(make_vespa_string("Param[%zu]: Expected field '%s' to be an attribute field, but it was not",
+ throw ValidateException(make_string("Param[%zu]: Expected field '%s' to be an attribute field, but it was not",
i, _params[i].c_str()));
}
} else if (type == ParameterType::ATTRIBUTE) {
if (!field->hasAttribute()) {
- throw ValidateException(make_vespa_string("Param[%zu]: Expected field '%s' to support attribute lookup, but it does not",
+ throw ValidateException(make_string("Param[%zu]: Expected field '%s' to support attribute lookup, but it does not",
i, _params[i].c_str()));
}
}
if (!checkCollectionType(collection, field->collection())) {
- throw ValidateException(make_vespa_string("Param[%zu]: field '%s' has inappropriate collection type",
+ throw ValidateException(make_string("Param[%zu]: field '%s' has inappropriate collection type",
i, _params[i].c_str()));
}
result.addParameter(Parameter(type, _params[i]).setField(field));
@@ -90,7 +89,7 @@ ParameterValidator::validateNumber(ParameterType::Enum type, size_t i, Result &
int64_t intVal = static_cast<int64_t>(doubleVal);
result.addParameter(Parameter(type, _params[i]).setInteger(intVal).setDouble(doubleVal));
} catch (const boost::bad_lexical_cast &) {
- throw ValidateException(make_vespa_string("Param[%zu]: Could not convert '%s' to a number", i, _params[i].c_str()));
+ throw ValidateException(make_string("Param[%zu]: Could not convert '%s' to a number", i, _params[i].c_str()));
}
}
@@ -103,11 +102,11 @@ ParameterValidator::validate(const ParameterDescriptions::Description & desc)
if (minParams > _params.size() ||
((_params.size() - desc.getParams().size()) % desc.getRepeat() != 0))
{
- throw ValidateException(make_vespa_string("Expected %zd+%zdx parameter(s), but got %zd",
+ throw ValidateException(make_string("Expected %zd+%zdx parameter(s), but got %zd",
minParams, desc.getRepeat(), _params.size()));
}
} else if (desc.getParams().size() != _params.size()) {
- throw ValidateException(make_vespa_string("Expected %zd parameter(s), but got %zd", desc.getParams().size(), _params.size()));
+ throw ValidateException(make_string("Expected %zd parameter(s), but got %zd", desc.getParams().size(), _params.size()));
}
for (size_t i = 0; i < _params.size(); ++i) {
ParamDescItem param = desc.getParam(i);
@@ -160,5 +159,4 @@ ParameterValidator::validate()
return invalid;
}
-} // namespace fef
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/parsequery/simplequerystack.cpp b/searchlib/src/vespa/searchlib/parsequery/simplequerystack.cpp
index cae3e769c5b..6274bd083de 100644
--- a/searchlib/src/vespa/searchlib/parsequery/simplequerystack.cpp
+++ b/searchlib/src/vespa/searchlib/parsequery/simplequerystack.cpp
@@ -8,14 +8,14 @@
* ALL RIGHTS RESERVED
*/
#include "simplequerystack.h"
-#include <vespa/vespalib/util/vstringfmt.h>
#include <vespa/vespalib/util/compress.h>
#include <vespa/vespalib/objects/nbo.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/log/log.h>
LOG_SETUP(".search.simplequerystack");
-using vespalib::make_vespa_string;
+using vespalib::make_string;
namespace search {
@@ -174,24 +174,24 @@ SimpleQueryStack::StackbufToString(const vespalib::stringref &theBuf)
int64_t tmpLong(0);
p += vespalib::compress::Integer::decompress(tmpLong, p);
metaStr.append("(w:");
- metaStr.append(make_vespa_string("%ld", tmpLong));
+ metaStr.append(make_string("%ld", tmpLong));
metaStr.append(")");
}
if (search::ParseItem::getFeature_UniqueId(rawtype)) {
p += vespalib::compress::Integer::decompressPositive(tmp, p);
metaStr.append("(u:");
- metaStr.append(make_vespa_string("%ld", tmp));
+ metaStr.append(make_string("%ld", tmp));
metaStr.append(")");
}
if (search::ParseItem::getFeature_Flags(rawtype)) {
flags = *p++;
metaStr.append("(f:");
- metaStr.append(make_vespa_string("%d", flags));
+ metaStr.append(make_string("%d", flags));
metaStr.append(")");
}
if (search::ParseItem::GetCreator(flags) != search::ParseItem::CREA_ORIG) {
metaStr.append("(c:");
- metaStr.append(make_vespa_string("%d", search::ParseItem::GetCreator(flags)));
+ metaStr.append(make_string("%d", search::ParseItem::GetCreator(flags)));
metaStr.append(")");
}
@@ -207,7 +207,7 @@ SimpleQueryStack::StackbufToString(const vespalib::stringref &theBuf)
case search::ParseItem::ITEM_ANY:
p += vespalib::compress::Integer::decompressPositive(tmp, p);
arity = tmp;
- result.append(make_vespa_string("%c/%d~", _G_ItemName[type], arity));
+ result.append(make_string("%c/%d~", _G_ItemName[type], arity));
break;
case search::ParseItem::ITEM_WEAK_AND:
case search::ParseItem::ITEM_NEAR:
@@ -221,9 +221,9 @@ SimpleQueryStack::StackbufToString(const vespalib::stringref &theBuf)
idxRefLen = tmp;
idxRef = p;
p += idxRefLen;
- result.append(make_vespa_string("%c/%d/%d/%d:%.*s~", _G_ItemName[type], arity, arg1, idxRefLen, idxRefLen, idxRef));
+ result.append(make_string("%c/%d/%d/%d:%.*s~", _G_ItemName[type], arity, arg1, idxRefLen, idxRefLen, idxRef));
} else {
- result.append(make_vespa_string("%c/%d/%d~", _G_ItemName[type], arity, arg1));
+ result.append(make_string("%c/%d/%d~", _G_ItemName[type], arity, arg1));
}
break;
@@ -242,7 +242,7 @@ SimpleQueryStack::StackbufToString(const vespalib::stringref &theBuf)
termRefLen = tmp;
termRef = p;
p += termRefLen;
- result.append(make_vespa_string("%c/%d:%.*s/%d:%.*s~", _G_ItemName[type],
+ result.append(make_string("%c/%d:%.*s/%d:%.*s~", _G_ItemName[type],
idxRefLen, idxRefLen, idxRef,
termRefLen, termRefLen, termRef));
break;
@@ -251,14 +251,14 @@ SimpleQueryStack::StackbufToString(const vespalib::stringref &theBuf)
termRefLen = tmp;
termRef = p;
p += termRefLen;
- result.append(make_vespa_string("%c/%d:%.*s~", _G_ItemName[type],
+ result.append(make_string("%c/%d:%.*s~", _G_ItemName[type],
termRefLen, termRefLen, termRef));
break;
case search::ParseItem::ITEM_PURE_WEIGHTED_LONG:
tmp = vespalib::nbo::n2h(*reinterpret_cast<const uint64_t *>(p));
p += sizeof(uint64_t);
- result.append(make_vespa_string("%c/%lu", _G_ItemName[type], tmp));
+ result.append(make_string("%c/%lu", _G_ItemName[type], tmp));
break;
case search::ParseItem::ITEM_PHRASE:
@@ -278,10 +278,10 @@ SimpleQueryStack::StackbufToString(const vespalib::stringref &theBuf)
p += sizeof(double);
double thresholdBoostFactor = vespalib::nbo::n2h(*reinterpret_cast<const double *>(p)); // thresholdBoostFactor
p += sizeof(double);
- result.append(make_vespa_string("%c/%d/%d:%.*s(%u,%f,%f)~", _G_ItemName[type], arity, idxRefLen,
+ result.append(make_string("%c/%d/%d:%.*s(%u,%f,%f)~", _G_ItemName[type], arity, idxRefLen,
idxRefLen, idxRef, targetNumHits, scoreThreshold, thresholdBoostFactor));
} else {
- result.append(make_vespa_string("%c/%d/%d:%.*s~", _G_ItemName[type], arity, idxRefLen,
+ result.append(make_string("%c/%d/%d:%.*s~", _G_ItemName[type], arity, idxRefLen,
idxRefLen, idxRef));
}
break;
@@ -292,25 +292,25 @@ SimpleQueryStack::StackbufToString(const vespalib::stringref &theBuf)
idxRef = p;
p += idxRefLen;
size_t feature_count = ReadCompressedPositiveInt(p);
- result.append(make_vespa_string(
+ result.append(make_string(
"%c/%d:%.*s/%zu(", _G_ItemName[type], idxRefLen, idxRefLen, idxRef, feature_count));
for (size_t i = 0; i < feature_count; ++i) {
vespalib::string key = ReadString(p);
vespalib::string value = ReadString(p);
uint64_t sub_queries = ReadUint64(p);
- result.append(make_vespa_string("%s:%s:%lx", key.c_str(), value.c_str(), sub_queries));
+ result.append(make_string("%s:%s:%lx", key.c_str(), value.c_str(), sub_queries));
if (i < feature_count - 1) {
result.append(',');
}
}
size_t range_feature_count = ReadCompressedPositiveInt(p);
- result.append(make_vespa_string(")/%zu(", range_feature_count));
+ result.append(make_string(")/%zu(", range_feature_count));
for (size_t i = 0; i < range_feature_count; ++i) {
vespalib::string key = ReadString(p);
uint64_t value = ReadUint64(p);
uint64_t sub_queries = ReadUint64(p);
- result.append(make_vespa_string("%s:%zu:%lx", key.c_str(), value, sub_queries));
+ result.append(make_string("%s:%zu:%lx", key.c_str(), value, sub_queries));
if (i < range_feature_count - 1) {
result.append(',');
}
diff --git a/searchlib/src/vespa/searchlib/transactionlog/common.cpp b/searchlib/src/vespa/searchlib/transactionlog/common.cpp
index 8dd4d7abbcc..a84e27b2e53 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/common.cpp
+++ b/searchlib/src/vespa/searchlib/transactionlog/common.cpp
@@ -3,9 +3,7 @@
#include "common.h"
#include <vespa/fastos/file.h>
-namespace search {
-
-namespace transactionlog {
+namespace search::transactionlog {
using vespalib::nbostream;
using vespalib::nbostream_longlivedbuf;
@@ -104,4 +102,3 @@ bool Packet::add(const Packet::Entry & e)
}
}
-}
diff --git a/searchlib/src/vespa/searchlib/transactionlog/common.h b/searchlib/src/vespa/searchlib/transactionlog/common.h
index 4b8e6575c4c..65ef8f363c0 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/common.h
+++ b/searchlib/src/vespa/searchlib/transactionlog/common.h
@@ -5,8 +5,7 @@
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/util/buffer.h>
-namespace search {
-namespace transactionlog {
+namespace search::transactionlog {
/// This represents a type of the entry. Fx update,remove
typedef uint32_t Type;
@@ -96,5 +95,3 @@ public:
};
}
-}
-
diff --git a/searchlib/src/vespa/searchlib/transactionlog/domain.cpp b/searchlib/src/vespa/searchlib/transactionlog/domain.cpp
index 82e700620e5..a324e42ab24 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/domain.cpp
+++ b/searchlib/src/vespa/searchlib/transactionlog/domain.cpp
@@ -1,17 +1,15 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "domain.h"
-#include <limits>
-#include <vespa/vespalib/util/vstringfmt.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/util/closuretask.h>
+#include <vespa/fastos/file.h>
#include <vespa/log/log.h>
LOG_SETUP(".transactionlog.domain");
using vespalib::string;
using vespalib::make_string;
-using vespalib::make_vespa_string;
using vespalib::LockGuard;
using vespalib::makeTask;
using vespalib::makeClosure;
@@ -20,11 +18,7 @@ using vespalib::MonitorGuard;
using search::common::FileHeaderContext;
using std::runtime_error;
-namespace search
-{
-
-namespace transactionlog
-{
+namespace search::transactionlog {
Domain::Domain(const string &domainName,
const string & baseDir,
@@ -420,4 +414,3 @@ Domain::scanDir()
}
}
-}
diff --git a/searchlib/src/vespa/searchlib/transactionlog/domain.h b/searchlib/src/vespa/searchlib/transactionlog/domain.h
index 8b64232b000..f70ce7654c1 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/domain.h
+++ b/searchlib/src/vespa/searchlib/transactionlog/domain.h
@@ -5,8 +5,7 @@
#include <vespa/searchlib/transactionlog/session.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
-namespace search {
-namespace transactionlog {
+namespace search::transactionlog {
struct PartInfo {
SerialNumRange range;
@@ -122,5 +121,3 @@ private:
};
}
-}
-
diff --git a/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp b/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp
index 03bb1c4e043..ebe3c07c1df 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp
+++ b/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp
@@ -3,13 +3,12 @@
#include "domainpart.h"
#include <vespa/vespalib/util/crc.h>
#include <vespa/vespalib/xxhash/xxhash.h>
-#include <vespa/vespalib/util/vstringfmt.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/data/fileheader.h>
#include <vespa/searchlib/common/fileheadercontext.h>
#include <vespa/fastlib/io/bufferedfile.h>
-#include <vespa/log/log.h>
+#include <vespa/log/log.h>
LOG_SETUP(".transactionlog.domainpart");
using vespalib::make_string;
@@ -24,13 +23,10 @@ using vespalib::alloc::Alloc;
using search::common::FileHeaderContext;
using std::runtime_error;
-namespace search {
-
-namespace transactionlog {
+namespace search::transactionlog {
namespace {
-
void
handleSync(FastOS_FileInterface &file) __attribute__ ((noinline));
@@ -187,7 +183,7 @@ DomainPart::buildPacketMapping(bool allowTruncate)
{
Fast_BufferedFile transLog;
transLog.EnableDirectIO();
- if ( ! transLog.OpenReadOnly(_transLog.GetFileName())) {
+ if ( ! transLog.OpenReadOnly(_transLog->GetFileName())) {
throw runtime_error(make_string("Failed opening '%s' for buffered readinf with direct io.", transLog.GetFileName()));
}
int64_t fSize(transLog.GetSize());
@@ -285,20 +281,20 @@ DomainPart::DomainPart(const string & name,
_byteSize(0),
_packets(),
_fileName(make_string("%s/%s-%016" PRIu64, baseDir.c_str(), name.c_str(), s)),
- _transLog(_fileName.c_str()),
+ _transLog(std::make_unique<FastOS_File>(_fileName.c_str())),
_skipList(),
_headerLen(0),
_writeLock(),
_writtenSerial(0),
_syncedSerial(0)
{
- if (_transLog.OpenReadOnly()) {
+ if (_transLog->OpenReadOnly()) {
int64_t currPos = buildPacketMapping(allowTruncate);
- if ( ! _transLog.Close() ) {
- throw runtime_error(make_string("Failed closing file '%s' after reading.", _transLog.GetFileName()));
+ if ( ! _transLog->Close() ) {
+ throw runtime_error(make_string("Failed closing file '%s' after reading.", _transLog->GetFileName()));
}
- if ( ! _transLog.OpenWriteOnlyExisting() ) {
- string e(make_string("Failed opening existing file '%s' for writing: %s", _transLog.GetFileName(), getLastErrorString().c_str()));
+ if ( ! _transLog->OpenWriteOnlyExisting() ) {
+ string e(make_string("Failed opening existing file '%s' for writing: %s", _transLog->GetFileName(), getLastErrorString().c_str()));
LOG(error, "%s", e.c_str());
throw runtime_error(e);
}
@@ -309,8 +305,8 @@ DomainPart::DomainPart(const string & name,
}
_byteSize = currPos;
} else {
- if ( ! _transLog.OpenWriteOnly()) {
- string e(make_string("Failed opening new file '%s' for writing: '%s'", _transLog.GetFileName(), getLastErrorString().c_str()));
+ if ( ! _transLog->OpenWriteOnly()) {
+ string e(make_string("Failed opening new file '%s' for writing: '%s'", _transLog->GetFileName(), getLastErrorString().c_str()));
LOG(error, "%s", e.c_str());
throw runtime_error(e);
@@ -318,11 +314,11 @@ DomainPart::DomainPart(const string & name,
writeHeader(fileHeaderContext);
_byteSize = _headerLen;
}
- if ( ! _transLog.SetPosition(_transLog.GetSize()) ) {
+ if ( ! _transLog->SetPosition(_transLog->GetSize()) ) {
throw runtime_error(make_string("Failed moving write pointer to the end of the file %s(%" PRIu64 ").",
- _transLog.GetFileName(), _transLog.GetSize()));
+ _transLog->GetFileName(), _transLog->GetSize()));
}
- handleSync(_transLog);
+ handleSync(*_transLog);
_writtenSerial = _range.to();
_syncedSerial = _writtenSerial;
}
@@ -337,12 +333,12 @@ DomainPart::writeHeader(const FileHeaderContext &fileHeaderContext)
{
typedef vespalib::GenericHeader::Tag Tag;
FileHeader header;
- assert(_transLog.IsOpened());
- assert(_transLog.IsWriteMode());
- assert(_transLog.GetPosition() == 0);
- fileHeaderContext.addTags(header, _transLog.GetFileName());
+ assert(_transLog->IsOpened());
+ assert(_transLog->IsWriteMode());
+ assert(_transLog->GetPosition() == 0);
+ fileHeaderContext.addTags(header, _transLog->GetFileName());
header.putTag(Tag("desc", "Transaction log domain part file"));
- _headerLen = header.writeFile(_transLog);
+ _headerLen = header.writeFile(*_transLog);
}
bool
@@ -356,15 +352,15 @@ DomainPart::close()
* hole. XXX: Feed latency spike due to lack of delayed open
* for new domainpart.
*/
- handleSync(_transLog);
- _transLog.dropFromCache();
- retval = _transLog.Close();
+ handleSync(*_transLog);
+ _transLog->dropFromCache();
+ retval = _transLog->Close();
LockGuard wguard(_writeLock);
_syncedSerial = _writtenSerial;
}
if ( ! retval ) {
throw runtime_error(make_string("Failed closing file '%s' of size %" PRId64 ".",
- _transLog.GetFileName(), _transLog.GetSize()));
+ _transLog->GetFileName(), _transLog->GetSize()));
}
{
LockGuard guard(_lock);
@@ -374,9 +370,14 @@ DomainPart::close()
}
bool
+DomainPart::isClosed() const {
+ return ! _transLog->IsOpened();
+}
+
+bool
DomainPart::openAndFind(FastOS_FileInterface &file, const SerialNum &from)
{
- bool retval(file.OpenReadOnly(_transLog.GetFileName()));
+ bool retval(file.OpenReadOnly(_transLog->GetFileName()));
if (retval) {
int64_t pos(_headerLen);
LockGuard guard(_lock);
@@ -397,7 +398,7 @@ DomainPart::erase(SerialNum to)
bool retval(true);
if (to > _range.to()) {
close();
- _transLog.Delete();
+ _transLog->Delete();
} else {
_range.from(std::max(to, _range.from()));
}
@@ -407,7 +408,7 @@ DomainPart::erase(SerialNum to)
void
DomainPart::commit(SerialNum firstSerial, const Packet &packet)
{
- int64_t firstPos(_transLog.GetPosition());
+ int64_t firstPos(_transLog->GetPosition());
nbostream_longlivedbuf h(packet.getHandle().c_str(), packet.getHandle().size());
if (_range.from() == 0) {
_range.from(firstSerial);
@@ -419,7 +420,7 @@ DomainPart::commit(SerialNum firstSerial, const Packet &packet)
Packet::Entry entry;
entry.deserialize(h);
if (_range.to() < entry.serial()) {
- write(_transLog, entry);
+ write(*_transLog, entry);
_sz++;
_range.to(entry.serial());
} else {
@@ -457,7 +458,7 @@ void DomainPart::sync()
syncSerial = _writtenSerial;
}
LockGuard guard(_fileLock);
- handleSync(_transLog);
+ handleSync(*_transLog);
LockGuard wguard(_writeLock);
if (_syncedSerial < syncSerial) {
_syncedSerial = syncSerial;
@@ -675,4 +676,3 @@ int32_t DomainPart::calcCrc(Crc version, const void * buf, size_t sz)
}
}
-}
diff --git a/searchlib/src/vespa/searchlib/transactionlog/domainpart.h b/searchlib/src/vespa/searchlib/transactionlog/domainpart.h
index 03d0ad2120f..2af0a43d03c 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/domainpart.h
+++ b/searchlib/src/vespa/searchlib/transactionlog/domainpart.h
@@ -2,18 +2,16 @@
#pragma once
#include "common.h"
+#include <vespa/vespalib/util/sync.h>
+#include <vespa/vespalib/util/memory.h>
#include <map>
#include <vector>
#include <atomic>
-#include <vespa/vespalib/util/sync.h>
-#include <vespa/vespalib/util/memory.h>
-#include <vespa/fastos/file.h>
-namespace search {
+class FastOS_FileInterface;
-namespace common { class FileHeaderContext; }
-
-namespace transactionlog {
+namespace search::common { class FileHeaderContext; }
+namespace search::transactionlog {
class DomainPart {
private:
@@ -54,7 +52,7 @@ public:
size_t byteSize() const {
return _byteSize.load(std::memory_order_acquire);
}
- bool isClosed() const { return ! _transLog.IsOpened(); }
+ bool isClosed() const;
private:
bool openAndFind(FastOS_FileInterface &file, const SerialNum &from);
int64_t buildPacketMapping(bool allowTruncate);
@@ -101,7 +99,7 @@ private:
std::atomic<uint64_t> _byteSize;
PacketList _packets;
vespalib::string _fileName;
- FastOS_File _transLog;
+ std::unique_ptr<FastOS_FileInterface> _transLog;
SkipList _skipList;
uint32_t _headerLen;
vespalib::Lock _writeLock;
@@ -111,5 +109,3 @@ private:
};
}
-}
-
diff --git a/searchlib/src/vespa/searchlib/transactionlog/nosyncproxy.h b/searchlib/src/vespa/searchlib/transactionlog/nosyncproxy.h
index 5d7d7ca3f64..d890495bb1b 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/nosyncproxy.h
+++ b/searchlib/src/vespa/searchlib/transactionlog/nosyncproxy.h
@@ -4,8 +4,7 @@
#include "syncproxy.h"
-namespace search {
-namespace transactionlog {
+namespace search::transactionlog {
class NoSyncProxy : public SyncProxy
{
@@ -16,4 +15,3 @@ public:
};
}
-}
diff --git a/searchlib/src/vespa/searchlib/transactionlog/session.cpp b/searchlib/src/vespa/searchlib/transactionlog/session.cpp
index f17b3cba6ad..302e0c12dda 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/session.cpp
+++ b/searchlib/src/vespa/searchlib/transactionlog/session.cpp
@@ -10,8 +10,7 @@ LOG_SETUP(".transactionlog.session");
using vespalib::LockGuard;
-namespace search {
-namespace transactionlog {
+namespace search::transactionlog {
namespace {
const double NEVER(-1.0);
@@ -281,4 +280,3 @@ Session::sendDone()
}
}
-}
diff --git a/searchlib/src/vespa/searchlib/transactionlog/session.h b/searchlib/src/vespa/searchlib/transactionlog/session.h
index 1f5f1af9623..26e448540c3 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/session.h
+++ b/searchlib/src/vespa/searchlib/transactionlog/session.h
@@ -9,8 +9,7 @@
class FastOS_FileInterface;
-namespace search {
-namespace transactionlog {
+namespace search::transactionlog {
class Domain;
class DomainPart;
@@ -94,5 +93,3 @@ private:
};
}
-}
-
diff --git a/searchlib/src/vespa/searchlib/transactionlog/syncproxy.h b/searchlib/src/vespa/searchlib/transactionlog/syncproxy.h
index 009e4d9de8e..a2623ea3236 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/syncproxy.h
+++ b/searchlib/src/vespa/searchlib/transactionlog/syncproxy.h
@@ -4,10 +4,7 @@
#include <vespa/searchlib/common/serialnum.h>
-namespace search
-{
-namespace transactionlog
-{
+namespace search::transactionlog {
class SyncProxy
{
@@ -17,6 +14,3 @@ public:
};
}
-
-}
-
diff --git a/searchlib/src/vespa/searchlib/transactionlog/trans_log_server_explorer.cpp b/searchlib/src/vespa/searchlib/transactionlog/trans_log_server_explorer.cpp
index 60efcf485d8..fe708f52a93 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/trans_log_server_explorer.cpp
+++ b/searchlib/src/vespa/searchlib/transactionlog/trans_log_server_explorer.cpp
@@ -1,14 +1,14 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "trans_log_server_explorer.h"
-#include "domain.h"
#include <vespa/vespalib/data/slime/slime.h>
+#include <vespa/fastos/file.h>
+
using vespalib::slime::Inserter;
using vespalib::slime::Cursor;
-namespace search {
-namespace transactionlog {
+namespace search::transactionlog {
namespace {
@@ -66,5 +66,4 @@ TransLogServerExplorer::get_child(vespalib::stringref name) const
return std::unique_ptr<vespalib::StateExplorer>(new DomainExplorer(std::move(domain)));
}
-} // namespace search::transactionlog
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/transactionlog/trans_log_server_explorer.h b/searchlib/src/vespa/searchlib/transactionlog/trans_log_server_explorer.h
index 9e125b2142e..65d3a687bc9 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/trans_log_server_explorer.h
+++ b/searchlib/src/vespa/searchlib/transactionlog/trans_log_server_explorer.h
@@ -5,8 +5,7 @@
#include "translogserver.h"
#include <vespa/vespalib/net/state_explorer.h>
-namespace search {
-namespace transactionlog {
+namespace search::transactionlog {
/**
* Class used to explore the state of a transaction log server.
@@ -23,5 +22,4 @@ public:
virtual std::unique_ptr<StateExplorer> get_child(vespalib::stringref name) const override;
};
-} // namespace search::transactionlog
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp b/searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp
index 5af7c293916..af2e8ad47a1 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp
+++ b/searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp
@@ -11,8 +11,7 @@ LOG_SETUP(".translogclient");
using namespace std::chrono_literals;
-namespace search {
-namespace transactionlog {
+namespace search::transactionlog {
namespace {
const double NEVER(-1.0);
@@ -408,4 +407,3 @@ TransLogClient::Visitor::~Visitor()
}
}
-}
diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogserver.h b/searchlib/src/vespa/searchlib/transactionlog/translogserver.h
index 6ae48cdfff6..e7aca212b07 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/translogserver.h
+++ b/searchlib/src/vespa/searchlib/transactionlog/translogserver.h
@@ -7,11 +7,9 @@
#include <vespa/fnet/frt/invokable.h>
#include <mutex>
-namespace search {
+namespace search::common { class FileHeaderContext; }
-namespace common { class FileHeaderContext; }
-
-namespace transactionlog {
+namespace search::transactionlog {
class TransLogServerExplorer;
@@ -100,5 +98,3 @@ private:
};
}
-}
-
diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.cpp b/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.cpp
index fbc1694a8a0..b84d7854457 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.cpp
+++ b/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.cpp
@@ -8,8 +8,7 @@ LOG_SETUP(".translogserverapp");
using search::common::FileHeaderContext;
-namespace search {
-namespace transactionlog {
+namespace search::transactionlog {
TransLogServerApp::TransLogServerApp(const config::ConfigUri & tlsConfigUri,
const FileHeaderContext & fileHeaderContext)
@@ -40,14 +39,8 @@ DomainPart::Crc getCrc(searchlib::TranslogserverConfig::Crcmethod crcType)
void TransLogServerApp::start()
{
std::shared_ptr<searchlib::TranslogserverConfig> c = _tlsConfig.get();
- _tls.reset(new TransLogServer(c->servername,
- c->listenport,
- c->basedir,
- _fileHeaderContext,
- c->filesizemax,
- c->usefsync,
- c->maxthreads,
- getCrc(c->crcmethod)));
+ _tls.reset(new TransLogServer(c->servername, c->listenport, c->basedir, _fileHeaderContext,
+ c->filesizemax, c->usefsync, c->maxthreads, getCrc(c->crcmethod)));
}
TransLogServerApp::~TransLogServerApp()
@@ -63,4 +56,3 @@ void TransLogServerApp::configure(std::unique_ptr<searchlib::TranslogserverConfi
}
}
-}
diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.h b/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.h
index c36b58b4696..35fa994d1e4 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.h
+++ b/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.h
@@ -7,12 +7,9 @@
#include <vespa/vespalib/util/ptrholder.h>
namespace config { class ConfigUri; }
+namespace search::common { class FileHeaderContext; }
-namespace search {
-
-namespace common { class FileHeaderContext; }
-
-namespace transactionlog {
+namespace search::transactionlog {
class TransLogServerApp : public config::IFetcherCallback<searchlib::TranslogserverConfig>
{
@@ -36,5 +33,4 @@ public:
void start();
};
-} // namespace transactionlog
-} // namespace search
+}
diff --git a/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp b/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp
index 677723f591e..fbc2b6d348f 100644
--- a/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp
+++ b/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp
@@ -142,7 +142,7 @@ MapBucketDatabase::update(const Entry& newEntry)
assert(newEntry.valid());
LOG_BUCKET_OPERATION_NO_LOCK(
newEntry.getBucketId(),
- vespalib::make_vespa_string(
+ vespalib::make_string(
"bucketdb insert of %s", newEntry.toString().c_str()));
Entry* found = find(0, 0, newEntry.getBucketId(), true);
diff --git a/storage/src/vespa/storage/common/bucketoperationlogger.cpp b/storage/src/vespa/storage/common/bucketoperationlogger.cpp
index b80f6fb0562..d6df7f928e2 100644
--- a/storage/src/vespa/storage/common/bucketoperationlogger.cpp
+++ b/storage/src/vespa/storage/common/bucketoperationlogger.cpp
@@ -201,7 +201,7 @@ void logBucketDbInsert(uint64_t key, const bucketdb::StorageBucketInfo& entry)
{
LOG_BUCKET_OPERATION_NO_LOCK(
document::BucketId(document::BucketId::keyToBucketId(key)),
- vespalib::make_vespa_string(
+ vespalib::make_string(
"bucketdb insert Bucket(crc=%x, docs=%u, size=%u, "
"metacount=%u, usedfilesize=%u, ready=%s, "
"active=%s, lastModified=%zu) disk=%u",
@@ -308,7 +308,7 @@ logBucketDbInsert(uint64_t key, const BucketInfo& entry)
{
document::BucketId bucket(document::BucketId::keyToBucketId(key));
LOG_BUCKET_OPERATION_NO_LOCK(
- bucket, vespalib::make_vespa_string(
+ bucket, vespalib::make_string(
"bucketdb insert of %s", entry.toString().c_str()));
// Do some sanity checking of the inserted entry
checkAllConsistentNodesImpliesTrusted(bucket, entry);
diff --git a/storage/src/vespa/storage/common/bucketoperationlogger.h b/storage/src/vespa/storage/common/bucketoperationlogger.h
index 5d0d09b5cb5..dce9334a9cf 100644
--- a/storage/src/vespa/storage/common/bucketoperationlogger.h
+++ b/storage/src/vespa/storage/common/bucketoperationlogger.h
@@ -1,13 +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 <string>
-#include <map>
-#include <list>
#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/util/sync.h>
#include <vespa/document/bucket/bucketid.h>
-#include <vespa/vespalib/util/vstringfmt.h>
+#include <map>
+#include <list>
/**
* Enable this to log most slotfile operations (such as all mutations) as
diff --git a/storage/src/vespa/storage/distributor/bucketdbupdater.cpp b/storage/src/vespa/storage/distributor/bucketdbupdater.cpp
index 0335d679652..67942d3d447 100644
--- a/storage/src/vespa/storage/distributor/bucketdbupdater.cpp
+++ b/storage/src/vespa/storage/distributor/bucketdbupdater.cpp
@@ -693,7 +693,7 @@ BucketDBUpdater::NodeRemover::setCopiesInEntry(
LOG(debug, "Changed %s", e->toString().c_str());
LOG_BUCKET_OPERATION_NO_LOCK(
e.getBucketId(),
- vespalib::make_vespa_string("updated bucketdb entry to %s",
+ vespalib::make_string("updated bucketdb entry to %s",
e->toString().c_str()));
}
diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp b/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp
index 5c69c4576f0..a75a56b63c9 100644
--- a/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp
+++ b/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp
@@ -108,7 +108,7 @@ SplitOperation::onReceive(DistributorMessageSender&, const api::StorageReply::SP
| DatabaseUpdate::RESET_TRUSTED));
LOG_BUCKET_OPERATION_NO_LOCK(
- sinfo.first, vespalib::make_vespa_string(
+ sinfo.first, vespalib::make_string(
"Split from bucket %s: %s",
getBucketId().toString().c_str(),
copy.toString().c_str()));
@@ -140,13 +140,13 @@ SplitOperation::onReceive(DistributorMessageSender&, const api::StorageReply::SP
#ifdef ENABLE_BUCKET_OPERATION_LOGGING
if (_ok) {
LOG_BUCKET_OPERATION_NO_LOCK(
- getBucketId(), vespalib::make_vespa_string(
+ getBucketId(), vespalib::make_string(
"Split OK on node %d: %s. Finished: %s",
node, ost.str().c_str(),
_tracker.finished() ? "yes" : "no"));
} else {
LOG_BUCKET_OPERATION_NO_LOCK(
- getBucketId(), vespalib::make_vespa_string(
+ getBucketId(), vespalib::make_string(
"Split FAILED on node %d: %s. Finished: %s",
node, rep.getResult().toString().c_str(),
_tracker.finished() ? "yes" : "no"));
diff --git a/storage/src/vespa/storage/distributor/pendingclusterstate.cpp b/storage/src/vespa/storage/distributor/pendingclusterstate.cpp
index 2039c1b5177..bd14ded3710 100644
--- a/storage/src/vespa/storage/distributor/pendingclusterstate.cpp
+++ b/storage/src/vespa/storage/distributor/pendingclusterstate.cpp
@@ -425,7 +425,7 @@ PendingClusterState::insertInfo(
LOG_BUCKET_OPERATION_NO_LOCK(
_entries[range.first].bucketId,
- vespalib::make_vespa_string("insertInfo: %s",
+ vespalib::make_string("insertInfo: %s",
info.toString().c_str()));
}
diff --git a/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp b/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp
index 5002c203154..a35a19b4f71 100644
--- a/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp
+++ b/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp
@@ -297,7 +297,7 @@ PersistenceMessageTrackerImpl::handleCreateBucketReply(
_manager.removeNodeFromDB(reply.getBucketId(), node);
LOG_BUCKET_OPERATION_NO_LOCK(
reply.getBucketId(),
- vespalib::make_vespa_string(
+ vespalib::make_string(
"Deleted bucket on node %u due to failing create bucket %s",
node, reply.getResult().toString().c_str()));
}
diff --git a/storage/src/vespa/storage/persistence/bucketownershipnotifier.cpp b/storage/src/vespa/storage/persistence/bucketownershipnotifier.cpp
index 1c79bd83286..c492dd4b55e 100644
--- a/storage/src/vespa/storage/persistence/bucketownershipnotifier.cpp
+++ b/storage/src/vespa/storage/persistence/bucketownershipnotifier.cpp
@@ -89,7 +89,7 @@ BucketOwnershipNotifier::logNotification(const document::BucketId& bucket,
newInfo.toString().c_str());
LOG_BUCKET_OPERATION_NO_LOCK(
bucket,
- vespalib::make_vespa_string(
+ vespalib::make_string(
"Sending notify to distributor %u "
"(ownership changed away from %u)",
currentOwnerIndex, sourceIndex));
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
index e5525e1fd17..e7fa4eadda0 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
@@ -781,7 +781,7 @@ FileStorHandlerImpl::remapMessage(
targetDisk = targets[idx]->diskIndex;
#if defined(ENABLE_BUCKET_OPERATION_LOGGING)
{
- vespalib::string desc = vespalib::make_vespa_string(
+ vespalib::string desc = vespalib::make_string(
"Remapping %s from %s to %s, targetDisk = %u",
cmd.toString().c_str(), source.toString().c_str(),
targets[idx]->bid.toString().c_str(), targetDisk);
@@ -829,7 +829,7 @@ FileStorHandlerImpl::remapMessage(
targetDisk = targets[0]->diskIndex;
#ifdef ENABLE_BUCKET_OPERATION_LOGGING
{
- vespalib::string desc = vespalib::make_vespa_string(
+ vespalib::string desc = vespalib::make_string(
"Remapping %s from %s to %s, targetDisk = %u",
cmd.toString().c_str(), source.toString().c_str(),
targets[0]->bid.toString().c_str(), targetDisk);
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
index 47575229fb3..1e74c957b01 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
@@ -271,7 +271,7 @@ FileStorManager::handlePersistenceMessage(
LOG_BUCKET_OPERATION_NO_LOCK(
getStorageMessageBucketId(*msg),
- vespalib::make_vespa_string("Attempting to queue %s to disk %u",
+ vespalib::make_string("Attempting to queue %s to disk %u",
msg->toString().c_str(), disk));
diff --git a/storage/src/vespa/storage/persistence/persistencethread.cpp b/storage/src/vespa/storage/persistence/persistencethread.cpp
index fa8231d5353..4755795526a 100644
--- a/storage/src/vespa/storage/persistence/persistencethread.cpp
+++ b/storage/src/vespa/storage/persistence/persistencethread.cpp
@@ -567,7 +567,7 @@ PersistenceThread::handleSplitBucket(api::SplitBucketCommand& cmd)
#ifdef ENABLE_BUCKET_OPERATION_LOGGING
{
vespalib::string desc(
- vespalib::make_vespa_string(
+ vespalib::make_string(
"split(%s -> %s, %s)",
cmd.getBucketId().toString().c_str(),
target1.toString().c_str(),
@@ -743,7 +743,7 @@ PersistenceThread::handleJoinBuckets(api::JoinBucketsCommand& cmd)
#ifdef ENABLE_BUCKET_OPERATION_LOGGING
{
vespalib::string desc(
- vespalib::make_vespa_string(
+ vespalib::make_string(
"join(%s, %s -> %s)",
firstBucket.toString().c_str(),
secondBucket.toString().c_str(),
@@ -1149,7 +1149,7 @@ PersistenceThread::flushAllReplies(
}
LOG_BUCKET_OPERATION(
bucketId,
- vespalib::make_vespa_string(
+ vespalib::make_string(
"flushing %zu operations (%zu puts, %zu removes, "
"%zu other)",
replies.size(), nputs, nremoves, nother));
diff --git a/vbench/src/vbench/core/string.cpp b/vbench/src/vbench/core/string.cpp
index 0884ca1946c..3a9ed24563f 100644
--- a/vbench/src/vbench/core/string.cpp
+++ b/vbench/src/vbench/core/string.cpp
@@ -1,12 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "string.h"
-
-#if USE_VESPA_STRING
-#include <vespa/vespalib/util/vstringfmt.h>
-#else
#include <vespa/vespalib/util/stringfmt.h>
-#endif
namespace vbench {
@@ -14,11 +9,7 @@ string strfmt(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
-#if USE_VESPA_STRING
- string ret = vespalib::make_vespa_string_va(fmt, ap);
-#else
string ret = vespalib::make_string_va(fmt, ap);
-#endif
va_end(ap);
return ret;
}
diff --git a/vespalib/src/tests/stringfmt/fmt.cpp b/vespalib/src/tests/stringfmt/fmt.cpp
index 782486886d5..f9bd0ae12fb 100644
--- a/vespalib/src/tests/stringfmt/fmt.cpp
+++ b/vespalib/src/tests/stringfmt/fmt.cpp
@@ -1,31 +1,11 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/util/stringfmt.h>
-#include <vespa/vespalib/util/vstringfmt.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
using vespalib::make_string;
-using vespalib::make_vespa_string;
-class Test : public vespalib::TestApp
-{
-public:
- void testSimple();
- int Main() override;
-};
-
-static bool eq(const vespalib::string& a, const vespalib::string& b)
-{
- if (a == b) {
- return true;
- } else {
- return false;
- }
-}
-
-
-void
-Test::testSimple()
+TEST("test that make_string formats as one can expect.")
{
int i=7;
int j=0x666;
@@ -39,27 +19,13 @@ Test::testSimple()
EXPECT_TRUE(tst == foo);
EXPECT_TRUE(tst == bar);
- vespalib::string foo_v = make_vespa_string("%d/%x", i, j);
- vespalib::string bar_v = make_vespa_string("%d/%x", i, j).c_str();
- vespalib::string tst_v = tst;
-
- EXPECT_TRUE(tst_v == foo_v);
- EXPECT_TRUE(tst_v == bar_v);
-
EXPECT_TRUE(tst == make_string("%d/%x", i, j));
- EXPECT_TRUE(tst_v == make_vespa_string("%d/%x", i, j));
tst = "a test ";
- tst_v = tst;
EXPECT_TRUE(tst == make_string("%s", s));
- EXPECT_TRUE(tst_v == make_vespa_string("%s", s));
tst = "a t";
EXPECT_TRUE(tst == make_string("%.3s", s));
- tst_v = tst;
- foo_v = make_vespa_string("%.3s", s);
- EXPECT_TRUE(eq(tst, make_string("%.3s", s)));
- EXPECT_TRUE(eq(tst_v, make_vespa_string("%.3s", s)));
const char *p = "really really really really "
"very very very very very "
@@ -70,18 +36,7 @@ Test::testSimple()
"hugely hugely hugely hugely "
"bloated fat long string";
tst = p;
- EXPECT_TRUE(eq(tst, make_string("%s", p)));
- tst_v = tst;
- EXPECT_TRUE(eq(tst_v, make_vespa_string("%s", p)));
-}
-
-
-int
-Test::Main()
-{
- TEST_INIT("stringfmt_test");
- testSimple();
- TEST_DONE();
+ EXPECT_TRUE(tst == make_string("%s", p));
}
-TEST_APPHOOK(Test)
+TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/vespalib/src/vespa/vespalib/util/stringfmt.cpp b/vespalib/src/vespa/vespalib/util/stringfmt.cpp
index 1b2af46c670..266fb60714d 100644
--- a/vespalib/src/vespa/vespalib/util/stringfmt.cpp
+++ b/vespalib/src/vespa/vespalib/util/stringfmt.cpp
@@ -1,14 +1,13 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "stringfmt.h"
-#include "vstringfmt.h"
#include <cassert>
namespace vespalib {
//-----------------------------------------------------------------------------
-vespalib::string make_vespa_string_va(const char *fmt, va_list ap)
+vespalib::string make_string_va(const char *fmt, va_list ap)
{
va_list ap2;
vespalib::string ret;
@@ -42,27 +41,13 @@ vespalib::string make_vespa_string_va(const char *fmt, va_list ap)
* @param fmt format string
* @return formatted vespalib::string
**/
-vespalib::string make_vespa_string(const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- vespalib::string ret = make_vespa_string_va(fmt, ap);
- va_end(ap);
- return ret;
-}
-
vespalib::string make_string(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
- vespalib::string ret = make_vespa_string_va(fmt, ap);
+ vespalib::string ret = make_string_va(fmt, ap);
va_end(ap);
return ret;
}
-vespalib::string make_string_va(const char *fmt, va_list ap)
-{
- return make_vespa_string_va(fmt, ap);
-}
-
} // namespace vespalib
diff --git a/vespalib/src/vespa/vespalib/util/stringfmt.h b/vespalib/src/vespa/vespalib/util/stringfmt.h
index f806368adf5..df23ad7c20a 100644
--- a/vespalib/src/vespa/vespalib/util/stringfmt.h
+++ b/vespalib/src/vespa/vespalib/util/stringfmt.h
@@ -1,8 +1,8 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <cstdarg>
#include <vespa/vespalib/stllike/string.h>
+#include <cstdarg>
#ifndef PRId64
#define PRId64 "ld"
diff --git a/vespalib/src/vespa/vespalib/util/vstringfmt.h b/vespalib/src/vespa/vespalib/util/vstringfmt.h
deleted file mode 100644
index f2dff7e8394..00000000000
--- a/vespalib/src/vespa/vespalib/util/vstringfmt.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#pragma once
-
-#include <stdarg.h>
-#include <vespa/vespalib/stllike/string.h>
-
-namespace vespalib {
-
-extern vespalib::string make_vespa_string_va(const char *fmt, va_list ap);
-
-extern vespalib::string make_vespa_string(const char *fmt, ...)
-#ifdef __GNUC__
- // Add printf format checks with gcc
- __attribute__ ((format (printf,1,2)))
-#endif
- ;
-
-} // namespace vespalib
-