summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-04-20 12:37:56 +0200
committerHenning Baldersheim <balder@oath.com>2018-04-20 12:37:56 +0200
commit7a3834a9373da78e2883fcac78a02f6b78e5a502 (patch)
tree703636ebd7f42d62e6ffb57300e144e9bb240420
parente590767e3bb6346b1edf65f3a2e0e66c33608a77 (diff)
Minor cleanup while reading code
-rw-r--r--persistence/src/vespa/persistence/spi/clusterstate.cpp14
-rw-r--r--persistence/src/vespa/persistence/spi/clusterstate.h8
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp5
3 files changed, 11 insertions, 16 deletions
diff --git a/persistence/src/vespa/persistence/spi/clusterstate.cpp b/persistence/src/vespa/persistence/spi/clusterstate.cpp
index fc5c970b371..bc30197978f 100644
--- a/persistence/src/vespa/persistence/spi/clusterstate.cpp
+++ b/persistence/src/vespa/persistence/spi/clusterstate.cpp
@@ -40,7 +40,7 @@ ClusterState::ClusterState(const ClusterState& other) {
deserialize(o);
}
-ClusterState::~ClusterState() { }
+ClusterState::~ClusterState() = default;
ClusterState& ClusterState::operator=(const ClusterState& other) {
ClusterState copy(other);
@@ -51,8 +51,8 @@ ClusterState& ClusterState::operator=(const ClusterState& other) {
}
bool ClusterState::shouldBeReady(const Bucket& b) const {
- assert(_distribution.get());
- assert(_state.get());
+ assert(_distribution);
+ assert(_state);
if (_distribution->getReadyCopies() >= _distribution->getRedundancy()) {
return true; // all copies should be ready
@@ -69,11 +69,11 @@ bool ClusterState::shouldBeReady(const Bucket& b) const {
}
bool ClusterState::clusterUp() const {
- return _state.get() && _state->getClusterState() == lib::State::UP;
+ return _state && _state->getClusterState() == lib::State::UP;
}
bool ClusterState::nodeHasStateOneOf(const char* states) const {
- return _state.get() &&
+ return _state &&
_state->getNodeState(lib::Node(lib::NodeType::STORAGE, _nodeIndex)).
getState().oneOf(states);
}
@@ -91,8 +91,8 @@ bool ClusterState::nodeRetired() const {
}
void ClusterState::serialize(vespalib::nbostream& o) const {
- assert(_distribution.get());
- assert(_state.get());
+ assert(_distribution);
+ assert(_state);
vespalib::asciistream tmp;
_state->serialize(tmp, false);
o << tmp.str() << _nodeIndex;
diff --git a/persistence/src/vespa/persistence/spi/clusterstate.h b/persistence/src/vespa/persistence/spi/clusterstate.h
index e0db8cc7196..f5dda1fd745 100644
--- a/persistence/src/vespa/persistence/spi/clusterstate.h
+++ b/persistence/src/vespa/persistence/spi/clusterstate.h
@@ -3,14 +3,13 @@
#include "bucket.h"
-namespace storage {
-namespace lib {
+namespace storage::lib {
class ClusterState;
class Distribution;
}
-namespace spi {
+namespace storage::spi {
/**
* Used to determine the state of the current node and its buckets.
@@ -77,6 +76,3 @@ private:
};
}
-
-}
-
diff --git a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp
index 71b6fe73e38..987218beefa 100644
--- a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp
@@ -261,7 +261,7 @@ CombiningFeedView::setCalculator(const IBucketStateCalculator::SP &newCalc)
{
// Called by document db executor
_calc = newCalc;
- _clusterUp = _calc.get() != NULL && _calc->clusterUp();
+ _clusterUp = _calc && _calc->clusterUp();
_forceReady = !_clusterUp || !hasNotReadyFeedView();
}
@@ -274,8 +274,7 @@ CombiningFeedView::shouldBeReady(const document::BucketId &bucket) const
bucket.toString().c_str(),
(_forceReady ? "true" : "false"),
(_clusterUp ? "true" : "false"),
- (_calc.get() != NULL ?
- (_calc->shouldBeReady(dbucket) ? "true" : "false") : "null"));
+ (_calc ? (_calc->shouldBeReady(dbucket) ? "true" : "false") : "null"));
const documentmetastore::IBucketHandler *readyMetaStore =
_metaStores[getReadyFeedViewId()];
bool isActive = readyMetaStore->getBucketDB().takeGuard()->isActiveBucket(bucket);