@@ -32,32 +32,47 @@ class ArtIndex : public Index {
32
32
// Forward declare iterator class for later
33
33
class Iterator ;
34
34
35
- // / Insert the given key-value pair into the index
36
35
bool InsertEntry (const storage::Tuple *key, ItemPointer *value) override ;
37
36
38
- // / Delete the given key-value pair from the index
39
37
bool DeleteEntry (const storage::Tuple *key, ItemPointer *value) override ;
40
38
41
- // / Insert the given key-value pair into the index, but only if the predicate
42
- // / returns false for every instance of the given key in the index
43
39
bool CondInsertEntry (const storage::Tuple *key, ItemPointer *value,
44
40
std::function<bool (const void *)> predicate) override ;
45
41
46
- // / Scan the range of keys between [start,end] inclusive, placing results in
47
- // / the provided result vector
42
+ /* *
43
+ * Perform a range scan of keys between [start,end] inclusive.
44
+ *
45
+ * @param start The start key
46
+ * @param end The end key
47
+ * @param[out] result Where the results of the scan are stored
48
+ * @param scan_predicate
49
+ */
48
50
void ScanRange (const storage::Tuple *start, const storage::Tuple *end,
49
51
std::vector<ItemPointer *> &result);
50
52
51
- // / Perform a scan, using the predicate, and place the results into the
52
- // / provided result vector
53
+ /* *
54
+ * ArtIndex throws away the first three arguments and only uses the conjuncts
55
+ * from the scan predicate.
56
+ *
57
+ * @param scan_predicate The only predicate that's actually used.
58
+ * @param[out] result Where the results of the scan are stored
59
+ */
53
60
void Scan (const std::vector<type::Value> &values,
54
61
const std::vector<oid_t > &key_column_ids,
55
62
const std::vector<ExpressionType> &expr_types,
56
63
ScanDirectionType scan_direction,
57
64
std::vector<ItemPointer *> &result,
58
65
const ConjunctionScanPredicate *scan_predicate) override ;
59
66
60
- // / Perform a limited scan
67
+ /* *
68
+ * ArtIndex throws away the first three arguments and only uses the conjuncts
69
+ * from the scan predicate.
70
+ *
71
+ * @param scan_predicate The only parameter that's used
72
+ * @param[out] result Where the results of the scan are stored
73
+ * @param limit How many results to actually return
74
+ * @param offset How many items to exclude from the results
75
+ */
61
76
void ScanLimit (const std::vector<type::Value> &values,
62
77
const std::vector<oid_t > &key_column_ids,
63
78
const std::vector<ExpressionType> &expr_types,
@@ -66,10 +81,8 @@ class ArtIndex : public Index {
66
81
const ConjunctionScanPredicate *scan_predicate, uint64_t limit,
67
82
uint64_t offset) override ;
68
83
69
- // / Scan the entire index, placing results in the provided result vector
70
84
void ScanAllKeys (std::vector<ItemPointer *> &result) override ;
71
85
72
- // / Scan all values for the given key, placing results in the provided vector
73
86
void ScanKey (const storage::Tuple *key,
74
87
std::vector<ItemPointer *> &result) override ;
75
88
@@ -81,19 +94,30 @@ class ArtIndex : public Index {
81
94
// TODO(pmenon): Implement me
82
95
size_t GetMemoryFootprint () override { return 0 ; }
83
96
84
- // / Does the index need GC
85
97
// TODO(pmenon): Implement me
86
98
bool NeedGC () override { return false ; }
87
99
88
- // / Perform any necessary GC on the index
89
100
// TODO(pmenon): Implement me
90
101
void PerformGC () override {}
91
102
92
- // / These two functions are for testing so we can inject custom key loading
93
- // / functions without bringing up a full-blown database/table.
103
+ /* *
104
+ * Configure the load-key function for this index. The load-key function
105
+ * retrieves the key associated with a given value in the tree. This is
106
+ * necessary because an ART index does not always store the whole key in the
107
+ * tree due to prefix compression.
108
+ *
109
+ * @param load_func The loading key function pointer
110
+ * @param ctx An opaque pointer to some user-provided context. This context is
111
+ * passed as the first argument to the load-key function on each invocation.
112
+ */
94
113
void SetLoadKeyFunc (art::Tree::LoadKeyFunction load_func, void *ctx);
95
114
96
- // / Construct an ART key from a Peloton key
115
+ /* *
116
+ * Convert the provided Peloton key into an ART-based key
117
+ *
118
+ * @param tuple The input key we'd like to convert
119
+ * @param[out] key Where the art-compatible key is written to
120
+ */
97
121
void ConstructArtKey (const AbstractTuple &tuple, art::Key &key) const {
98
122
key_constructor_.ConstructKey (tuple, key);
99
123
}
@@ -112,10 +136,21 @@ class ArtIndex : public Index {
112
136
explicit KeyConstructor (const catalog::Schema &key_schema)
113
137
: key_schema_(key_schema) {}
114
138
115
- // / Given an input Peloton key, construct an equivalent art::Key
139
+ /* *
140
+ * Given an input Peloton key, construct an equivalent art::Key
141
+ *
142
+ * @param input_key The input (i.e., Peloton key)
143
+ * @param[out] tree_key Where the tree-compatible key is written
144
+ */
116
145
void ConstructKey (const AbstractTuple &input_key, art::Key &tree_key) const ;
117
146
118
- // / Generate the minimum and maximum key
147
+ /* *
148
+ * Generate the minimum and maximum key, storing the results in the provided
149
+ * min_key and max_key function parameters
150
+ *
151
+ * @param[out] min_key Where the minimum key is written
152
+ * @param[out] max_key Where the maximum key is written
153
+ */
119
154
void ConstructMinMaxKey (art::Key &min_key, art::Key &max_key) const ;
120
155
121
156
private:
0 commit comments