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

Commit ac4edc8

Browse files
Added PredEq template
1 parent 368bc7c commit ac4edc8

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

src/common/container/cuckoo_map.cpp

Lines changed: 1 addition & 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

src/include/common/container/cuckoo_map.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ namespace peloton {
2424

2525
// CUCKOO_MAP_TEMPLATE_ARGUMENTS
2626
#define CUCKOO_MAP_TEMPLATE_ARGUMENTS template <typename KeyType, \
27-
typename ValueType, typename HashType >
27+
typename ValueType, typename HashType, typename PredType >
2828

2929
// CUCKOO_MAP_DEFAULT_ARGUMENTS
3030
#define CUCKOO_MAP_DEFAULT_ARGUMENTS template <typename KeyType, \
31-
typename ValueType, typename HashType = DefaultHasher<KeyType> >
31+
typename ValueType, typename HashType = DefaultHasher<KeyType>, \
32+
typename PredType = std::equal_to<KeyType>>
3233

3334
// CUCKOO_MAP_TYPE
34-
#define CUCKOO_MAP_TYPE CuckooMap<KeyType, ValueType, HashType >
35+
#define CUCKOO_MAP_TYPE CuckooMap<KeyType, ValueType, HashType, PredType >
3536

3637
// Iterator type
3738
#define CUCKOO_MAP_ITERATOR_TYPE \

src/include/common/internal_types.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#ifndef INTERNALTYPES_H
14+
#define INTERNALTYPES_H
15+
1316
#pragma once
1417

1518
#include <bitset>
@@ -28,9 +31,14 @@
2831
#include "type/type_id.h"
2932
#include "common/logger.h"
3033
#include "common/macros.h"
34+
#include "container/cuckoo_map.h"
3135

3236
namespace peloton {
3337

38+
class ItemPointer;
39+
struct ItemPointerHasher;
40+
class ItemPointerComparator;
41+
3442
// For all of the enums defined in this header, we will
3543
// use this value to indicate that it is an invalid value
3644
// I don't think it matters whether this is 0 or -1
@@ -1199,6 +1207,10 @@ std::ostream &operator<<(std::ostream &os, const RWType &type);
11991207
typedef std::unordered_map<oid_t, std::unordered_map<oid_t, RWType>>
12001208
ReadWriteSet;
12011209

1210+
// ItemPointer -> type
1211+
typedef CuckooMap<ItemPointer, RWType, ItemPointerHasher, ItemPointerComparator>
1212+
CuckooReadWriteSet;
1213+
12021214
// this enum is to identify why the version should be GC'd.
12031215
enum class GCVersionType {
12041216
INVALID,
@@ -1407,3 +1419,5 @@ enum class SSLLevel {
14071419
};
14081420

14091421
} // namespace peloton
1422+
1423+
#endif /* INTERNALTYPES_H */

src/include/common/item_pointer.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@
1111
//
1212
//===----------------------------------------------------------------------===//
1313

14+
#ifndef ITEMPOINTER_H
15+
#define ITEMPOINTER_H
16+
1417
#pragma once
1518

1619
#include <cstdint>
1720

18-
#include "internal_types.h"
21+
#include "common/internal_types.h"
1922

2023
namespace peloton {
2124

@@ -77,3 +80,5 @@ class ItemPointerHashFunc {
7780
bool AtomicUpdateItemPointer(ItemPointer *src_ptr, const ItemPointer &value);
7881

7982
} // namespace peloton
83+
84+
#endif /* ITEMPOINTER_H */

0 commit comments

Comments
 (0)