From abc81c8281f86d26e4a9f4b804640d2f3a99cb72 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Mon, 18 Jan 2021 19:46:50 +0000 Subject: Include exception where needed and use std:.make_unique --- persistence/src/vespa/persistence/spi/bucket.h | 1 - .../src/vespa/persistence/spi/clusterstate.cpp | 5 +-- .../src/vespa/persistence/spi/clusterstate.h | 7 ++-- .../src/vespa/persistence/spi/documentselection.h | 3 +- persistence/src/vespa/persistence/spi/exceptions.h | 2 +- persistence/src/vespa/persistence/spi/matcher.h | 39 ---------------------- persistence/src/vespa/persistence/spi/selection.h | 1 + 7 files changed, 12 insertions(+), 46 deletions(-) delete mode 100644 persistence/src/vespa/persistence/spi/matcher.h (limited to 'persistence') 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 #include 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 #include #include @@ -13,8 +14,8 @@ ClusterState::ClusterState(const lib::ClusterState& state, uint16_t nodeIndex, const lib::Distribution& distribution) : _state(std::make_unique(state)), - _nodeIndex(nodeIndex), - _distribution(std::make_unique(distribution.serialize())) + _distribution(std::make_unique(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 +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 _state; - uint16_t _nodeIndex; std::unique_ptr _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 +#include +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 +#include 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 -#include - -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 namespace storage::spi { -- cgit v1.2.3