taco-db  0.1.0
BootstrapCatCache.h
Go to the documentation of this file.
1 #ifndef CATALOG_BOOTSTRAPCATCACHE_H
2 #define CATALOG_BOOTSTRAPCATCACHE_H
3 
4 #include "tdb.h"
5 
6 #include <absl/container/flat_hash_map.h>
7 
8 #include "catalog/systables.h"
9 #include "catalog/TableDesc.h"
11 
12 namespace taco {
13 
22 public:
30 
32 
37  void Init();
38 
39  const SysTable_Table *FindTable(Oid oid);
40 
41  const SysTable_Type *FindType(Oid oid);
42 
43  std::vector<const SysTable_Column*> FindColumns(Oid tabid);
44 
45  const TableDesc *FindTableDesc(Oid oid);
46 
48 
49 private:
54  void CreateTableDesc(const std::vector<const SysTable_Column*> &columns);
55 
60 
61  absl::flat_hash_map<Oid, const SysTable_Table*> m_tabid_lookup_table;
62  absl::flat_hash_map<Oid, const SysTable_Type*> m_typid_lookup_table;
63  absl::flat_hash_map<Oid, const SysTable_Function*> m_funcid_lookup_table;
64 
65  std::vector<std::unique_ptr<TableDesc>> m_table_desc;
66  absl::flat_hash_map<Oid, const TableDesc *> m_table_desc_lookup_table;
67 
68 };
69 
70 } // namespace taco
71 
72 #endif // CATALOG_BOOTSTRAP_CATCACHE_H
Some meta info about the bootstrap systable data.
BootstrapCatCache stores hard-coded data needed to bootstrap the entire database catalog.
Definition: BootstrapCatCache.h:21
SysTable_Type m_type[num_bootstrap_types]
Definition: BootstrapCatCache.h:57
void Init()
Finishes the initialization of the bootstrap catalog cache.
Definition: BootstrapCatCache.cpp:12
const TableDesc * FindTableDesc(Oid oid)
Definition: BootstrapCatCache.cpp:95
SysTable_Column m_column[num_bootstrap_columns]
Definition: BootstrapCatCache.h:58
SysTable_Table m_table[num_bootstrap_tables]
Definition: BootstrapCatCache.h:56
std::vector< std::unique_ptr< TableDesc > > m_table_desc
Definition: BootstrapCatCache.h:65
absl::flat_hash_map< Oid, const SysTable_Function * > m_funcid_lookup_table
Definition: BootstrapCatCache.h:63
absl::flat_hash_map< Oid, const TableDesc * > m_table_desc_lookup_table
Definition: BootstrapCatCache.h:66
absl::flat_hash_map< Oid, const SysTable_Type * > m_typid_lookup_table
Definition: BootstrapCatCache.h:62
const SysTable_Type * FindType(Oid oid)
Definition: BootstrapCatCache.cpp:68
BootstrapCatCache()
Initializes the data in the bootstrap systables.
Definition: bootstrap_data.cpp:13
~BootstrapCatCache()
Definition: BootstrapCatCache.cpp:9
void CreateTableDesc(const std::vector< const SysTable_Column * > &columns)
Creates a TableDesc object for a systable table that consists of the `‘columns’', and insert it into ...
Definition: BootstrapCatCache.cpp:104
absl::flat_hash_map< Oid, const SysTable_Table * > m_tabid_lookup_table
Definition: BootstrapCatCache.h:61
const SysTable_Table * FindTable(Oid oid)
Definition: BootstrapCatCache.cpp:60
std::vector< const SysTable_Column * > FindColumns(Oid tabid)
Definition: BootstrapCatCache.cpp:84
const SysTable_Function * FindFunction(Oid oid)
Definition: BootstrapCatCache.cpp:76
SysTable_Function m_function[num_bootstrap_functions]
Definition: BootstrapCatCache.h:59
SysTable_Column is an in-memory cached record in the system catalog SysTable_Column.
Definition: Column.h:16
SysTable_Function is an in-memory cached record in the system catalog SysTable_Function.
Definition: Function.h:16
SysTable_Table is an in-memory cached record in the system catalog SysTable_Table.
Definition: Table.h:16
SysTable_Type is an in-memory cached record in the system catalog SysTable_Type.
Definition: Type.h:16
Definition: TableDesc.h:11
Definition: datum.h:28
constexpr const int num_bootstrap_types
Definition: bootstrap_data.h:13
uint32_t Oid
Definition: tdb_base.h:210
constexpr const int num_bootstrap_functions
Definition: bootstrap_data.h:14
constexpr const int num_bootstrap_tables
Definition: bootstrap_data.h:12
constexpr const int num_bootstrap_columns
Definition: bootstrap_data.h:15
This header file includes all internal struct representation of system catalog records.