forked from kohler/masstree-beta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
masstree_query.hh
82 lines (65 loc) · 2.35 KB
/
masstree_query.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
/* Masstree
* Eddie Kohler, Yandong Mao, Robert Morris
* Copyright (c) 2012-2013 President and Fellows of Harvard College
* Copyright (c) 2012-2013 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 MASSTREE_QUERY_HH
#define MASSTREE_QUERY_HH 1
#include "masstree.hh"
#include "kvproto.hh"
template <typename R> class query;
template <typename R> class replay_query;
namespace lcdf { class Json; }
namespace Masstree {
template <typename P>
class query_table {
public:
typedef P param_type;
typedef node_base<P> node_type;
query_table() {
}
basic_table<P>& table() {
return table_;
}
void initialize(threadinfo* ti) {
table_.initialize(ti);
}
void reinitialize(threadinfo* ti) {
table_.reinitialize(ti);
}
bool get(query<row_type>& q, threadinfo* ti) const;
void scan(query<row_type>& q, threadinfo* ti) const;
void rscan(query<row_type>& q, threadinfo* ti) const;
result_t put(query<row_type>& q, threadinfo* ti);
void replace(query<row_type>& q, threadinfo* ti);
bool remove(query<row_type>& q, threadinfo* ti);
void replay(replay_query<row_type>& q, threadinfo* ti);
void checkpoint_restore(Str key, Str value, kvtimestamp_t ts,
threadinfo* ti);
void findpivots(Str* pv, int npv) const;
void stats(FILE* f);
void json_stats(lcdf::Json& j, threadinfo* ti);
void print(FILE* f, int indent) 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 query_table<default_query_table_params> default_table;
} // namespace Masstree
#endif