taco-db  0.1.0
IndexDesc.h
Go to the documentation of this file.
1 #ifndef CATALOG_INDEXDESC_H
2 #define CATALOG_INDEXDESC_H
3 
4 #include "tdb.h"
5 
6 #include "catalog/Schema.h"
7 #include "catalog/systables.h"
8 
9 namespace taco {
10 
11 class IndexDesc {
12 public:
16  static IndexDesc *Create(std::shared_ptr<const SysTable_Index> index,
17  std::vector<std::shared_ptr<SysTable_IndexColumn>> index_columns,
18  std::unique_ptr<Schema> key_schema);
19 
26  const SysTable_Index *
27  GetIndexEntry() const {
28  return m_index.get();
29  }
30 
31  const SysTable_IndexColumn *
33  return m_index_columns[keyid].get();
34  }
35 
40  const Schema*
41  GetKeySchema() const {
42  return m_key_schema.get();
43  }
44 
45 
46 private:
47  IndexDesc(std::shared_ptr<const SysTable_Index> index,
48  std::vector<std::shared_ptr<SysTable_IndexColumn>> index_columns,
49  std::unique_ptr<Schema> key_schema):
50  m_index(std::move(index)),
51  m_index_columns(std::move(index_columns)),
52  m_key_schema(std::move(key_schema)) {}
53 
54  std::shared_ptr<const SysTable_Index> m_index;
55  std::vector<std::shared_ptr<SysTable_IndexColumn>> m_index_columns;
56  std::unique_ptr<Schema> m_key_schema;
57 };
58 
59 
60 } // namespace taco
61 
62 #endif // CATALOG_INDEXDESC_H
Definition: IndexDesc.h:11
static IndexDesc * Create(std::shared_ptr< const SysTable_Index > index, std::vector< std::shared_ptr< SysTable_IndexColumn >> index_columns, std::unique_ptr< Schema > key_schema)
This overload simply passes the arguments to the constructor.
Definition: IndexDesc.cpp:6
std::unique_ptr< Schema > m_key_schema
Definition: IndexDesc.h:56
const Schema * GetKeySchema() const
Returns the cached index key schema, which we guanrantee ‘IsLayoutComputed() == true’.
Definition: IndexDesc.h:41
const SysTable_Index * GetIndexEntry() const
Returns the cached Index entry associated with this index descriptor.
Definition: IndexDesc.h:27
std::shared_ptr< const SysTable_Index > m_index
Definition: IndexDesc.h:54
const SysTable_IndexColumn * GetIndexColumnEntry(FieldId keyid) const
Definition: IndexDesc.h:32
IndexDesc(std::shared_ptr< const SysTable_Index > index, std::vector< std::shared_ptr< SysTable_IndexColumn >> index_columns, std::unique_ptr< Schema > key_schema)
Definition: IndexDesc.h:47
std::vector< std::shared_ptr< SysTable_IndexColumn > > m_index_columns
Definition: IndexDesc.h:55
A Schema object stores the information for accessing an ordered set of typed fields either from a dis...
Definition: Schema.h:39
SysTable_IndexColumn is an in-memory cached record in the system catalog SysTable_IndexColumn.
Definition: IndexColumn.h:16
SysTable_Index is an in-memory cached record in the system catalog SysTable_Index.
Definition: Index.h:16
Definition: Record.h:148
Definition: datum.h:28
int16_t FieldId
Definition: tdb_base.h:212
This header file includes all internal struct representation of system catalog records.