aboutsummaryrefslogtreecommitdiffstats
path: root/searchcorespi
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2019-06-05 11:50:16 +0000
committerGeir Storli <geirst@verizonmedia.com>2019-06-05 11:50:16 +0000
commit8c5743fca9173e780a527f88b36cda797179623f (patch)
tree6c9c9b3e0674e666023b5c5362d1a26faa4b5a6b /searchcorespi
parentb9f4ec369069bf21f62debf94bc2cbcd7f700ddb (diff)
Style changes.
Diffstat (limited to 'searchcorespi')
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/idiskindex.h10
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/imemoryindex.h20
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp23
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h69
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexsearchable.h13
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/isearchableindexcollection.h9
6 files changed, 57 insertions, 87 deletions
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 <vespa/searchcorespi/index/indexsearchable.h>
#include <vespa/searchcommon/common/schema.h>
+#include <vespa/searchcorespi/index/indexsearchable.h>
#include <vespa/vespalib/stllike/string.h>
-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<IDiskIndex> SP;
+ using SP = std::shared_ptr<IDiskIndex>;
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 <vespa/searchcommon/common/schema.h>
#include <vespa/searchcorespi/index/indexsearchable.h>
#include <vespa/searchlib/common/serialnum.h>
-#include <vespa/vespalib/util/memoryusage.h>
#include <vespa/vespalib/stllike/string.h>
+#include <vespa/vespalib/util/memoryusage.h>
-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<IMemoryIndex> SP;
- using OnWriteDoneType =
- const std::shared_ptr<search::IDestructorCallback> &;
+ using SP = std::shared_ptr<IMemoryIndex>;
+ using OnWriteDoneType = const std::shared_ptr<search::IDestructorCallback> &;
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 <vespa/fastos/file.h>
+#include <vespa/searchcorespi/flush/closureflushtask.h>
#include <vespa/searchlib/common/serialnumfileheadercontext.h>
#include <vespa/searchlib/util/dirtraverse.h>
#include <vespa/searchlib/util/filekit.h>
+#include <vespa/vespalib/io/fileutil.h>
+#include <vespa/vespalib/util/array.hpp>
#include <vespa/vespalib/util/autoclosurecaller.h>
#include <vespa/vespalib/util/closuretask.h>
+#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/util/lambdatask.h>
#include <sstream>
-#include <vespa/searchcorespi/flush/closureflushtask.h>
-#include <vespa/vespalib/io/fileutil.h>
-#include <vespa/vespalib/util/exceptions.h>
-#include <vespa/vespalib/util/array.hpp>
-#include <vespa/fastos/file.h>
-#include <vespa/log/log.h>
+#include <vespa/log/log.h>
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 <memory>
#include <vector>
-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<uint32_t> FlushIds;
- typedef std::vector<FrozenMemoryIndexRef> FrozenMemoryIndexRefs;
- typedef search::queryeval::ISourceSelector ISourceSelector;
+ using FlushIds = std::vector<uint32_t>;
+ using FrozenMemoryIndexRefs = std::vector<FrozenMemoryIndexRef>;
+ 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 <vespa/searchlib/queryeval/searchable.h>
#include <vespa/searchcommon/attribute/iattributecontext.h>
+#include <vespa/searchlib/common/serialnum.h>
#include <vespa/searchlib/query/tree/node.h>
-#include <vespa/searchlib/queryeval/field_spec.h>
#include <vespa/searchlib/queryeval/blueprint.h>
+#include <vespa/searchlib/queryeval/field_spec.h>
#include <vespa/searchlib/queryeval/irequestcontext.h>
+#include <vespa/searchlib/queryeval/searchable.h>
#include <vespa/searchlib/util/searchable_stats.h>
-#include <vespa/searchlib/common/serialnum.h>
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<ISearchableIndexCollection> UP;
- typedef std::shared_ptr<ISearchableIndexCollection> SP;
+ using UP = std::unique_ptr<ISearchableIndexCollection>;
+ using SP = std::shared_ptr<ISearchableIndexCollection>;
+
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;
};