Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit fc2c796

Browse files
authored
Merge branch 'master' into invalid-argument
2 parents a3ee7d0 + 4b1e90a commit fc2c796

File tree

7 files changed

+319
-281
lines changed

7 files changed

+319
-281
lines changed

src/common/container/cuckoo_map.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include "common/container/cuckoo_map.h"
1717
#include "common/internal_types.h"
18+
#include "common/item_pointer.h"
1819
#include "common/logger.h"
1920
#include "common/macros.h"
2021

@@ -34,6 +35,9 @@ class StatementCache;
3435
CUCKOO_MAP_TEMPLATE_ARGUMENTS
3536
CUCKOO_MAP_TYPE::CuckooMap() {}
3637

38+
CUCKOO_MAP_TEMPLATE_ARGUMENTS
39+
CUCKOO_MAP_TYPE::CuckooMap(size_t initial_size) : cuckoo_map(initial_size) {}
40+
3741
CUCKOO_MAP_TEMPLATE_ARGUMENTS
3842
CUCKOO_MAP_TYPE::~CuckooMap() {}
3943

@@ -83,6 +87,18 @@ CUCKOO_MAP_TEMPLATE_ARGUMENTS
8387
CUCKOO_MAP_ITERATOR_TYPE
8488
CUCKOO_MAP_TYPE::GetIterator() { return cuckoo_map.lock_table(); }
8589

90+
CUCKOO_MAP_TEMPLATE_ARGUMENTS
91+
CUCKOO_MAP_ITERATOR_TYPE
92+
CUCKOO_MAP_TYPE::GetConstIterator() const {
93+
// WARNING: This is a compiler hack and should never be used elsewhere
94+
// If you are considering using this, please ask Marcel first
95+
// We need the const iterator on the const object and the cuckoohash
96+
// library returns a lock_table object. The other option would be to
97+
// Modify the cuckoohash library which is not neat.
98+
auto locked_table = const_cast<CuckooMap *>(this)->cuckoo_map.lock_table();
99+
return locked_table;
100+
}
101+
86102
// Explicit template instantiation
87103
template class CuckooMap<uint32_t, uint32_t>;
88104

@@ -102,4 +118,8 @@ template class CuckooMap<std::shared_ptr<oid_t>, std::shared_ptr<oid_t>>;
102118
// Used in StatementCacheManager
103119
template class CuckooMap<StatementCache *, StatementCache *>;
104120

121+
// Used in InternalTypes
122+
template class CuckooMap<ItemPointer, RWType, ItemPointerHasher,
123+
ItemPointerComparator>;
124+
105125
} // namespace peloton

0 commit comments

Comments
 (0)