-
Notifications
You must be signed in to change notification settings - Fork 117
/
query_masstree.hh
83 lines (69 loc) · 2.25 KB
/
query_masstree.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* Masstree
* Eddie Kohler, Yandong Mao, Robert Morris
* Copyright (c) 2012-2014 President and Fellows of Harvard College
* Copyright (c) 2012-2014 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, subject to the conditions
* listed in the Masstree LICENSE file. These conditions include: you must
* preserve this copyright notice, and you cannot mention the copyright
* holders in advertising related to the Software without their permission.
* The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
* notice is a summary of the Masstree LICENSE file; the license in that file
* is legally binding.
*/
#ifndef QUERY_MASSTREE_HH
#define QUERY_MASSTREE_HH 1
#include "masstree.hh"
#include "kvrow.hh"
class threadinfo;
namespace lcdf { class Json; }
namespace Masstree {
template <typename P>
class query_table {
public:
typedef P parameters_type;
typedef node_base<P> node_type;
typedef leaf<P> leaf_type;
typedef typename P::threadinfo_type threadinfo;
typedef unlocked_tcursor<P> unlocked_cursor_type;
typedef tcursor<P> cursor_type;
query_table() {
}
const basic_table<P>& table() const {
return table_;
}
basic_table<P>& table() {
return table_;
}
void initialize(threadinfo& ti) {
table_.initialize(ti);
}
void destroy(threadinfo& ti) {
table_.destroy(ti);
}
void findpivots(Str* pv, int npv) const;
void stats(FILE* f);
void json_stats(lcdf::Json& j, threadinfo& ti);
inline lcdf::Json json_stats(threadinfo& ti) {
lcdf::Json j;
json_stats(j, ti);
return j;
}
void print(FILE* f) const;
static void test(threadinfo& ti);
static const char* name() {
return "mb";
}
private:
basic_table<P> table_;
};
struct default_query_table_params : public nodeparams<15, 15> {
typedef row_type* value_type;
typedef value_print<value_type> value_print_type;
typedef ::threadinfo threadinfo_type;
};
typedef query_table<default_query_table_params> default_table;
} // namespace Masstree
#endif