15
15
16
16
#include " common/container/cuckoo_map.h"
17
17
#include " common/internal_types.h"
18
+ #include " common/item_pointer.h"
18
19
#include " common/logger.h"
19
20
#include " common/macros.h"
20
21
@@ -34,6 +35,9 @@ class StatementCache;
34
35
CUCKOO_MAP_TEMPLATE_ARGUMENTS
35
36
CUCKOO_MAP_TYPE::CuckooMap () {}
36
37
38
+ CUCKOO_MAP_TEMPLATE_ARGUMENTS
39
+ CUCKOO_MAP_TYPE::CuckooMap (size_t initial_size) : cuckoo_map(initial_size) {}
40
+
37
41
CUCKOO_MAP_TEMPLATE_ARGUMENTS
38
42
CUCKOO_MAP_TYPE::~CuckooMap () {}
39
43
@@ -83,6 +87,18 @@ CUCKOO_MAP_TEMPLATE_ARGUMENTS
83
87
CUCKOO_MAP_ITERATOR_TYPE
84
88
CUCKOO_MAP_TYPE::GetIterator () { return cuckoo_map.lock_table (); }
85
89
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
+
86
102
// Explicit template instantiation
87
103
template class CuckooMap <uint32_t , uint32_t >;
88
104
@@ -102,4 +118,8 @@ template class CuckooMap<std::shared_ptr<oid_t>, std::shared_ptr<oid_t>>;
102
118
// Used in StatementCacheManager
103
119
template class CuckooMap <StatementCache *, StatementCache *>;
104
120
121
+ // Used in InternalTypes
122
+ template class CuckooMap <ItemPointer, RWType, ItemPointerHasher,
123
+ ItemPointerComparator>;
124
+
105
125
} // namespace peloton
0 commit comments