summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-05-09 18:59:18 +0200
committerHenning Baldersheim <balder@oath.com>2018-05-09 18:59:18 +0200
commitf5ee5d33eb956647894554ff46902d46ae1f309e (patch)
treeb94d6fa8cd707f42b5b1c0ab8664c7a7221202e4 /searchcore
parent21146b5c5770067c2ebe29e1ef498d8f798b43be (diff)
Code health
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/fdispatch/common/search.h186
-rw-r--r--searchcore/src/vespa/searchcore/fdispatch/search/fnet_search.h13
2 files changed, 53 insertions, 146 deletions
diff --git a/searchcore/src/vespa/searchcore/fdispatch/common/search.h b/searchcore/src/vespa/searchcore/fdispatch/common/search.h
index a1a8eb9f0ba..64aefab1411 100644
--- a/searchcore/src/vespa/searchcore/fdispatch/common/search.h
+++ b/searchcore/src/vespa/searchcore/fdispatch/common/search.h
@@ -29,16 +29,6 @@ public:
{
_value.VOIDP = NULL;
}
- explicit FastS_SearchContext(void *value)
- : _value()
- {
- _value.VOIDP = value;
- }
- explicit FastS_SearchContext(uint32_t value)
- : _value()
- {
- _value.INT = value;
- }
};
//----------------------------------------------------------------
@@ -231,10 +221,6 @@ public:
class FastS_SearchBase : public FastS_ISearch
{
-private:
- FastS_SearchBase(const FastS_SearchBase &);
- FastS_SearchBase& operator=(const FastS_SearchBase &);
-
protected:
uint32_t _dataSetID;
search::engine::ErrorCode _errorCode;
@@ -246,6 +232,8 @@ protected:
FastS_DocsumsResult _docsumsResult;
public:
+ FastS_SearchBase(const FastS_SearchBase &) = delete;
+ FastS_SearchBase& operator=(const FastS_SearchBase &) = delete;
FastS_SearchBase(uint32_t dataSetID)
: _dataSetID(dataSetID),
_errorCode(search::engine::ECODE_NO_ERROR),
@@ -258,14 +246,10 @@ public:
{
}
- virtual ~FastS_SearchBase()
- {
+ ~FastS_SearchBase() override {
free(_errorMessage);
}
- const search::engine::SearchRequest * GetQueryArgs() { return _queryArgs; }
- search::docsummary::GetDocsumArgs * GetGetDocsumArgs() { return _docsumArgs; }
-
void SetError(search::engine::ErrorCode errorCode, const char *errorMessage)
{
_errorCode = errorCode;
@@ -276,84 +260,47 @@ public:
}
- virtual uint32_t GetDataSetID() override
- {
- return _dataSetID;
- }
-
- virtual FastS_SearchInfo *GetSearchInfo() override
- {
- return &_searchInfo;
- }
+ uint32_t GetDataSetID() override { return _dataSetID; }
+ FastS_SearchInfo *GetSearchInfo() override { return &_searchInfo; }
- virtual RetCode setSearchRequest(const search::engine::SearchRequest * request) override
- {
+ RetCode setSearchRequest(const search::engine::SearchRequest * request) override {
_queryArgs = request;
return RET_OK;
}
- virtual RetCode SetGetDocsumArgs(search::docsummary::GetDocsumArgs *docsumArgs) override
- {
+ RetCode SetGetDocsumArgs(search::docsummary::GetDocsumArgs *docsumArgs) override {
_docsumArgs = docsumArgs;
return RET_OK;
}
- virtual RetCode Search(uint32_t searchOffset,
- uint32_t maxhits, uint32_t minhits = 0) override
- {
+ RetCode Search(uint32_t searchOffset, uint32_t maxhits, uint32_t minhits = 0) override {
(void) minhits;
_searchInfo._searchOffset = searchOffset;
_searchInfo._maxHits = maxhits;
return RET_OK;
}
- virtual RetCode ProcessQueryDone() override
- {
- return RET_OK;
- }
+ RetCode ProcessQueryDone() override { return RET_OK; }
+ FastS_QueryResult *GetQueryResult() override { return &_queryResult; }
- virtual FastS_QueryResult *GetQueryResult() override
- {
- return &_queryResult;
- }
-
- virtual RetCode GetDocsums(const FastS_hitresult *hits, uint32_t hitcnt) override
- {
+ RetCode GetDocsums(const FastS_hitresult *hits, uint32_t hitcnt) override {
(void) hits;
(void) hitcnt;
return RET_OK;
}
- virtual RetCode ProcessDocsumsDone() override
- {
- return RET_OK;
- }
+ RetCode ProcessDocsumsDone() override { return RET_OK; }
+ FastS_DocsumsResult *GetDocsumsResult() override { return &_docsumsResult; }
+ search::engine::ErrorCode GetErrorCode() override { return _errorCode; }
- virtual FastS_DocsumsResult *GetDocsumsResult() override
- {
- return &_docsumsResult;
- }
-
- virtual search::engine::ErrorCode GetErrorCode() override
- {
- return _errorCode;
- }
-
- virtual const char *GetErrorMessage() override
- {
+ const char *GetErrorMessage() override {
if (_errorMessage != NULL)
return _errorMessage;
return search::engine::getStringFromErrorCode(_errorCode);
}
- virtual void Interrupt() override
- {
- }
-
- virtual void Free() override
- {
- delete this;
- }
+ void Interrupt() override {}
+ void Free() override { delete this; }
};
//----------------------------------------------------------------
@@ -364,22 +311,16 @@ private:
bool _async;
public:
- FastS_FailedSearch(uint32_t dataSetID,
- bool async,
- search::engine::ErrorCode errorCode,
- const char *errorMessage)
+ FastS_FailedSearch(uint32_t dataSetID, bool async, search::engine::ErrorCode errorCode, const char *errorMessage)
: FastS_SearchBase(dataSetID),
_async(async)
{
SetError(errorCode, errorMessage);
}
- virtual ~FastS_FailedSearch() {}
- virtual bool IsAsync() override { return _async; }
+ bool IsAsync() override { return _async; }
- virtual RetCode SetAsyncArgs(FastS_ISearchOwner *owner,
- FastS_SearchContext context) override
- {
+ RetCode SetAsyncArgs(FastS_ISearchOwner *owner, FastS_SearchContext context) override {
(void) owner;
(void) context;
return (_async) ? RET_OK : RET_ERROR;
@@ -388,34 +329,15 @@ public:
//----------------------------------------------------------------
-class FastS_SyncSearch : public FastS_SearchBase
-{
-public:
- FastS_SyncSearch(uint32_t dataSetID)
- : FastS_SearchBase(dataSetID) {}
-
- bool IsAsync() override { return false; }
-
- virtual RetCode SetAsyncArgs(FastS_ISearchOwner *,
- FastS_SearchContext) override
- {
- return RET_ERROR;
- }
-};
-
-//----------------------------------------------------------------
-
class FastS_AsyncSearch : public FastS_SearchBase
{
-private:
- FastS_AsyncSearch(const FastS_AsyncSearch &);
- FastS_AsyncSearch& operator=(const FastS_AsyncSearch &);
-
protected:
FastS_ISearchOwner *_searchOwner;
FastS_SearchContext _searchContext;
public:
+ FastS_AsyncSearch(const FastS_AsyncSearch &) = delete;
+ FastS_AsyncSearch& operator=(const FastS_AsyncSearch &) = delete;
FastS_AsyncSearch(uint32_t dataSetID)
: FastS_SearchBase(dataSetID),
_searchOwner(NULL),
@@ -423,9 +345,7 @@ public:
bool IsAsync() override { return true; }
- virtual RetCode SetAsyncArgs(FastS_ISearchOwner *owner,
- FastS_SearchContext context) override
- {
+ RetCode SetAsyncArgs(FastS_ISearchOwner *owner, FastS_SearchContext context) override {
_searchOwner = owner;
_searchContext = context;
return RET_OK;
@@ -436,35 +356,31 @@ public:
class FastS_SearchAdapter : public FastS_ISearch
{
-private:
- FastS_SearchAdapter(const FastS_SearchAdapter &);
- FastS_SearchAdapter& operator=(const FastS_SearchAdapter &);
-
protected:
FastS_ISearch *_search;
public:
explicit FastS_SearchAdapter(FastS_ISearch *search);
- virtual ~FastS_SearchAdapter();
-
- virtual bool IsAsync() override;
- virtual uint32_t GetDataSetID() override;
- virtual FastS_SearchInfo *GetSearchInfo() override;
- virtual RetCode SetAsyncArgs(FastS_ISearchOwner *owner,
- FastS_SearchContext context) override;
- virtual RetCode setSearchRequest(const search::engine::SearchRequest * request) override;
- virtual RetCode SetGetDocsumArgs(search::docsummary::GetDocsumArgs *docsumArgs) override;
- virtual RetCode Search(uint32_t searchOffset,
- uint32_t maxhits, uint32_t minhits = 0) override;
- virtual RetCode ProcessQueryDone() override;
- virtual FastS_QueryResult *GetQueryResult() override;
- virtual RetCode GetDocsums(const FastS_hitresult *hits, uint32_t hitcnt) override;
- virtual RetCode ProcessDocsumsDone() override;
- virtual FastS_DocsumsResult *GetDocsumsResult() override;
- virtual search::engine::ErrorCode GetErrorCode() override;
- virtual const char *GetErrorMessage() override;
- virtual void Interrupt() override;
- virtual void Free() override;
+ FastS_SearchAdapter(const FastS_SearchAdapter &) = delete;
+ FastS_SearchAdapter& operator=(const FastS_SearchAdapter &) = delete;
+ ~FastS_SearchAdapter() override;
+
+ bool IsAsync() override;
+ uint32_t GetDataSetID() override;
+ FastS_SearchInfo *GetSearchInfo() override;
+ RetCode SetAsyncArgs(FastS_ISearchOwner *owner, FastS_SearchContext context) override;
+ RetCode setSearchRequest(const search::engine::SearchRequest * request) override;
+ RetCode SetGetDocsumArgs(search::docsummary::GetDocsumArgs *docsumArgs) override;
+ RetCode Search(uint32_t searchOffset, uint32_t maxhits, uint32_t minhits = 0) override;
+ RetCode ProcessQueryDone() override;
+ FastS_QueryResult *GetQueryResult() override;
+ RetCode GetDocsums(const FastS_hitresult *hits, uint32_t hitcnt) override;
+ RetCode ProcessDocsumsDone() override;
+ FastS_DocsumsResult *GetDocsumsResult() override;
+ search::engine::ErrorCode GetErrorCode() override;
+ const char *GetErrorMessage() override;
+ void Interrupt() override;
+ void Free() override;
};
//----------------------------------------------------------------
@@ -484,22 +400,20 @@ protected:
explicit FastS_SyncSearchAdapter(FastS_ISearch *search);
public:
- virtual ~FastS_SyncSearchAdapter();
+ ~FastS_SyncSearchAdapter() override;
static FastS_ISearch *Adapt(FastS_ISearch *search);
- virtual void DoneQuery(FastS_ISearch *, FastS_SearchContext) override;
- virtual void DoneDocsums(FastS_ISearch *, FastS_SearchContext) override;
+ void DoneQuery(FastS_ISearch *, FastS_SearchContext) override;
+ void DoneDocsums(FastS_ISearch *, FastS_SearchContext) override;
void WaitQueryDone();
void WaitDocsumsDone();
- virtual bool IsAsync() override;
- virtual RetCode SetAsyncArgs(FastS_ISearchOwner *owner,
- FastS_SearchContext context) override;
- virtual RetCode Search(uint32_t searchOffset,
- uint32_t maxhits, uint32_t minhits = 0) override;
- virtual RetCode GetDocsums(const FastS_hitresult *hits, uint32_t hitcnt) override;
+ bool IsAsync() override;
+ RetCode SetAsyncArgs(FastS_ISearchOwner *owner, FastS_SearchContext context) override;
+ RetCode Search(uint32_t searchOffset, uint32_t maxhits, uint32_t minhits = 0) override;
+ RetCode GetDocsums(const FastS_hitresult *hits, uint32_t hitcnt) override;
};
//----------------------------------------------------------------
diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/fnet_search.h b/searchcore/src/vespa/searchcore/fdispatch/search/fnet_search.h
index 2208af7058e..f653d76a691 100644
--- a/searchcore/src/vespa/searchcore/fdispatch/search/fnet_search.h
+++ b/searchcore/src/vespa/searchcore/fdispatch/search/fnet_search.h
@@ -256,8 +256,7 @@ private:
void ConnectEstimateNodes();
void connectSearchPath(const vespalib::string &spec);
void connectSearchPath(const fdispatch::SearchPath::Element &elem,
- const vespalib::string &spec,
- uint32_t dispatchLevel);
+ const vespalib::string &spec, uint32_t dispatchLevel);
void ConnectDocsumNodes(bool ignoreRow);
uint32_t getNextFixedRow();
uint32_t getFixedRowCandidate();
@@ -274,9 +273,7 @@ private:
FastS_FNET_SearchNode * getNode(size_t i) { return &_nodes[i]; }
public:
- FastS_FNET_Search(FastS_DataSetCollection *dsc,
- FastS_FNET_DataSet *dataset,
- FastS_TimeKeeper *timeKeeper);
+ FastS_FNET_Search(FastS_DataSetCollection *dsc, FastS_FNET_DataSet *dataset, FastS_TimeKeeper *timeKeeper);
virtual ~FastS_FNET_Search();
void GotQueryResult(FastS_FNET_SearchNode *node, FS4Packet_QUERYRESULTX *qrx);
@@ -336,13 +333,11 @@ public:
void adjustQueryTimeout();
void adjustDocsumTimeout();
- uint32_t getGoodQueries() const { return _goodQueries; }
uint32_t getRequestedQueries() const { return _queryNodes; }
uint32_t getPendingQueries() const { return _pendingQueries; }
uint32_t getDoneQueries() const {
return getRequestedQueries() - getPendingQueries();
}
- uint32_t getGoodDocsums() const { return _goodDocsums; }
uint32_t getRequestedDocsums() const { return _requestedDocsums; }
uint32_t getPendingDocsums() const { return _pendingDocsums; }
uint32_t getDoneDocsums() const {
@@ -362,9 +357,7 @@ private:
FastS_FNET_Search _search;
public:
- FastS_Sync_FNET_Search(FastS_DataSetCollection *dsc,
- FastS_FNET_DataSet *dataset,
- FastS_TimeKeeper *timeKeeper) :
+ FastS_Sync_FNET_Search(FastS_DataSetCollection *dsc, FastS_FNET_DataSet *dataset, FastS_TimeKeeper *timeKeeper) :
FastS_SyncSearchAdapter(&_search),
_search(dsc, dataset, timeKeeper)
{