taco-db  0.1.0
Index.h
Go to the documentation of this file.
1 
7 #ifndef CATALOG_SYSTABLES_Index_H
8 #define CATALOG_SYSTABLES_Index_H
9 
10 namespace taco {
11 
17 public:
18 
22  constexpr Oid
23  idxid() const {
24  return m_idxid;
25  }
26 
30  constexpr Oid
31  idxtabid() const {
32  return m_idxtabid;
33  }
34 
38  constexpr uint8_t
39  idxtyp() const {
40  return m_idxtyp;
41  }
42 
46  constexpr bool
47  idxunique() const {
48  return m_idxunique;
49  }
50 
54  constexpr int16_t
55  idxncols() const {
56  return m_idxncols;
57  }
58 
62  constexpr uint32_t
63  idxfid() const {
64  return m_idxfid;
65  }
66 
70  constexpr const std::string&
71  idxname() const {
72  return m_idxname;
73  }
74 
75 
76 
77 private:
79  Oid idxid,
80  Oid idxtabid,
81  uint8_t idxtyp,
82  bool idxunique,
83  int16_t idxncols,
84  uint32_t idxfid,
85  std::string idxname
86 
87  ):
88  m_idxid((idxid)),
90  m_idxtyp((idxtyp)),
93  m_idxfid((idxfid)),
94  m_idxname(std::move(idxname))
95 {}
96 
99  uint8_t m_idxtyp;
101  int16_t m_idxncols;
102  uint32_t m_idxfid;
103  std::string m_idxname;
104 
111  std::vector<Datum> GetDatumVector() const;
112 
118  static SysTable_Index *Create(const std::vector<Datum>&);
119 
120  SysTable_Index(const SysTable_Index&) = default;
122 
123  friend class BootstrapCatCache;
125 
126 public:
127  // The following are constants of the field ids in the systables.
128  // These are mostly used by the catalog cache impl. to prevent accidental
129  // misspelling of column names.
130 
131  inline static constexpr FieldId
133  return 0;
134  }
135 
136  inline static constexpr FieldId
138  return 1;
139  }
140 
141  inline static constexpr FieldId
143  return 2;
144  }
145 
146  inline static constexpr FieldId
148  return 3;
149  }
150 
151  inline static constexpr FieldId
153  return 4;
154  }
155 
156  inline static constexpr FieldId
158  return 5;
159  }
160 
161  inline static constexpr FieldId
163  return 6;
164  }
165 
166 
167 };
168 
169 } // namespace taco
170 
171 #endif // CATALOG_SYSTABLES_Index_H
172 
BootstrapCatCache stores hard-coded data needed to bootstrap the entire database catalog.
Definition: BootstrapCatCache.h:21
Some internal functions of catalog cache implementations.
Definition: CatCacheBase.h:38
SysTable_Index is an in-memory cached record in the system catalog SysTable_Index.
Definition: Index.h:16
constexpr const std::string & idxname() const
Returns the index name.
Definition: Index.h:71
SysTable_Index(Oid idxid, Oid idxtabid, uint8_t idxtyp, bool idxunique, int16_t idxncols, uint32_t idxfid, std::string idxname)
Definition: Index.h:78
constexpr int16_t idxncols() const
Returns the number of key columns.
Definition: Index.h:55
static constexpr FieldId idxname_colid()
Definition: Index.h:162
uint8_t m_idxtyp
Definition: Index.h:99
SysTable_Index & operator=(const SysTable_Index &)=default
static constexpr FieldId idxunique_colid()
Definition: Index.h:147
static constexpr FieldId idxtyp_colid()
Definition: Index.h:142
static constexpr FieldId idxncols_colid()
Definition: Index.h:152
std::vector< Datum > GetDatumVector() const
Returns all the fields as a datum vector.
Definition: Index.cpp:39
constexpr Oid idxid() const
Returns the index ID.
Definition: Index.h:23
constexpr Oid idxtabid() const
Returns the table id of that the index is built on (may be InvalidOid).
Definition: Index.h:31
static SysTable_Index * Create(const std::vector< Datum > &)
Creates a new SysTable_Index with a data vector read from some record payload.
Definition: Index.cpp:17
int16_t m_idxncols
Definition: Index.h:101
Oid m_idxid
Definition: Index.h:97
SysTable_Index(const SysTable_Index &)=default
static constexpr FieldId idxid_colid()
Definition: Index.h:132
Oid m_idxtabid
Definition: Index.h:98
static constexpr FieldId idxfid_colid()
Definition: Index.h:157
std::string m_idxname
Definition: Index.h:103
constexpr uint8_t idxtyp() const
Returns the type id of the index, see index/idxtyps.h.
Definition: Index.h:39
uint32_t m_idxfid
Definition: Index.h:102
constexpr bool idxunique() const
Returns whether this is a unique index.
Definition: Index.h:47
constexpr uint32_t idxfid() const
Returns the file ID of the index if any.
Definition: Index.h:63
bool m_idxunique
Definition: Index.h:100
static constexpr FieldId idxtabid_colid()
Definition: Index.h:137
Definition: Record.h:148
Definition: datum.h:28
uint32_t Oid
Definition: tdb_base.h:210
int16_t FieldId
Definition: tdb_base.h:212