From 8c5743fca9173e780a527f88b36cda797179623f Mon Sep 17 00:00:00 2001 From: Geir Storli Date: Wed, 5 Jun 2019 11:50:16 +0000 Subject: Style changes. --- .../src/vespa/searchcorespi/index/idiskindex.h | 10 ++-- .../src/vespa/searchcorespi/index/imemoryindex.h | 20 ++----- .../vespa/searchcorespi/index/indexmaintainer.cpp | 23 ++++---- .../vespa/searchcorespi/index/indexmaintainer.h | 69 ++++++++-------------- .../vespa/searchcorespi/index/indexsearchable.h | 13 ++-- .../index/isearchableindexcollection.h | 9 +-- 6 files changed, 57 insertions(+), 87 deletions(-) (limited to 'searchcorespi/src') diff --git a/searchcorespi/src/vespa/searchcorespi/index/idiskindex.h b/searchcorespi/src/vespa/searchcorespi/index/idiskindex.h index 844e0679884..1ed5415d678 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/idiskindex.h +++ b/searchcorespi/src/vespa/searchcorespi/index/idiskindex.h @@ -1,18 +1,17 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include #include +#include #include -namespace searchcorespi { -namespace index { +namespace searchcorespi::index { /** * Interface for a disk index as seen from an index maintainer. */ struct IDiskIndex : public IndexSearchable { - typedef std::shared_ptr SP; + using SP = std::shared_ptr; virtual ~IDiskIndex() {} /** @@ -27,7 +26,6 @@ struct IDiskIndex : public IndexSearchable { virtual const search::index::Schema &getSchema() const = 0; }; -} // namespace index -} // namespace searchcorespi +} diff --git a/searchcorespi/src/vespa/searchcorespi/index/imemoryindex.h b/searchcorespi/src/vespa/searchcorespi/index/imemoryindex.h index e25a3ef7b64..d33080552e8 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/imemoryindex.h +++ b/searchcorespi/src/vespa/searchcorespi/index/imemoryindex.h @@ -5,26 +5,19 @@ #include #include #include -#include #include +#include -namespace search -{ - -class IDestructorCallback; - -} +namespace search { class IDestructorCallback; } -namespace searchcorespi { -namespace index { +namespace searchcorespi::index { /** * Interface for a memory index as seen from an index maintainer. */ struct IMemoryIndex : public searchcorespi::IndexSearchable { - typedef std::shared_ptr SP; - using OnWriteDoneType = - const std::shared_ptr &; + using SP = std::shared_ptr; + using OnWriteDoneType = const std::shared_ptr &; virtual ~IMemoryIndex() {} /** @@ -81,7 +74,6 @@ struct IMemoryIndex : public searchcorespi::IndexSearchable { virtual search::index::Schema::SP getPrunedSchema() const = 0; }; -} // namespace index -} // namespace searchcorespi +} diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp index dd31c476567..668eeba6463 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp +++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp @@ -1,27 +1,27 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include "indexmaintainer.h" #include "diskindexcleaner.h" #include "eventlogger.h" #include "fusionrunner.h" #include "indexflushtarget.h" #include "indexfusiontarget.h" +#include "indexmaintainer.h" #include "indexreadutilities.h" #include "indexwriteutilities.h" +#include +#include #include #include #include +#include +#include #include #include +#include #include #include -#include -#include -#include -#include -#include -#include +#include LOG_SETUP(".searchcorespi.index.indexmaintainer"); using document::Document; @@ -42,13 +42,11 @@ using vespalib::Executor; using vespalib::LockGuard; using vespalib::Runnable; -namespace searchcorespi { -namespace index { +namespace searchcorespi::index { namespace { -class ReconfigRunnable : public Runnable -{ +class ReconfigRunnable : public Runnable { public: bool &_result; IIndexManager::Reconfigurer &_reconfigurer; @@ -1250,5 +1248,4 @@ IndexMaintainer::setMaxFlushed(uint32_t maxFlushed) _maxFlushed = maxFlushed; } -} // namespace index -} // namespace searchcorespi +} diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h index 06f02c5b9ef..c30825cbb3c 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h +++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h @@ -22,18 +22,11 @@ #include #include -namespace document { -class Document; -} +namespace document { class Document; } -namespace search { -namespace common { -class FileHeaderContext; -} -} +namespace search::common { class FileHeaderContext; } -namespace searchcorespi { -namespace index { +namespace searchcorespi::index { /** * The IndexMaintainer provides a holistic view of a set of disk and @@ -42,13 +35,11 @@ namespace index { * of memory indexes and fusion of disk indexes. */ class IndexMaintainer : public IIndexManager, - public IWarmupDone -{ + public IWarmupDone { /** * Extra memory that is frozen but not yet flushed. */ - class FrozenMemoryIndexRef - { + class FrozenMemoryIndexRef { public: typedef search::FixedSourceSelector::SaveInfo SaveInfo; typedef search::SerialNum SerialNum; @@ -70,8 +61,7 @@ class IndexMaintainer : public IIndexManager, { } }; - class ChangeGens - { + class ChangeGens { public: uint32_t _pruneGen; @@ -81,9 +71,10 @@ class IndexMaintainer : public IIndexManager, bool operator!=(const ChangeGens &rhs) const { return _pruneGen != rhs._pruneGen; } }; - typedef std::vector FlushIds; - typedef std::vector FrozenMemoryIndexRefs; - typedef search::queryeval::ISourceSelector ISourceSelector; + using FlushIds = std::vector; + using FrozenMemoryIndexRefs = std::vector; + using ISourceSelector = search::queryeval::ISourceSelector; + const vespalib::string _base_dir; const WarmupConfig _warmupConfig; ActiveDiskIndexes::SP _active_indexes; @@ -165,27 +156,24 @@ class IndexMaintainer : public IIndexManager, */ bool reopenDiskIndexes(ISearchableIndexCollection &coll); - void - updateDiskIndexSchema(const vespalib::string &indexDir, - const Schema &schema, - SerialNum serialNum); + void updateDiskIndexSchema(const vespalib::string &indexDir, + const Schema &schema, + SerialNum serialNum); - void - updateIndexSchemas(IIndexCollection &coll, - const Schema &schema, - SerialNum serialNum); + void updateIndexSchemas(IIndexCollection &coll, + const Schema &schema, + SerialNum serialNum); void updateActiveFusionPrunedSchema(const Schema &schema); void deactivateDiskIndexes(vespalib::string indexDir); IDiskIndex::SP loadDiskIndex(const vespalib::string &indexDir); IDiskIndex::SP reloadDiskIndex(const IDiskIndex &oldIndex); - IDiskIndex::SP - flushMemoryIndex(IMemoryIndex &memoryIndex, - uint32_t indexId, - uint32_t docIdLimit, - SerialNum serialNum, - search::FixedSourceSelector::SaveInfo &saveInfo); + IDiskIndex::SP flushMemoryIndex(IMemoryIndex &memoryIndex, + uint32_t indexId, + uint32_t docIdLimit, + SerialNum serialNum, + search::FixedSourceSelector::SaveInfo &saveInfo); ISearchableIndexCollection::UP loadDiskIndexes(const FusionSpec &spec, ISearchableIndexCollection::UP sourceList); void replaceSource(uint32_t sourceId, const IndexSearchable::SP &source); @@ -229,8 +217,7 @@ class IndexMaintainer : public IIndexManager, bool doneFlush(FlushArgs *args, IDiskIndex::SP *disk_index); - class FusionArgs - { + class FusionArgs { public: uint32_t _new_fusion_id; ChangeGens _changeGens; @@ -253,8 +240,7 @@ class IndexMaintainer : public IIndexManager, bool canRunFusion(const FusionSpec &spec) const; bool doneFusion(FusionArgs *args, IDiskIndex::SP *new_index); - class SetSchemaArgs - { + class SetSchemaArgs { public: Schema _newSchema; Schema _oldSchema; @@ -311,8 +297,7 @@ public: uint32_t runFusion(const FusionSpec &fusion_spec); void removeOldDiskIndexes(); - struct FlushStats - { + struct FlushStats { FlushStats() : memory_before_bytes(0), memory_after_bytes(0), @@ -326,8 +311,7 @@ public: uint64_t cpu_time_required; }; - struct FusionStats - { + struct FusionStats { FusionStats() : diskUsage(0), maxFlushed(0), @@ -387,6 +371,5 @@ public: void setMaxFlushed(uint32_t maxFlushed) override; }; -} // namespace index -} // namespace searchcorespi +} diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexsearchable.h b/searchcorespi/src/vespa/searchcorespi/index/indexsearchable.h index 957aeb4603b..03b7f91e47a 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/indexsearchable.h +++ b/searchcorespi/src/vespa/searchcorespi/index/indexsearchable.h @@ -2,14 +2,14 @@ #pragma once -#include #include +#include #include -#include #include +#include #include +#include #include -#include namespace searchcorespi { @@ -26,8 +26,7 @@ class IndexSearchableVisitor; * that let the components access a per query attribute context that expose * attribute vectors that can be utilized during query evaluation. **/ -class IndexSearchable : public search::queryeval::Searchable -{ +class IndexSearchable : public search::queryeval::Searchable { protected: using IRequestContext = search::queryeval::IRequestContext; using FieldSpec = search::queryeval::FieldSpec; @@ -43,12 +42,12 @@ public: */ virtual search::SearchableStats getSearchableStats() const = 0; - /* + /** * Returns the serial number for this index searchable. */ virtual search::SerialNum getSerialNum() const = 0; - /* + /** * Calls visitor with properly downcasted argument to differentiate * between different types of indexes (disk index or memory index). */ diff --git a/searchcorespi/src/vespa/searchcorespi/index/isearchableindexcollection.h b/searchcorespi/src/vespa/searchcorespi/index/isearchableindexcollection.h index 5f7f81898cf..d53141097d6 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/isearchableindexcollection.h +++ b/searchcorespi/src/vespa/searchcorespi/index/isearchableindexcollection.h @@ -11,12 +11,12 @@ namespace searchcorespi { * Interface to both an IndexCollection and to an IndexSearchable */ class ISearchableIndexCollection : public IIndexCollection, - public IndexSearchable -{ + public IndexSearchable { public: ISearchableIndexCollection() : _currentIndex(-1) { } - typedef std::unique_ptr UP; - typedef std::shared_ptr SP; + using UP = std::unique_ptr; + using SP = std::shared_ptr; + virtual void append(uint32_t id, const IndexSearchable::SP &source) = 0; virtual void replace(uint32_t id, const IndexSearchable::SP &source) = 0; virtual IndexSearchable::SP getSearchableSP(uint32_t i) const = 0; @@ -25,6 +25,7 @@ public: void setCurrentIndex(uint32_t id); uint32_t getCurrentIndex() const; bool valid() const; + private: int32_t _currentIndex; }; -- cgit v1.2.3