aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2018-12-17 00:24:42 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2018-12-17 00:24:42 +0000
commit6e0075742c6a354529be0c0eee92384b01bbd6fa (patch)
tree1bd2222a68c18a935afbcc9d696610a699f419ea /searchcore
parent2bb53166a7e3e221b6a475fa553360e5c902b922 (diff)
No explicit inline in header file.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/documentmetastore/CMakeLists.txt1
-rw-r--r--searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h1
-rw-r--r--searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.cpp34
-rw-r--r--searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.h27
-rw-r--r--searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.cpp12
-rw-r--r--searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.h78
6 files changed, 64 insertions, 89 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/CMakeLists.txt b/searchcore/src/vespa/searchcore/proton/documentmetastore/CMakeLists.txt
index 9507829bbf9..d257f29c9df 100644
--- a/searchcore/src/vespa/searchcore/proton/documentmetastore/CMakeLists.txt
+++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/CMakeLists.txt
@@ -15,6 +15,7 @@ vespa_add_library(searchcore_documentmetastore STATIC
lid_reuse_delayer_config.cpp
lidreusedelayer.cpp
lidstatevector.cpp
+ lid_hold_list.cpp
DEPENDS
searchcore_attribute
searchcore_bucketdb
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h
index 2fd3bcdae64..a3c470575a4 100644
--- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h
+++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h
@@ -8,7 +8,6 @@
#include "lid_allocator.h"
#include "lid_gid_key_comparator.h"
#include "lid_hold_list.h"
-#include "lidstatevector.h"
#include "raw_document_meta_data.h"
#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h>
#include <vespa/searchcore/proton/common/subdbtype.h>
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.cpp
new file mode 100644
index 00000000000..f5f9711f9a3
--- /dev/null
+++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.cpp
@@ -0,0 +1,34 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include "lid_hold_list.h"
+#include "lidstatevector.h"
+
+namespace proton {
+
+LidHoldList::LidHoldList() = default;
+LidHoldList::~LidHoldList() = default;
+
+void
+LidHoldList::add(const uint32_t data, generation_t generation) {
+ if (!_holdList.empty()) {
+ assert(generation >= _holdList.back().second);
+ }
+ _holdList.push_back(std::make_pair(data, generation));
+}
+
+void
+LidHoldList::clear() {
+ _holdList.clear();
+}
+
+void
+LidHoldList::trimHoldLists(generation_t firstUsed, LidStateVector &freeLids)
+{
+ while (!_holdList.empty() && _holdList.front().second < firstUsed) {
+ uint32_t lid = _holdList.front().first;
+ freeLids.setBit(lid);
+ _holdList.pop_front();
+ }
+}
+
+}
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.h
index 01a3c645f45..ff14f3af3b6 100644
--- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.h
+++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.h
@@ -1,12 +1,13 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include "lidstatevector.h"
#include <vespa/vespalib/util/generationhandler.h>
#include <deque>
namespace proton {
+class LidStateVector;
+
/**
* Class used to hold <lid, generation> pairs before reuse.
* A lid is free for reuse if the associated generation < first used
@@ -22,21 +23,14 @@ private:
ElementDeque _holdList;
public:
- LidHoldList()
- : _holdList()
- {
- }
+ LidHoldList();
+ ~LidHoldList();
/**
* Adds a new element with the given generation.
* Elements must be added with ascending generations.
**/
- void add(const uint32_t data, generation_t generation) {
- if (!_holdList.empty()) {
- assert(generation >= _holdList.back().second);
- }
- _holdList.push_back(std::make_pair(data, generation));
- }
+ void add(const uint32_t data, generation_t generation);
/**
* Returns the total number of elements.
@@ -46,19 +40,12 @@ public:
/**
* Clears the free list.
**/
- void clear() { _holdList.clear(); }
+ void clear();
/**
* Frees up elements with generation < first used generation for reuse.
**/
- void trimHoldLists(generation_t firstUsed, LidStateVector &freeLids)
- {
- while (!_holdList.empty() && _holdList.front().second < firstUsed) {
- uint32_t lid = _holdList.front().first;
- freeLids.setBit(lid);
- _holdList.pop_front();
- }
- }
+ void trimHoldLists(generation_t firstUsed, LidStateVector &freeLids);
};
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.cpp
index 5208c1165da..24ae86760c9 100644
--- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.cpp
+++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.cpp
@@ -6,11 +6,9 @@ namespace proton {
using vespalib::GenerationHolder;
-LidStateVector::LidStateVector(unsigned int newSize,
- unsigned int newCapacity,
+LidStateVector::LidStateVector(unsigned int newSize, unsigned int newCapacity,
GenerationHolder &generationHolder,
- bool trackLowest,
- bool trackHighest)
+ bool trackLowest, bool trackHighest)
: _bv(newSize, newCapacity, generationHolder),
_lowest(trackLowest ? newSize : 0u),
_highest(0),
@@ -20,11 +18,7 @@ LidStateVector::LidStateVector(unsigned int newSize,
{
}
-
-LidStateVector::~LidStateVector()
-{
-}
-
+LidStateVector::~LidStateVector() = default;
void
LidStateVector::resizeVector(uint32_t newSize, uint32_t newCapacity)
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.h
index 0a5242323e6..53f94896131 100644
--- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.h
+++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.h
@@ -4,8 +4,7 @@
#include <vespa/searchlib/common/growablebitvector.h>
-namespace proton
-{
+namespace proton {
class LidStateVector
{
@@ -16,22 +15,14 @@ class LidStateVector
bool _trackLowest;
bool _trackHighest;
- void
- updateLowest();
-
- void
- updateHighest();
-
- inline void
- maybeUpdateLowest()
- {
+ void updateLowest();
+ void updateHighest();
+ void maybeUpdateLowest() {
if (_trackLowest && _lowest < _bv.size() && !_bv.testBit(_lowest))
updateLowest();
}
- inline void
- maybeUpdateHighest()
- {
+ void maybeUpdateHighest() {
if (_trackHighest && _highest != 0 && !_bv.testBit(_highest))
updateHighest();
}
@@ -40,64 +31,34 @@ class LidStateVector
* Get number of bits set in vector. Should only be called by
* write thread.
*/
- uint32_t
- internalCount();
+ uint32_t internalCount();
public:
- LidStateVector(unsigned int newSize,
- unsigned int newCapacity,
+ LidStateVector(unsigned int newSize, unsigned int newCapacity,
vespalib::GenerationHolder &generationHolder,
- bool trackLowest,
- bool trackHighest);
+ bool trackLowest, bool trackHighest);
~LidStateVector();
- void
- resizeVector(uint32_t newSize, uint32_t newCapacity);
-
- void
- setBit(unsigned int idx);
-
- void
- clearBit(unsigned int idx);
-
- inline bool
- testBit(unsigned int idx) const
- {
- return _bv.testBit(idx);
- }
-
- inline unsigned int
- size() const
- {
- return _bv.size();
- }
-
- inline unsigned int
- byteSize() const
- {
+ void resizeVector(uint32_t newSize, uint32_t newCapacity);
+ void setBit(unsigned int idx);
+ void clearBit(unsigned int idx);
+ bool testBit(unsigned int idx) const { return _bv.testBit(idx); }
+ unsigned int size() const { return _bv.size(); }
+ unsigned int byteSize() const {
return _bv.extraByteSize() + sizeof(LidStateVector);
}
-
- bool
- empty() const;
-
- unsigned int
- getLowest() const;
-
- unsigned int
- getHighest() const;
+ bool empty() const;
+ unsigned int getLowest() const;
+ unsigned int getHighest() const;
/**
* Get cached number of bits set in vector. Called by read or
* write thread. Write thread must updated cached number as needed.
*/
- uint32_t
- count() const;
+ uint32_t count() const;
- unsigned int
- getNextTrueBit(unsigned int idx) const
- {
+ unsigned int getNextTrueBit(unsigned int idx) const {
return _bv.getNextTrueBit(idx);
}
@@ -105,4 +66,3 @@ public:
};
}
-