summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-01-18 19:46:50 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-01-18 19:58:27 +0000
commitabc81c8281f86d26e4a9f4b804640d2f3a99cb72 (patch)
tree16a50b17021e56994747795f59f71d62f5b221c7
parentccb0e462b5cd0d6fc8fa78ff12bfd0784a29202e (diff)
Include exception where needed and use std:.make_unique
-rw-r--r--persistence/src/vespa/persistence/spi/bucket.h1
-rw-r--r--persistence/src/vespa/persistence/spi/clusterstate.cpp5
-rw-r--r--persistence/src/vespa/persistence/spi/clusterstate.h7
-rw-r--r--persistence/src/vespa/persistence/spi/documentselection.h3
-rw-r--r--persistence/src/vespa/persistence/spi/exceptions.h2
-rw-r--r--persistence/src/vespa/persistence/spi/matcher.h39
-rw-r--r--persistence/src/vespa/persistence/spi/selection.h1
-rw-r--r--searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp2
-rw-r--r--storage/src/vespa/storage/persistence/asynchandler.cpp3
-rw-r--r--storage/src/vespa/storage/storageserver/servicelayernode.cpp1
-rw-r--r--storageapi/src/vespa/storageapi/messageapi/messagehandler.h4
-rw-r--r--storageserver/src/apps/storaged/storage.cpp3
12 files changed, 19 insertions, 52 deletions
diff --git a/persistence/src/vespa/persistence/spi/bucket.h b/persistence/src/vespa/persistence/spi/bucket.h
index ab47d77bed7..30393109cc9 100644
--- a/persistence/src/vespa/persistence/spi/bucket.h
+++ b/persistence/src/vespa/persistence/spi/bucket.h
@@ -9,7 +9,6 @@
#pragma once
-#include <persistence/spi/types.h>
#include <vespa/document/bucket/bucket.h>
namespace storage::spi {
diff --git a/persistence/src/vespa/persistence/spi/clusterstate.cpp b/persistence/src/vespa/persistence/spi/clusterstate.cpp
index 567d7ebc1ce..8f25e7fb332 100644
--- a/persistence/src/vespa/persistence/spi/clusterstate.cpp
+++ b/persistence/src/vespa/persistence/spi/clusterstate.cpp
@@ -1,6 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "clusterstate.h"
+#include "bucket.h"
#include <vespa/vdslib/state/clusterstate.h>
#include <vespa/vdslib/distribution/distribution.h>
#include <vespa/vespalib/objects/nbostream.h>
@@ -13,8 +14,8 @@ ClusterState::ClusterState(const lib::ClusterState& state,
uint16_t nodeIndex,
const lib::Distribution& distribution)
: _state(std::make_unique<lib::ClusterState>(state)),
- _nodeIndex(nodeIndex),
- _distribution(std::make_unique<lib::Distribution>(distribution.serialize()))
+ _distribution(std::make_unique<lib::Distribution>(distribution.serialize())),
+ _nodeIndex(nodeIndex)
{
}
diff --git a/persistence/src/vespa/persistence/spi/clusterstate.h b/persistence/src/vespa/persistence/spi/clusterstate.h
index 9d2d3922a17..5b2b41b3161 100644
--- a/persistence/src/vespa/persistence/spi/clusterstate.h
+++ b/persistence/src/vespa/persistence/spi/clusterstate.h
@@ -1,8 +1,9 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include "bucket.h"
+#include <memory>
+namespace vespalib { class nbostream; }
namespace storage::lib {
class ClusterState;
class Distribution;
@@ -10,6 +11,8 @@ namespace storage::lib {
namespace storage::spi {
+class Bucket;
+
/**
* Used to determine the state of the current node and its buckets.
*/
@@ -67,8 +70,8 @@ public:
private:
std::unique_ptr<lib::ClusterState> _state;
- uint16_t _nodeIndex;
std::unique_ptr<lib::Distribution> _distribution;
+ uint16_t _nodeIndex;
void deserialize(vespalib::nbostream&);
bool nodeHasStateOneOf(const char* states) const;
diff --git a/persistence/src/vespa/persistence/spi/documentselection.h b/persistence/src/vespa/persistence/spi/documentselection.h
index af734d2e16e..eeea1f6c2bc 100644
--- a/persistence/src/vespa/persistence/spi/documentselection.h
+++ b/persistence/src/vespa/persistence/spi/documentselection.h
@@ -8,8 +8,9 @@
#pragma once
-#include <persistence/spi/types.h>
+#include <vespa/vespalib/stllike/string.h>
+namespace document { class Document; }
namespace storage::spi {
class DocumentSelection
diff --git a/persistence/src/vespa/persistence/spi/exceptions.h b/persistence/src/vespa/persistence/spi/exceptions.h
index e972e304567..8ac9c3765f0 100644
--- a/persistence/src/vespa/persistence/spi/exceptions.h
+++ b/persistence/src/vespa/persistence/spi/exceptions.h
@@ -1,7 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/util/exception.h>
namespace storage::spi {
diff --git a/persistence/src/vespa/persistence/spi/matcher.h b/persistence/src/vespa/persistence/spi/matcher.h
deleted file mode 100644
index bf989530f35..00000000000
--- a/persistence/src/vespa/persistence/spi/matcher.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-/**
- * \class storage::spi::Matcher
- * \ingroup spi
- *
- * \brief Use a matcher to find what documents one is interested in.
- */
-
-#pragma once
-
-#include "docentry.h"
-#include <persistence/spi/documentsubset.h>
-#include <persistence/spi/types.h>
-
-namespace storage::spi {
-
-class Matcher {
- DocumentSubset _subset;
-
-public:
- Matcher(const DocumentSubset& subset) : _subset(subset) {}
- virtual ~Matcher() {}
-
- virtual bool match(const DocEntry&) const = 0;
-
- /**
- * Get the document subset that this matcher needs in order to decide
- * whether a document entry should be matched or not. When match is called,
- * specified information is guarantueed to be set.
- */
- const DocumentSubset& getNeededParts() const { return _subset; }
-};
-
-struct AllMatcher : public Matcher {
- AllMatcher() : Matcher(DocumentSubset(0)) {}
- bool match(const DocEntry&) const { return true; }
-};
-
-}
diff --git a/persistence/src/vespa/persistence/spi/selection.h b/persistence/src/vespa/persistence/spi/selection.h
index 0f809cf1641..744af849c83 100644
--- a/persistence/src/vespa/persistence/spi/selection.h
+++ b/persistence/src/vespa/persistence/spi/selection.h
@@ -9,6 +9,7 @@
#pragma once
#include "documentselection.h"
+#include <persistence/spi/types.h>
namespace storage::spi {
diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp
index 67d96226f76..0d5d8ad3144 100644
--- a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp
+++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp
@@ -78,7 +78,7 @@ GenericResultHandler::~GenericResultHandler() = default;
class BucketIdListResultHandler : public IBucketIdListResultHandler
{
private:
- typedef vespalib::hash_set<document::BucketId, document::BucketId::hash> BucketIdSet;
+ using BucketIdSet = vespalib::hash_set<document::BucketId, document::BucketId::hash>;
BucketIdSet _bucketSet;
public:
BucketIdListResultHandler()
diff --git a/storage/src/vespa/storage/persistence/asynchandler.cpp b/storage/src/vespa/storage/persistence/asynchandler.cpp
index e7f7321a422..4b105f6688f 100644
--- a/storage/src/vespa/storage/persistence/asynchandler.cpp
+++ b/storage/src/vespa/storage/persistence/asynchandler.cpp
@@ -20,7 +20,7 @@ public:
}
void addResultHandler(const spi::ResultHandler *resultHandler) {
- // Only handles a signal handler now,
+ // Only handles a single handler now,
// Can be extended if necessary later on
assert(_resultHandler == nullptr);
_resultHandler = resultHandler;
@@ -219,4 +219,5 @@ AsyncHandler::tasConditionMatches(const api::TestAndSetCommand & cmd, MessageTra
return true;
}
+
}
diff --git a/storage/src/vespa/storage/storageserver/servicelayernode.cpp b/storage/src/vespa/storage/storageserver/servicelayernode.cpp
index 29edcc46cf9..c3cb1d8d6d6 100644
--- a/storage/src/vespa/storage/storageserver/servicelayernode.cpp
+++ b/storage/src/vespa/storage/storageserver/servicelayernode.cpp
@@ -16,6 +16,7 @@
#include <vespa/storage/persistence/filestorage/filestormanager.h>
#include <vespa/storage/persistence/filestorage/modifiedbucketchecker.h>
#include <vespa/persistence/spi/exceptions.h>
+#include <vespa/vespalib/util/exceptions.h>
#include <vespa/messagebus/rpcmessagebus.h>
#include <vespa/log/log.h>
diff --git a/storageapi/src/vespa/storageapi/messageapi/messagehandler.h b/storageapi/src/vespa/storageapi/messageapi/messagehandler.h
index 067858a0b61..17b3413b59f 100644
--- a/storageapi/src/vespa/storageapi/messageapi/messagehandler.h
+++ b/storageapi/src/vespa/storageapi/messageapi/messagehandler.h
@@ -52,7 +52,6 @@ class SetSystemStateCommand;
class ActivateClusterStateVersionCommand;
class ActivateClusterStateVersionReply;
class GetSystemStateCommand;
-class GetBucketNodesCommand;
class BucketsAddedCommand;
class BucketsRemovedCommand;
@@ -89,7 +88,6 @@ class SetNodeStateReply;
class GetNodeStateReply;
class SetSystemStateReply;
class GetSystemStateReply;
-class GetBucketNodesReply;
class BucketsAddedReply;
class BucketsRemovedReply;
@@ -190,7 +188,7 @@ public:
virtual bool onRemoveLocation(const std::shared_ptr<api::RemoveLocationCommand>&) { return false; }
virtual bool onRemoveLocationReply(const std::shared_ptr<api::RemoveLocationReply>&) { return false; }
- virtual ~MessageHandler() {}
+ virtual ~MessageHandler() = default;
};
#undef ON_M
diff --git a/storageserver/src/apps/storaged/storage.cpp b/storageserver/src/apps/storaged/storage.cpp
index 8fbeeb836da..8098ee138db 100644
--- a/storageserver/src/apps/storaged/storage.cpp
+++ b/storageserver/src/apps/storaged/storage.cpp
@@ -17,6 +17,7 @@
#include <vespa/storageserver/app/dummyservicelayerprocess.h>
#include <vespa/vespalib/util/programoptions.h>
#include <vespa/vespalib/util/shutdownguard.h>
+#include <vespa/vespalib/util/exceptions.h>
#include <vespa/config/helper/configgetter.hpp>
#include <vespa/fastos/app.h>
#include <iostream>
@@ -36,7 +37,7 @@ Process::UP createProcess(vespalib::stringref configId) {
config::ConfigUri uri(configId);
std::unique_ptr<vespa::config::content::core::StorServerConfig> serverConfig = config::ConfigGetter<vespa::config::content::core::StorServerConfig>::getConfig(uri.getConfigId(), uri.getContext());
if (serverConfig->isDistributor) {
- return Process::UP(new DistributorProcess(configId));
+ return std::make_unique<DistributorProcess>(configId);
} else switch (serverConfig->persistenceProvider.type) {
case vespa::config::content::core::StorServerConfig::PersistenceProvider::Type::STORAGE:
case vespa::config::content::core::StorServerConfig::PersistenceProvider::Type::DUMMY: