diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-02-16 10:23:33 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-02-16 10:23:33 +0000 |
commit | 9bef50c39306a9515d170c866bc0421931626ebf (patch) | |
tree | f67e73c868742bf3ce502fa7fcea8ca3762a0f4e /persistence | |
parent | 213d618f7e974baaba6209365155d602e71b0543 (diff) |
GC unused includes and code.
Unify with nested includes.
Diffstat (limited to 'persistence')
23 files changed, 53 insertions, 182 deletions
diff --git a/persistence/src/vespa/persistence/spi/abstractpersistenceprovider.cpp b/persistence/src/vespa/persistence/spi/abstractpersistenceprovider.cpp index 7f6bd835cd5..e35a6a74bde 100644 --- a/persistence/src/vespa/persistence/spi/abstractpersistenceprovider.cpp +++ b/persistence/src/vespa/persistence/spi/abstractpersistenceprovider.cpp @@ -6,9 +6,7 @@ #include <vespa/document/fieldset/fieldsets.h> #include <vespa/document/fieldvalue/document.h> -namespace storage { - -namespace spi { +namespace storage::spi { UpdateResult AbstractPersistenceProvider::update(const Bucket& bucket, Timestamp ts, @@ -66,5 +64,3 @@ AbstractPersistenceProvider::move(const Bucket& source, PartitionId target, Cont } } - -} diff --git a/persistence/src/vespa/persistence/spi/abstractpersistenceprovider.h b/persistence/src/vespa/persistence/spi/abstractpersistenceprovider.h index 27197c2adb8..557a9ec2edd 100644 --- a/persistence/src/vespa/persistence/spi/abstractpersistenceprovider.h +++ b/persistence/src/vespa/persistence/spi/abstractpersistenceprovider.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/persistence/spi/persistenceprovider.h> +#include "persistenceprovider.h" namespace storage::spi { diff --git a/persistence/src/vespa/persistence/spi/bucket.cpp b/persistence/src/vespa/persistence/spi/bucket.cpp index 9265f995a45..ef94519cdb0 100644 --- a/persistence/src/vespa/persistence/spi/bucket.cpp +++ b/persistence/src/vespa/persistence/spi/bucket.cpp @@ -4,8 +4,7 @@ #include <ostream> #include <vespa/vespalib/stllike/asciistream.h> -namespace storage { -namespace spi { +namespace storage::spi { vespalib::string Bucket::toString() const { @@ -30,5 +29,4 @@ operator<<(std::ostream& os, const Bucket& bucket) { return os << bucket.toString(); } -} // spi -} // storage +} diff --git a/persistence/src/vespa/persistence/spi/bucket.h b/persistence/src/vespa/persistence/spi/bucket.h index 54760304694..874074d7e24 100644 --- a/persistence/src/vespa/persistence/spi/bucket.h +++ b/persistence/src/vespa/persistence/spi/bucket.h @@ -17,8 +17,7 @@ #include <persistence/spi/types.h> #include <vespa/document/bucket/bucket.h> -namespace storage { -namespace spi { +namespace storage::spi { class Bucket { document::Bucket _bucket; @@ -47,6 +46,4 @@ public: vespalib::asciistream& operator<<(vespalib::asciistream& out, const Bucket& bucket); std::ostream& operator<<(std::ostream& out, const Bucket& bucket); -} // spi -} // storage - +} diff --git a/persistence/src/vespa/persistence/spi/bucketinfo.cpp b/persistence/src/vespa/persistence/spi/bucketinfo.cpp index e60d6152058..5bef59a65f1 100644 --- a/persistence/src/vespa/persistence/spi/bucketinfo.cpp +++ b/persistence/src/vespa/persistence/spi/bucketinfo.cpp @@ -3,8 +3,7 @@ #include "bucketinfo.h" #include <vespa/vespalib/stllike/asciistream.h> -namespace storage { -namespace spi { +namespace storage::spi { BucketInfo::BucketInfo() : _checksum(0), @@ -73,5 +72,4 @@ std::ostream& operator<<(std::ostream& out, const BucketInfo& info) { return out << info.toString(); } -} // spi -} // storage +} diff --git a/persistence/src/vespa/persistence/spi/bucketinfo.h b/persistence/src/vespa/persistence/spi/bucketinfo.h index fd4605229f8..827aad48d7f 100644 --- a/persistence/src/vespa/persistence/spi/bucketinfo.h +++ b/persistence/src/vespa/persistence/spi/bucketinfo.h @@ -8,9 +8,7 @@ #include <persistence/spi/types.h> -namespace vespalib { - class asciistream; -} +namespace vespalib { class asciistream; } namespace storage::spi { diff --git a/persistence/src/vespa/persistence/spi/clusterstate.cpp b/persistence/src/vespa/persistence/spi/clusterstate.cpp index bc30197978f..567d7ebc1ce 100644 --- a/persistence/src/vespa/persistence/spi/clusterstate.cpp +++ b/persistence/src/vespa/persistence/spi/clusterstate.cpp @@ -12,9 +12,9 @@ namespace storage::spi { ClusterState::ClusterState(const lib::ClusterState& state, uint16_t nodeIndex, const lib::Distribution& distribution) - : _state(new lib::ClusterState(state)), + : _state(std::make_unique<lib::ClusterState>(state)), _nodeIndex(nodeIndex), - _distribution(new lib::Distribution(distribution.serialize())) + _distribution(std::make_unique<lib::Distribution>(distribution.serialize())) { } @@ -26,8 +26,8 @@ void ClusterState::deserialize(vespalib::nbostream& i) { i >> _nodeIndex; i >> distribution; - _state.reset(new lib::ClusterState(clusterState)); - _distribution.reset(new lib::Distribution(distribution)); + _state = std::make_unique<lib::ClusterState>(clusterState); + _distribution = std::make_unique<lib::Distribution>(distribution); } ClusterState::ClusterState(vespalib::nbostream& i) { diff --git a/persistence/src/vespa/persistence/spi/clusterstateimpl.h b/persistence/src/vespa/persistence/spi/clusterstateimpl.h deleted file mode 100644 index 281c37eb9d5..00000000000 --- a/persistence/src/vespa/persistence/spi/clusterstateimpl.h +++ /dev/null @@ -1,66 +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 <vespa/persistence/spi/bucket.h> -#include <vespa/persistence/spi/clusterstate.h> - -namespace storage { - -namespace spi { - -/** - * Used to determine the state of the current node and its buckets. - */ -class ClusterStateImpl : public ClusterState{ -public: - ClusterStateImpl(); - - ClusterStateImpl(const lib::ClusterState& state, - uint16_t nodeIndex, - const lib::Distribution& distribution); - - ClusterStateImpl(vespalib::nbostream& i); - - ClusterStateImpl(const ClusterStateImpl& other); - - ClusterStateImpl& operator=(const ClusterStateImpl& other); - - /** - * Returns true if the given bucket is in the ideal state - * for readiness. - * - * @param b The bucket to check. - */ - bool shouldBeReady(const Bucket& b) const; - - /** - * Returns false if the cluster has been deemed down. This can happen - * if the fleet controller has detected that too many nodes are down - * compared to the complete list of nodes, and deigns the system to be - * unusable. - */ - bool clusterUp() const; - - /** - * Returns false if this node has been set in a state where it should not - * receive external load. - */ - bool nodeUp() const; - - /** - * Returns a serialized form of this object. - */ - void serialize(vespalib::nbostream& o) const; - -private: - std::unique_ptr<lib::ClusterState> _state; - uint16_t _nodeIndex; - std::unique_ptr<lib::Distribution> _distribution; - - void deserialize(vespalib::nbostream&); -}; - -} - -} - diff --git a/persistence/src/vespa/persistence/spi/context.cpp b/persistence/src/vespa/persistence/spi/context.cpp index 5ce34d5d139..429e2fb9d4e 100644 --- a/persistence/src/vespa/persistence/spi/context.cpp +++ b/persistence/src/vespa/persistence/spi/context.cpp @@ -2,8 +2,7 @@ #include "context.h" -namespace storage { -namespace spi { +namespace storage::spi { Context::Context(const LoadType& loadType, Priority pri, int maxTraceLevel) : _loadType(&loadType), @@ -12,7 +11,6 @@ Context::Context(const LoadType& loadType, Priority pri, int maxTraceLevel) _readConsistency(ReadConsistency::STRONG) { } -Context::~Context() { } +Context::~Context() = default; -} // spi -} // storage +} diff --git a/persistence/src/vespa/persistence/spi/context.h b/persistence/src/vespa/persistence/spi/context.h index ca4c79e3005..4061a3ad549 100644 --- a/persistence/src/vespa/persistence/spi/context.h +++ b/persistence/src/vespa/persistence/spi/context.h @@ -30,12 +30,10 @@ #pragma once #include <persistence/spi/types.h> -#include <vespa/persistence/spi/read_consistency.h> +#include "read_consistency.h" #include <vespa/vespalib/trace/trace.h> -namespace metrics { - class LoadType; -} +namespace metrics { class LoadType; } namespace storage::spi { @@ -62,10 +60,6 @@ public: const LoadType& getLoadType() const { return *_loadType; } Priority getPriority() const { return _priority; } - int getMaxTraceLevel() const { return _trace.getLevel(); } - void addTrace(const vespalib::TraceNode& traceNode) { - _trace.getRoot().addChild(traceNode); - } /** * A read operation might choose to relax its consistency requirements, diff --git a/persistence/src/vespa/persistence/spi/exceptions.cpp b/persistence/src/vespa/persistence/spi/exceptions.cpp index a1b9d57270c..d17c0f90ca0 100644 --- a/persistence/src/vespa/persistence/spi/exceptions.cpp +++ b/persistence/src/vespa/persistence/spi/exceptions.cpp @@ -2,11 +2,8 @@ #include "exceptions.h" -namespace storage { -namespace spi { +namespace storage::spi { VESPA_IMPLEMENT_EXCEPTION(HandledException, vespalib::Exception); -} // spi -} // storage - +} diff --git a/persistence/src/vespa/persistence/spi/exceptions.h b/persistence/src/vespa/persistence/spi/exceptions.h index 1c434fd8f00..e972e304567 100644 --- a/persistence/src/vespa/persistence/spi/exceptions.h +++ b/persistence/src/vespa/persistence/spi/exceptions.h @@ -3,8 +3,7 @@ #include <vespa/vespalib/util/exceptions.h> -namespace storage { -namespace spi { +namespace storage::spi { /** * Exception used where the cause has already been reported to the user, so @@ -16,6 +15,4 @@ namespace spi { */ VESPA_DEFINE_EXCEPTION(HandledException, vespalib::Exception); -} // spi -} // storage - +} diff --git a/persistence/src/vespa/persistence/spi/matcher.h b/persistence/src/vespa/persistence/spi/matcher.h index 02dc6db2261..bf989530f35 100644 --- a/persistence/src/vespa/persistence/spi/matcher.h +++ b/persistence/src/vespa/persistence/spi/matcher.h @@ -8,12 +8,11 @@ #pragma once -#include <vespa/persistence/spi/docentry.h> +#include "docentry.h" #include <persistence/spi/documentsubset.h> #include <persistence/spi/types.h> -namespace storage { -namespace spi { +namespace storage::spi { class Matcher { DocumentSubset _subset; @@ -37,6 +36,4 @@ struct AllMatcher : public Matcher { bool match(const DocEntry&) const { return true; } }; -} // spi -} // storage - +} diff --git a/persistence/src/vespa/persistence/spi/partitionstate.cpp b/persistence/src/vespa/persistence/spi/partitionstate.cpp index 123a82829ef..7cc42742019 100644 --- a/persistence/src/vespa/persistence/spi/partitionstate.cpp +++ b/persistence/src/vespa/persistence/spi/partitionstate.cpp @@ -4,8 +4,7 @@ #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/stllike/asciistream.h> -namespace storage { -namespace spi { +namespace storage::spi { PartitionState::PartitionState() : _state(UP), @@ -21,7 +20,7 @@ PartitionStateList::PartitionStateList(PartitionId::Type partitionCount) : _states(partitionCount) { } -PartitionStateList::~PartitionStateList() { } +PartitionStateList::~PartitionStateList() = default; PartitionState& PartitionStateList::operator[](PartitionId::Type index) @@ -34,5 +33,4 @@ PartitionStateList::operator[](PartitionId::Type index) return _states[index]; } -} // spi -} // storage +} diff --git a/persistence/src/vespa/persistence/spi/partitionstate.h b/persistence/src/vespa/persistence/spi/partitionstate.h index 6296a70b2c1..e5ce24abbe6 100644 --- a/persistence/src/vespa/persistence/spi/partitionstate.h +++ b/persistence/src/vespa/persistence/spi/partitionstate.h @@ -16,8 +16,7 @@ #include <persistence/spi/types.h> -namespace storage { -namespace spi { +namespace storage::spi { struct PartitionState { enum State { UP, DOWN }; @@ -49,6 +48,4 @@ public: PartitionId size() const { return PartitionId(_states.size()); } }; -} // spi -} // storage - +} diff --git a/persistence/src/vespa/persistence/spi/persistenceprovider.cpp b/persistence/src/vespa/persistence/spi/persistenceprovider.cpp index ec71928baba..61d141c0229 100644 --- a/persistence/src/vespa/persistence/spi/persistenceprovider.cpp +++ b/persistence/src/vespa/persistence/spi/persistenceprovider.cpp @@ -2,11 +2,8 @@ #include "persistenceprovider.h" -namespace storage { -namespace spi { +namespace storage::spi { -PersistenceProvider::~PersistenceProvider() { } - -} // spi -} // storage +PersistenceProvider::~PersistenceProvider() = default; +} diff --git a/persistence/src/vespa/persistence/spi/persistenceprovider.h b/persistence/src/vespa/persistence/spi/persistenceprovider.h index 96b3d385b87..857630e2606 100644 --- a/persistence/src/vespa/persistence/spi/persistenceprovider.h +++ b/persistence/src/vespa/persistence/spi/persistenceprovider.h @@ -11,9 +11,7 @@ #include "selection.h" #include "clusterstate.h" -namespace document { - class FieldSet; -} +namespace document { class FieldSet; } namespace storage::spi { diff --git a/persistence/src/vespa/persistence/spi/providerfactory.h b/persistence/src/vespa/persistence/spi/providerfactory.h index 6b4f0b20ae9..8be143851dd 100644 --- a/persistence/src/vespa/persistence/spi/providerfactory.h +++ b/persistence/src/vespa/persistence/spi/providerfactory.h @@ -8,14 +8,11 @@ #pragma once -#include <vespa/persistence/spi/persistenceprovider.h> +#include "persistenceprovider.h" -namespace document { - class DocumentTypeRepo; -} +namespace document { class DocumentTypeRepo; } -namespace storage { -namespace spi { +namespace storage::spi { struct ProviderFactory { virtual ~ProviderFactory() {} diff --git a/persistence/src/vespa/persistence/spi/read_consistency.cpp b/persistence/src/vespa/persistence/spi/read_consistency.cpp index cad15a5263d..c3b55e5a261 100644 --- a/persistence/src/vespa/persistence/spi/read_consistency.cpp +++ b/persistence/src/vespa/persistence/spi/read_consistency.cpp @@ -1,12 +1,11 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "read_consistency.h" -#include <iostream> +#include <ostream> #include <vespa/log/log.h> LOG_SETUP(".persistence.spi.read_consistency"); -namespace storage { -namespace spi { +namespace storage::spi { std::ostream& operator<<(std::ostream& os, ReadConsistency consistency) @@ -24,6 +23,4 @@ operator<<(std::ostream& os, ReadConsistency consistency) return os; } -} // spi -} // storage - +} diff --git a/persistence/src/vespa/persistence/spi/read_consistency.h b/persistence/src/vespa/persistence/spi/read_consistency.h index 507e05027cc..d90c43af407 100644 --- a/persistence/src/vespa/persistence/spi/read_consistency.h +++ b/persistence/src/vespa/persistence/spi/read_consistency.h @@ -2,10 +2,9 @@ #pragma once #include <iosfwd> -#include <stdint.h> +#include <cstdint> -namespace storage { -namespace spi { +namespace storage::spi { enum class ReadConsistency : uint8_t { /** @@ -28,9 +27,7 @@ enum class ReadConsistency : uint8_t { WEAK }; -std::ostream& -operator<<(std::ostream&, ReadConsistency); +std::ostream& operator<<(std::ostream&, ReadConsistency); -} // spi -} // storage +} diff --git a/persistence/src/vespa/persistence/spi/result.cpp b/persistence/src/vespa/persistence/spi/result.cpp index 024f5595102..f5131f08b1f 100644 --- a/persistence/src/vespa/persistence/spi/result.cpp +++ b/persistence/src/vespa/persistence/spi/result.cpp @@ -9,7 +9,7 @@ namespace storage::spi { Result::Result(const Result &) = default; Result & Result::operator = (const Result &) = default; -Result::~Result() { } +Result::~Result() = default; vespalib::string Result::toString() const { @@ -33,10 +33,10 @@ GetResult::GetResult(Document::UP doc, Timestamp timestamp) _doc(std::move(doc)) { } -GetResult::~GetResult() { } -BucketIdListResult::~BucketIdListResult() { } +GetResult::~GetResult() = default; +BucketIdListResult::~BucketIdListResult() = default; -IterateResult::~IterateResult() { } +IterateResult::~IterateResult() = default; } diff --git a/persistence/src/vespa/persistence/spi/selection.cpp b/persistence/src/vespa/persistence/spi/selection.cpp index 0cd50446488..c7ed98b9d92 100644 --- a/persistence/src/vespa/persistence/spi/selection.cpp +++ b/persistence/src/vespa/persistence/spi/selection.cpp @@ -2,8 +2,7 @@ #include "selection.h" -namespace storage { -namespace spi { +namespace storage::spi { Selection::Selection(const DocumentSelection& docSel) : _documentSelection(docSel), @@ -12,8 +11,7 @@ Selection::Selection(const DocumentSelection& docSel) _timestampSubset() { } -Selection::~Selection() { } +Selection::~Selection() = default; -} // spi -} // storage +} diff --git a/persistence/src/vespa/persistence/spi/selection.h b/persistence/src/vespa/persistence/spi/selection.h index 5c562cabd34..0f809cf1641 100644 --- a/persistence/src/vespa/persistence/spi/selection.h +++ b/persistence/src/vespa/persistence/spi/selection.h @@ -10,12 +10,7 @@ #include "documentselection.h" -namespace storage { -namespace spi { - -class MetaData { - Timestamp timestamp; -}; +namespace storage::spi { class Selection { public: @@ -67,13 +62,6 @@ public: Timestamp getFromTimestamp() const { return _fromTimestamp; } Timestamp getToTimestamp() const { return _toTimestamp; } - - /** - * Regular usage. - */ - bool match(const Document& doc, const MetaData& metaData) const; }; -} // spi -} // storage - +} |