@@ -32,11 +32,11 @@ class AbstractTuple;
32
32
33
33
namespace catalog {
34
34
class Schema ;
35
- }
35
+ } // namespace catalog
36
36
37
37
namespace storage {
38
38
class Tuple ;
39
- }
39
+ } // namespace storage
40
40
41
41
namespace index {
42
42
@@ -69,78 +69,56 @@ class IndexMetadata : public Printable {
69
69
70
70
const std::string &GetName () const { return name_; }
71
71
72
- inline oid_t GetOid () { return index_oid; }
72
+ oid_t GetOid () { return index_oid; }
73
73
74
- inline oid_t GetTableOid () { return table_oid; }
74
+ oid_t GetTableOid () { return table_oid; }
75
75
76
- inline oid_t GetDatabaseOid () { return database_oid; }
76
+ oid_t GetDatabaseOid () { return database_oid; }
77
77
78
- inline IndexType GetIndexType () { return index_type_; }
78
+ IndexType GetIndexType () { return index_type_; }
79
79
80
80
IndexConstraintType GetIndexConstraintType () {
81
81
return index_constraint_type_;
82
82
}
83
83
84
- /*
85
- * Returns a schema object pointer that represents
86
- * the schema of indexed columns, from leading column
87
- * to the least important columns
88
- */
89
- inline const catalog::Schema *GetKeySchema () const { return key_schema; }
84
+ // Returns a schema object pointer that represents the schema of indexed
85
+ // columns, from leading column to the least important columns.
86
+ const catalog::Schema *GetKeySchema () const { return key_schema; }
90
87
91
- /*
92
- * Returns a schema object pointer that represents
93
- * the schema of the underlying table
94
- */
95
- inline const catalog::Schema *GetTupleSchema () const { return tuple_schema; }
88
+ // Returns a schema object that represents the schema of the underlying table
89
+ const catalog::Schema *GetTupleSchema () const { return tuple_schema; }
96
90
97
91
// Return the number of columns inside index key (not in tuple key)
98
- //
99
- // Note that this must be defined inside the cpp source file
100
- // because it uses the member of catalog::Schema which is not known here
101
92
oid_t GetColumnCount () const ;
102
93
103
94
bool HasUniqueKeys () const { return unique_keys; }
104
95
105
- /*
106
- * GetKeyAttrs() - Returns the mapping relation between indexed columns
107
- * and base table columns
108
- *
109
- * The return value is a const vector reference
110
- *
111
- * The entry whose value is j on index i means the i-th column in the
112
- * key is mapped to the j-th column in the base table tuple
113
- */
114
- inline const std::vector<oid_t > &GetKeyAttrs () const { return key_attrs; }
96
+ // Returns the mapping relation between indexed columns and base table columns
97
+ // The entry whose value is j on index i means the i-th column in the key is
98
+ // mapped to the j-th column in the base table tuple
99
+ const std::vector<oid_t > &GetKeyAttrs () const { return key_attrs; }
115
100
116
- /*
117
- * GetTupleToIndexMapping() - Returns the mapping relation between tuple key
118
- * column and index key columns
119
- */
120
- inline const std::vector<oid_t > &GetTupleToIndexMapping () const {
101
+ // Returns the mapping relation between tuple key column and index key columns
102
+ const std::vector<oid_t > &GetTupleToIndexMapping () const {
121
103
return tuple_attrs;
122
104
}
123
105
124
- inline double GetUtility () const { return utility_ratio; }
106
+ double GetUtility () const { return utility_ratio; }
125
107
126
- inline void SetUtility (double p_utility_ratio) {
127
- utility_ratio = p_utility_ratio;
128
- }
108
+ void SetUtility (double p_utility_ratio) { utility_ratio = p_utility_ratio; }
129
109
130
- inline bool GetVisibility () const { return (visible_); }
110
+ bool GetVisibility () const { return (visible_); }
131
111
132
- inline void SetVisibility (bool visibile ) { visible_ = visibile ; }
112
+ void SetVisibility (bool visible ) { visible_ = visible ; }
133
113
134
- /*
135
- * GetInfo() - Get a string representation for debugging
136
- */
137
- const std::string GetInfo () const ;
114
+ // Get a string representation for debugging
115
+ const std::string GetInfo () const override ;
138
116
139
117
// ===--------------------------------------------------------------------===//
140
118
// STATIC HELPERS
141
119
// ===--------------------------------------------------------------------===//
142
120
143
- static inline void SetDefaultVisibleFlag (bool flag) {
121
+ static void SetDefaultVisibleFlag (bool flag) {
144
122
LOG_DEBUG (" Set IndexMetadata visible flag to '%s'" ,
145
123
(flag ? " true" : " false" ));
146
124
index_default_visibility = flag;
@@ -336,9 +314,9 @@ class Index : public Printable {
336
314
virtual void ScanKey (const storage::Tuple *key,
337
315
std::vector<ItemPointer *> &result) = 0;
338
316
339
- // /////////////////////////////////////////////////////////////////
340
- // Garbage Collection
341
- // /////////////////////////////////////////////////////////////////
317
+ // ////////////////////////////////////////////////////////////////////////////
318
+ // / Garbage Collection
319
+ // ////////////////////////////////////////////////////////////////////////////
342
320
343
321
// This gives a hint on whether GC is needed on the index
344
322
// For those that do not need GC this always return false
@@ -348,17 +326,9 @@ class Index : public Printable {
348
326
// For those that do not need GC this should return immediately
349
327
virtual void PerformGC () = 0;
350
328
351
- // The following two are used to perform GC in a
352
- // fast manner
353
- // Because if we register for epoch for every operation then
354
- // essentially we are synchronizing on each operation which does
355
- // not scale at all
356
- // virtual void *JoinEpoch() = 0;
357
- // virtual void LeaveEpoch(void *) = 0;
358
-
359
- // ===--------------------------------------------------------------------===//
360
- // STATS
361
- // ===--------------------------------------------------------------------===//
329
+ // ////////////////////////////////////////////////////////////////////////////
330
+ // / Stats
331
+ // ////////////////////////////////////////////////////////////////////////////
362
332
363
333
void IncreaseNumberOfTuplesBy (const size_t amount);
364
334
@@ -372,9 +342,9 @@ class Index : public Printable {
372
342
373
343
void ResetDirty ();
374
344
375
- // ===--------------------------------------------------------------------=== //
376
- // Utilities
377
- // ===--------------------------------------------------------------------=== //
345
+ // ////////////////////////////////////////////////////////////////////////// //
346
+ // / Utilities
347
+ // ////////////////////////////////////////////////////////////////////////// //
378
348
379
349
virtual std::string GetTypeName () const = 0;
380
350
@@ -393,6 +363,8 @@ class Index : public Printable {
393
363
return metadata->GetKeySchema ();
394
364
}
395
365
366
+ IndexType GetIndexMethodType () const { return metadata->GetIndexType (); }
367
+
396
368
IndexConstraintType GetIndexType () const {
397
369
return metadata->GetIndexConstraintType ();
398
370
}
@@ -420,8 +392,6 @@ class Index : public Printable {
420
392
421
393
virtual void IncrementIndexedTileGroupOffset () {
422
394
indexed_tile_group_offset++;
423
-
424
- return ;
425
395
}
426
396
427
397
protected:
0 commit comments