diff options
10 files changed, 118 insertions, 144 deletions
diff --git a/memfilepersistence/src/vespa/memfilepersistence/common/filespecification.h b/memfilepersistence/src/vespa/memfilepersistence/common/filespecification.h index 4d9cda2c47c..63dd0d3172e 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/common/filespecification.h +++ b/memfilepersistence/src/vespa/memfilepersistence/common/filespecification.h @@ -20,8 +20,7 @@ namespace memfile { class MemFileEnvironment; class FileSpecification : private Types, - public vespalib::Printable, - public boost::operators<FileSpecification> + public vespalib::Printable { BucketId _bucketId; Directory* _dir; diff --git a/memfilepersistence/src/vespa/memfilepersistence/common/types.h b/memfilepersistence/src/vespa/memfilepersistence/common/types.h index bf4bdc98222..71a9b411e6c 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/common/types.h +++ b/memfilepersistence/src/vespa/memfilepersistence/common/types.h @@ -39,7 +39,7 @@ namespace memfile { * of zero with a non-zero position is invalid, and used to indicate that this * value is not set yet. (Typically when data isn't persisted to disk yet) */ -struct DataLocation : public boost::operators<DataLocation> { +struct DataLocation { uint32_t _pos; uint32_t _size; @@ -52,8 +52,12 @@ struct DataLocation : public boost::operators<DataLocation> { bool valid() const { return (_size > 0 || _pos == 0); } - bool operator==(const DataLocation& other) const - { return (_pos == other._pos && _size == other._size); } + bool operator==(const DataLocation& other) const { + return (_pos == other._pos && _size == other._size); + } + bool operator!=(const DataLocation& other) const { + return ! (*this == other); + } bool operator<(const DataLocation& other) const { if (_pos == other._pos) { diff --git a/memfilepersistence/src/vespa/memfilepersistence/memfile/memslot.h b/memfilepersistence/src/vespa/memfilepersistence/memfile/memslot.h index 53a20a86f8a..4ea44a45996 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/memfile/memslot.h +++ b/memfilepersistence/src/vespa/memfilepersistence/memfile/memslot.h @@ -28,8 +28,7 @@ namespace memfile { class MemFile; -class MemSlot : private Types, - private boost::operators<MemSlot> +class MemSlot : private Types { // Metadata for slot we need to keep. Timestamp _timestamp; // 64 bit - 8 bytes timestamp @@ -166,6 +165,9 @@ public: * Used in unit testing only. */ bool operator==(const MemSlot& other) const; + bool operator!=(const MemSlot& other) const { + return ! (*this == other); + } // Implement print functions so we can be used similar to as we were // a document::Printable (Don't want inheritance in this class) diff --git a/memfilepersistence/src/vespa/memfilepersistence/memfile/slotiterator.h b/memfilepersistence/src/vespa/memfilepersistence/memfile/slotiterator.h index c10075ef143..d62bdf10025 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/memfile/slotiterator.h +++ b/memfilepersistence/src/vespa/memfilepersistence/memfile/slotiterator.h @@ -20,7 +20,6 @@ #pragma once -#include <boost/operators.hpp> #include <vespa/memfilepersistence/common/types.h> #include <vespa/vespalib/stllike/hash_set.h> @@ -97,7 +96,7 @@ public: * implementation in order to be able to return iterators by value, as one is * acustomed to in the standard library. */ -class IteratorWrapper : public boost::operators<IteratorWrapper> { +class IteratorWrapper { SlotIterator::CUP _it; public: @@ -116,6 +115,9 @@ public: const MemSlot* slot2(o._it.get() == 0 ? 0 : o._it->getCurrent()); return (slot == slot2); } + bool operator!=(const IteratorWrapper& o) const { + return ! (*this == o); + } const MemSlot& operator*() const { return *_it->getCurrent(); } const MemSlot* operator->() const { return _it->getCurrent(); } diff --git a/storage/src/tests/bucketdb/judyarraytest.cpp b/storage/src/tests/bucketdb/judyarraytest.cpp index 235c0c9eb5c..4a6157fc93e 100644 --- a/storage/src/tests/bucketdb/judyarraytest.cpp +++ b/storage/src/tests/bucketdb/judyarraytest.cpp @@ -61,18 +61,6 @@ JudyArrayTest::testIterating() foundVals = getJudyArrayContents(array); CPPUNIT_ASSERT_EQUAL(values, foundVals); - { // Test that both postfix operator work - JudyArray::iterator it = array.begin(); - JudyArray::iterator it2 = it++; - CPPUNIT_ASSERT_EQUAL(JudyArray::value_type(values[0]), *it2); - CPPUNIT_ASSERT_EQUAL(JudyArray::value_type(values[1]), *it); - - // And that iterator comparisons work - CPPUNIT_ASSERT_EQUAL(it2, array.begin()); - CPPUNIT_ASSERT_EQUAL(it, ++array.begin()); - CPPUNIT_ASSERT(!(it == it2)); - CPPUNIT_ASSERT(it != it2); - } { // Test that we can alter through non-const iterator JudyArray::iterator it = array.begin(); ++it; @@ -127,7 +115,7 @@ JudyArrayTest::testDualArrayFunctions() CPPUNIT_ASSERT_EQUAL(values1, getJudyArrayContents(array1)); CPPUNIT_ASSERT_EQUAL(values2, getJudyArrayContents(array2)); - CPPUNIT_ASSERT(array1 > array2); + CPPUNIT_ASSERT(array2 < array1); CPPUNIT_ASSERT(array1 != array2); array1.swap(array2); CPPUNIT_ASSERT_EQUAL(values1, getJudyArrayContents(array2)); @@ -142,10 +130,7 @@ JudyArrayTest::testDualArrayFunctions() } CPPUNIT_ASSERT(array1 != array3); CPPUNIT_ASSERT_EQUAL(array2, array3); - CPPUNIT_ASSERT(array2 >= array3); - CPPUNIT_ASSERT(array2 <= array3); CPPUNIT_ASSERT(!(array2 < array3)); - CPPUNIT_ASSERT(!(array2 > array3)); } void diff --git a/storage/src/tests/bucketdb/judymultimaptest.cpp b/storage/src/tests/bucketdb/judymultimaptest.cpp index f63fad9aa06..b737155d6a9 100644 --- a/storage/src/tests/bucketdb/judymultimaptest.cpp +++ b/storage/src/tests/bucketdb/judymultimaptest.cpp @@ -135,37 +135,35 @@ JudyMultiMapTest::testIterator() MultiMap::Iterator iter = multiMap.begin(); CPPUNIT_ASSERT_EQUAL((uint64_t)11, (uint64_t)iter.key()); CPPUNIT_ASSERT_EQUAL(A(4, 6, 0), iter.value()); - iter++; + ++iter; CPPUNIT_ASSERT_EQUAL((uint64_t)14, (uint64_t)iter.key()); CPPUNIT_ASSERT_EQUAL(A(42, 0, 0), iter.value()); - iter++; + ++iter; CPPUNIT_ASSERT_EQUAL((uint64_t)16, (uint64_t)iter.key()); CPPUNIT_ASSERT_EQUAL(A(1, 2, 3), iter.value()); - iter--; + --iter; CPPUNIT_ASSERT_EQUAL((uint64_t)14, (uint64_t)iter.key()); CPPUNIT_ASSERT_EQUAL(A(42, 0, 0), iter.value()); - iter++; + ++iter; CPPUNIT_ASSERT_EQUAL((uint64_t)16, (uint64_t)iter.key()); CPPUNIT_ASSERT_EQUAL(A(1, 2, 3), iter.value()); - iter--; - iter--; + --iter; + --iter; CPPUNIT_ASSERT_EQUAL((uint64_t)11,(uint64_t) iter.key()); CPPUNIT_ASSERT_EQUAL(A(4, 6, 0), iter.value()); - iter++; - iter++; - iter++; + ++iter; + ++iter; + ++iter; CPPUNIT_ASSERT_EQUAL(multiMap.end(), iter); - iter--; + --iter; CPPUNIT_ASSERT_EQUAL((uint64_t)16, (uint64_t)iter.key()); CPPUNIT_ASSERT_EQUAL(A(1, 2, 3), iter.value()); - iter--; + --iter; CPPUNIT_ASSERT_EQUAL((uint64_t)14, (uint64_t)iter.key()); CPPUNIT_ASSERT_EQUAL(A(42, 0, 0), iter.value()); - iter--; + --iter; CPPUNIT_ASSERT_EQUAL((uint64_t)11,(uint64_t) iter.key()); CPPUNIT_ASSERT_EQUAL(A(4, 6, 0), iter.value()); - - } } // storage diff --git a/storage/src/tests/bucketdb/lockablemaptest.cpp b/storage/src/tests/bucketdb/lockablemaptest.cpp index 0f35f51afbd..ad1cc1dcef4 100644 --- a/storage/src/tests/bucketdb/lockablemaptest.cpp +++ b/storage/src/tests/bucketdb/lockablemaptest.cpp @@ -158,48 +158,36 @@ LockableMapTest::testComparison() { // Check empty state is correct CPPUNIT_ASSERT_EQUAL(map1, map2); - CPPUNIT_ASSERT(map1 <= map2); - CPPUNIT_ASSERT(map1 >= map2); CPPUNIT_ASSERT(!(map1 < map2)); - CPPUNIT_ASSERT(!(map1 > map2)); CPPUNIT_ASSERT(!(map1 != map2)); // Check that different lengths are oki map1.insert(4, A(1, 2, 3), "foo", preExisted); CPPUNIT_ASSERT(!(map1 == map2)); - CPPUNIT_ASSERT(!(map1 <= map2)); CPPUNIT_ASSERT(!(map1 < map2)); - CPPUNIT_ASSERT(map1 >= map2); - CPPUNIT_ASSERT(map1 > map2); + CPPUNIT_ASSERT(map2 < map1); CPPUNIT_ASSERT(map1 != map2); // Check that equal elements are oki map2.insert(4, A(1, 2, 3), "foo", preExisted); CPPUNIT_ASSERT_EQUAL(map1, map2); - CPPUNIT_ASSERT(map1 <= map2); - CPPUNIT_ASSERT(map1 >= map2); CPPUNIT_ASSERT(!(map1 < map2)); - CPPUNIT_ASSERT(!(map1 > map2)); CPPUNIT_ASSERT(!(map1 != map2)); // Check that non-equal values are oki map1.insert(6, A(1, 2, 6), "foo", preExisted); map2.insert(6, A(1, 2, 3), "foo", preExisted); CPPUNIT_ASSERT(!(map1 == map2)); - CPPUNIT_ASSERT(!(map1 <= map2)); CPPUNIT_ASSERT(!(map1 < map2)); - CPPUNIT_ASSERT(map1 >= map2); - CPPUNIT_ASSERT(map1 > map2); + CPPUNIT_ASSERT(map2 < map1); CPPUNIT_ASSERT(map1 != map2); // Check that non-equal keys are oki map1.erase(6, "foo"); map1.insert(7, A(1, 2, 3), "foo", preExisted); CPPUNIT_ASSERT(!(map1 == map2)); - CPPUNIT_ASSERT(!(map1 <= map2)); CPPUNIT_ASSERT(!(map1 < map2)); - CPPUNIT_ASSERT(map1 >= map2); - CPPUNIT_ASSERT(map1 > map2); + CPPUNIT_ASSERT(map2 < map1); CPPUNIT_ASSERT(map1 != map2); } diff --git a/storage/src/vespa/storage/bucketdb/judyarray.h b/storage/src/vespa/storage/bucketdb/judyarray.h index 963fdb86f98..c539e1e8469 100644 --- a/storage/src/vespa/storage/bucketdb/judyarray.h +++ b/storage/src/vespa/storage/bucketdb/judyarray.h @@ -16,7 +16,6 @@ #pragma once -#include <boost/operators.hpp> #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/util/printable.h> #include <vespa/fastos/fastos.h> @@ -25,7 +24,7 @@ namespace storage { -class JudyArray : public vespalib::Printable, public boost::operators<JudyArray> +class JudyArray : public vespalib::Printable { JudyArray(const JudyArray&); // Deny copying JudyArray& operator=(const JudyArray&); @@ -49,6 +48,9 @@ public: virtual ~JudyArray(); bool operator==(const JudyArray& array) const; + bool operator!=(const JudyArray& array) const { + return ! (*this == array); + } bool operator<(const JudyArray& array) const; /** Warning: Size may be a O(n) function (Unknown implementation in judy) */ @@ -86,14 +88,16 @@ public: virtual void print(std::ostream& out, bool verbose, const std::string& indent) const; - class ConstIterator : public vespalib::Printable, - public boost::operators<ConstIterator> + class ConstIterator : public vespalib::Printable { public: ConstIterator& operator--(); - ConstIterator& operator++(); // Prefix, postfix provided by boost + ConstIterator& operator++(); - bool operator==(const ConstIterator &cp) const; // != provided by boost + bool operator==(const ConstIterator &cp) const; + bool operator!=(const ConstIterator &cp) const { + return ! (*this == cp); + } value_type operator*() const { return value_type(_key, *_data); } bool end() const { return (_data == 0); } @@ -115,8 +119,7 @@ public: friend class JudyArray; }; - class Iterator : public ConstIterator, - public boost::operators<Iterator> + class Iterator : public ConstIterator { public: Iterator& operator--() diff --git a/storage/src/vespa/storage/bucketdb/judymultimap.h b/storage/src/vespa/storage/bucketdb/judymultimap.h index ea7c005dc24..52f4793aa7c 100644 --- a/storage/src/vespa/storage/bucketdb/judymultimap.h +++ b/storage/src/vespa/storage/bucketdb/judymultimap.h @@ -95,14 +95,16 @@ public: virtual void print(std::ostream& out, bool verbose, const std::string& indent) const; - class ConstIterator : public vespalib::Printable, - public boost::operators<ConstIterator> + class ConstIterator : public vespalib::Printable { public: ConstIterator& operator--() { --_iterator; return *this; } ConstIterator& operator++() { ++_iterator; return *this; } - bool operator==(const ConstIterator &cp) const; // != provided by boost + bool operator==(const ConstIterator &cp) const; + bool operator!=(const ConstIterator &cp) const { + return ! (*this == cp); + } value_type operator*() const; inline bool end() const { return _iterator.end(); } @@ -129,8 +131,7 @@ public: mutable std::pair<key_type, mapped_type> _pair; }; - class Iterator : public ConstIterator, - public boost::operators<Iterator> + class Iterator : public ConstIterator { public: Iterator& operator--() diff --git a/storage/src/vespa/storage/bucketdb/lockablemap.h b/storage/src/vespa/storage/bucketdb/lockablemap.h index 95d9326eff0..1b4807fa745 100644 --- a/storage/src/vespa/storage/bucketdb/lockablemap.h +++ b/storage/src/vespa/storage/bucketdb/lockablemap.h @@ -28,14 +28,14 @@ namespace storage { template<typename Map> -class LockableMap : public vespalib::Printable, - public boost::operators<LockableMap<Map> > +class LockableMap : public vespalib::Printable { public: typedef typename Map::key_type key_type; typedef typename Map::mapped_type mapped_type; typedef typename Map::value_type value_type; typedef typename Map::size_type size_type; + using BucketId = document::BucketId; /** Responsible for releasing lock in map when out of scope. */ class LockKeeper { @@ -66,8 +66,8 @@ public: bool locked() const { return _lockKeeper.get(); } const key_type& getKey() const { return _lockKeeper->_key; }; - document::BucketId getBucketId() const { - return document::BucketId(document::BucketId::keyToBucketId(getKey())); + BucketId getBucketId() const { + return BucketId(BucketId::keyToBucketId(getKey())); } protected: @@ -114,6 +114,9 @@ public: LockableMap(); bool operator==(const LockableMap& other) const; + bool operator!=(const LockableMap& other) const { + return ! (*this == other); + } bool operator<(const LockableMap& other) const; typename Map::size_type size() const; size_type getMemoryUsage() const; @@ -173,15 +176,15 @@ public: * bucket. Usually, there should be only one such bucket, but in the case * of inconsistent splitting, there may be more than one. */ - std::map<document::BucketId, WrappedEntry> - getContained(const document::BucketId& bucketId, const char* clientId); + std::map<BucketId, WrappedEntry> + getContained(const BucketId& bucketId, const char* clientId); WrappedEntry createAppropriateBucket(uint16_t newBucketBits, const char* clientId, - const document::BucketId& bucket); + const BucketId& bucket); - typedef std::map<document::BucketId, WrappedEntry> EntryMap; + typedef std::map<BucketId, WrappedEntry> EntryMap; /** * Returns all buckets in the bucket database that can contain the given @@ -189,10 +192,7 @@ public: * * If sibling is != 0, also fetch that bucket if possible. */ - EntryMap getAll( - const document::BucketId& bucketId, - const char* clientId, - const document::BucketId& sibling = document::BucketId(0)); + EntryMap getAll(const BucketId& bucketId, const char* clientId, const BucketId& sibling = BucketId(0)); /** * Returns true iff bucket has no superbuckets or sub-buckets in the @@ -270,9 +270,9 @@ private: /** * Returns the given bucket, its super buckets and its sub buckets. */ - void getAllWithoutLocking(const document::BucketId& bucket, - const document::BucketId& sibling, - std::vector<document::BucketId::Type>& keys); + void getAllWithoutLocking(const BucketId& bucket, + const BucketId& sibling, + std::vector<BucketId::Type>& keys); /** * Retrieves the most specific bucket id (highest used bits) that matches @@ -284,25 +284,25 @@ private: * If not found, nextKey is set to the key after one that could have * matched and we return false. */ - bool getMostSpecificMatch(const document::BucketId& bucket, - document::BucketId& result, - document::BucketId::Type& keyResult, - document::BucketId::Type& nextKey); + bool getMostSpecificMatch(const BucketId& bucket, + BucketId& result, + BucketId::Type& keyResult, + BucketId::Type& nextKey); /** * Finds all buckets that can contain the given bucket, except for the * bucket itself (that is, its super buckets) */ - void getAllContaining(const document::BucketId& bucket, - std::vector<document::BucketId::Type>& keys); + void getAllContaining(const BucketId& bucket, + std::vector<BucketId::Type>& keys); /** * Find the given list of keys in the map and add them to the map of * results, locking them in the process. */ - void addAndLockResults(const std::vector<document::BucketId::Type> keys, + void addAndLockResults(const std::vector<BucketId::Type> keys, const char* clientId, - std::map<document::BucketId, WrappedEntry>& results, + std::map<BucketId, WrappedEntry>& results, vespalib::MonitorGuard& guard); }; @@ -692,11 +692,9 @@ LockableMap<Map>::print(std::ostream& out, bool verbose, out << "LockableMap {\n" << indent << " "; if (verbose) { - for (typename Map::const_iterator iter = _map.begin(); - iter != _map.end(); - iter++) { + for (typename Map::const_iterator iter = _map.begin(); iter != _map.end(); ++iter) { out << "Key: " << - document::BucketId(document::BucketId::keyToBucketId(iter->first)) + BucketId(BucketId::keyToBucketId(iter->first)) << " Value: " << iter->second << "\n" << indent << " "; } @@ -747,8 +745,7 @@ bool checkContains(document::BucketId::Type key, const document::BucketId& bucket, document::BucketId& result, document::BucketId::Type& keyResult) { - document::BucketId id = document::BucketId( - document::BucketId::keyToBucketId(key)); + document::BucketId id = document::BucketId(document::BucketId::keyToBucketId(key)); if (id.contains(bucket)) { result = id; keyResult = key; @@ -772,10 +769,10 @@ checkContains(document::BucketId::Type key, const document::BucketId& bucket, */ template<typename Map> bool -LockableMap<Map>::getMostSpecificMatch(const document::BucketId& bucket, - document::BucketId& result, - document::BucketId::Type& keyResult, - document::BucketId::Type& nextKey) +LockableMap<Map>::getMostSpecificMatch(const BucketId& bucket, + BucketId& result, + BucketId::Type& keyResult, + BucketId::Type& nextKey) { typename Map::const_iterator iter = _map.lower_bound(bucket.toKey()); @@ -809,17 +806,17 @@ LockableMap<Map>::getMostSpecificMatch(const document::BucketId& bucket, */ template<typename Map> void -LockableMap<Map>::getAllContaining(const document::BucketId& bucket, - std::vector<document::BucketId::Type>& keys) +LockableMap<Map>::getAllContaining(const BucketId& bucket, + std::vector<BucketId::Type>& keys) { - document::BucketId id = bucket; + BucketId id = bucket; // Find other buckets that contain this bucket. // TODO: Optimize? while (id.getUsedBits() > 1) { id.setUsedBits(id.getUsedBits() - 1); id = id.stripUnused(); - document::BucketId::Type key = id.toKey(); + BucketId::Type key = id.toKey(); typename Map::const_iterator iter = _map.find(key); if (iter != _map.end()) { @@ -831,9 +828,9 @@ LockableMap<Map>::getAllContaining(const document::BucketId& bucket, template<typename Map> void LockableMap<Map>::addAndLockResults( - const std::vector<document::BucketId::Type> keys, + const std::vector<BucketId::Type> keys, const char* clientId, - std::map<document::BucketId, WrappedEntry>& results, + std::map<BucketId, WrappedEntry>& results, vespalib::MonitorGuard& guard) { // Wait until all buckets are free to be added, then add them all. @@ -858,8 +855,7 @@ LockableMap<Map>::addAndLockResults( typename Map::iterator it = _map.find(keys[i]); if (it != _map.end()) { _lockedKeys.insert(LockId(keys[i], clientId)); - results[document::BucketId( - document::BucketId::keyToBucketId(keys[i]))] + results[BucketId(BucketId::keyToBucketId(keys[i]))] = WrappedEntry(*this, keys[i], it->second, clientId, true); } @@ -873,8 +869,8 @@ namespace { uint8_t getMinDiffBits(uint16_t minBits, const document::BucketId& a, const document::BucketId& b) { for (uint32_t i = minBits; i <= std::min(a.getUsedBits(), b.getUsedBits()); i++) { - document::BucketId a1 = document::BucketId(i, a.getRawId()); - document::BucketId b1 = document::BucketId(i, b.getRawId()); + document::BucketId a1(i, a.getRawId()); + document::BucketId b1(i, b.getRawId()); if (b1.getId() != a1.getId()) { return i; } @@ -889,7 +885,7 @@ typename LockableMap<Map>::WrappedEntry LockableMap<Map>::createAppropriateBucket( uint16_t newBucketBits, const char* clientId, - const document::BucketId& bucket) + const BucketId& bucket) { vespalib::MonitorGuard guard(_lock); typename Map::const_iterator iter = _map.lower_bound(bucket.toKey()); @@ -898,19 +894,17 @@ LockableMap<Map>::createAppropriateBucket( // bucket's used bits should be the highest used bits it can be while // still being different from both of these. if (iter != _map.end()) { - newBucketBits = getMinDiffBits(newBucketBits, - document::BucketId(document::BucketId::keyToBucketId(iter->first)), bucket); + newBucketBits = getMinDiffBits(newBucketBits, BucketId(BucketId::keyToBucketId(iter->first)), bucket); } if (iter != _map.begin()) { --iter; - newBucketBits = getMinDiffBits(newBucketBits, - document::BucketId(document::BucketId::keyToBucketId(iter->first)), bucket); + newBucketBits = getMinDiffBits(newBucketBits, BucketId(BucketId::keyToBucketId(iter->first)), bucket); } - document::BucketId newBucket(newBucketBits, bucket.getRawId()); + BucketId newBucket(newBucketBits, bucket.getRawId()); newBucket.setUsedBits(newBucketBits); - document::BucketId::Type key = newBucket.stripUnused().toKey(); + BucketId::Type key = newBucket.stripUnused().toKey(); LockId lid(key, clientId); ackquireKey(lid, guard); @@ -922,17 +916,17 @@ LockableMap<Map>::createAppropriateBucket( template<typename Map> std::map<document::BucketId, typename LockableMap<Map>::WrappedEntry> -LockableMap<Map>::getContained(const document::BucketId& bucket, +LockableMap<Map>::getContained(const BucketId& bucket, const char* clientId) { vespalib::MonitorGuard guard(_lock); - std::map<document::BucketId, WrappedEntry> results; + std::map<BucketId, WrappedEntry> results; - document::BucketId result; - document::BucketId::Type keyResult; - document::BucketId::Type nextKey; + BucketId result; + BucketId::Type keyResult; + BucketId::Type nextKey; - std::vector<document::BucketId::Type> keys; + std::vector<BucketId::Type> keys; if (getMostSpecificMatch(bucket, result, keyResult, nextKey)) { keys.push_back(keyResult); @@ -955,13 +949,13 @@ LockableMap<Map>::getContained(const document::BucketId& bucket, template<typename Map> void -LockableMap<Map>::getAllWithoutLocking(const document::BucketId& bucket, - const document::BucketId& sibling, - std::vector<document::BucketId::Type>& keys) +LockableMap<Map>::getAllWithoutLocking(const BucketId& bucket, + const BucketId& sibling, + std::vector<BucketId::Type>& keys) { - document::BucketId result; - document::BucketId::Type keyResult; - document::BucketId::Type nextKey; + BucketId result; + BucketId::Type keyResult; + BucketId::Type nextKey; typename Map::iterator it = _map.end(); @@ -974,7 +968,7 @@ LockableMap<Map>::getAllWithoutLocking(const document::BucketId& bucket, it = _map.find(keyResult); if (it != _map.end()) { // Skipping nextKey, since it was equal to keyResult - it++; + ++it; } } else { // Find the super buckets for the input bucket @@ -986,19 +980,17 @@ LockableMap<Map>::getAllWithoutLocking(const document::BucketId& bucket, if (it != _map.end()) { // Nextkey might be contained in the imput bucket, // e.g. if it is the first bucket in bucketdb - document::BucketId id = document::BucketId( - document::BucketId::keyToBucketId(it->first)); + BucketId id = BucketId(BucketId::keyToBucketId(it->first)); if (!bucket.contains(id)) { - it++; + ++it; } } } // Buckets contained in the found bucket will come immediately after it. // Traverse the map to find them. - for (; it != _map.end(); it++) { - document::BucketId id( - document::BucketId(document::BucketId::keyToBucketId(it->first))); + for (; it != _map.end(); ++it) { + BucketId id(BucketId(BucketId::keyToBucketId(it->first))); if (bucket.contains(id)) { keys.push_back(it->first); @@ -1017,13 +1009,13 @@ LockableMap<Map>::getAllWithoutLocking(const document::BucketId& bucket, */ template<typename Map> std::map<document::BucketId, typename LockableMap<Map>::WrappedEntry> -LockableMap<Map>::getAll(const document::BucketId& bucket, const char* clientId, - const document::BucketId& sibling) +LockableMap<Map>::getAll(const BucketId& bucket, const char* clientId, + const BucketId& sibling) { vespalib::MonitorGuard guard(_lock); - std::map<document::BucketId, WrappedEntry> results; - std::vector<document::BucketId::Type> keys; + std::map<BucketId, WrappedEntry> results; + std::vector<BucketId::Type> keys; getAllWithoutLocking(bucket, sibling, keys); @@ -1038,8 +1030,8 @@ LockableMap<Map>::isConsistent(const typename LockableMap<Map>::WrappedEntry& en { vespalib::MonitorGuard guard(_lock); - document::BucketId sibling(0); - std::vector<document::BucketId::Type> keys; + BucketId sibling(0); + std::vector<BucketId::Type> keys; getAllWithoutLocking(entry.getBucketId(), sibling, keys); assert(keys.size() >= 1); @@ -1058,7 +1050,7 @@ LockableMap<Map>::showLockClients(vespalib::asciistream & out) const it != _lockedKeys.end(); ++it) { out << "\n " - << document::BucketId(document::BucketId::keyToBucketId(it->_key)) + << BucketId(BucketId::keyToBucketId(it->_key)) << " - " << it->_owner; } out << "\nClients waiting for keys:"; @@ -1066,7 +1058,7 @@ LockableMap<Map>::showLockClients(vespalib::asciistream & out) const it != _lockWaiters.end(); ++it) { out << "\n " - << document::BucketId(document::BucketId::keyToBucketId(it->second._key)) + << BucketId(BucketId::keyToBucketId(it->second._key)) << " - " << it->second._owner; } } |