This repository was archived by the owner on Sep 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 618
/
Copy pathsystem_catalogs.h
153 lines (129 loc) · 3.93 KB
/
system_catalogs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
//===----------------------------------------------------------------------===//
//
// Peloton
//
// system_catalog.h
//
// Identification: src/include/catalog/system_catalog.h
//
// Copyright (c) 2015-18, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//
#pragma once
#include <mutex>
#include "catalog/column_stats_catalog.h"
#include "catalog/constraint_catalog.h"
#include "catalog/database_catalog.h"
#include "catalog/index_metrics_catalog.h"
#include "catalog/query_metrics_catalog.h"
#include "catalog/schema_catalog.h"
#include "catalog/table_catalog.h"
#include "catalog/table_metrics_catalog.h"
#include "catalog/trigger_catalog.h"
namespace peloton {
namespace storage {
class Database;
} // namespace storage
namespace catalog {
class DatabaseCatalog;
class SchemaCatalog;
class TableCatalog;
class IndexCatalog;
class ColumnCatalog;
class LayoutCatalog;
class ConstraintCatalog;
class SystemCatalogs {
public:
SystemCatalogs() = delete;
SystemCatalogs(concurrency::TransactionContext *txn,
storage::Database *database,
type::AbstractPool *pool);
~SystemCatalogs();
void Bootstrap(concurrency::TransactionContext *txn,
const std::string &database_name);
//===--------------------------------------------------------------------===//
// GET FUNCTIONS
// get catalog tables with name
//===--------------------------------------------------------------------===//
ColumnCatalog *GetColumnCatalog() {
if (!pg_attribute_) {
throw CatalogException("Column catalog has not been initialized");
}
return pg_attribute_;
}
SchemaCatalog *GetSchemaCatalog() {
if (!pg_namespace_) {
throw CatalogException("schema catalog has not been initialized");
}
return pg_namespace_;
}
TableCatalog *GetTableCatalog() {
if (!pg_table_) {
throw CatalogException("Table catalog has not been initialized");
}
return pg_table_;
}
IndexCatalog *GetIndexCatalog() {
if (!pg_index_) {
throw CatalogException("Index catalog has not been initialized");
}
return pg_index_;
}
LayoutCatalog *GetLayoutCatalog() {
if (!pg_layout_) {
throw CatalogException("Layout catalog has not been initialized");
}
return pg_layout_;
}
ConstraintCatalog *GetConstraintCatalog() {
if (!pg_constraint_) {
throw CatalogException("Layout catalog has not been initialized");
}
return pg_constraint_;
}
TriggerCatalog *GetTriggerCatalog() {
if (!pg_trigger_) {
throw CatalogException("Trigger catalog has not been initialized");
}
return pg_trigger_;
}
TableMetricsCatalog *GetTableMetricsCatalog() {
if (!pg_table_metrics_) {
throw CatalogException("Table metrics catalog has not been initialized");
}
return pg_table_metrics_;
}
IndexMetricsCatalog *GetIndexMetricsCatalog() {
if (!pg_index_metrics_) {
throw CatalogException("Index metrics catalog has not been initialized");
}
return pg_index_metrics_;
}
QueryMetricsCatalog *GetQueryMetricsCatalog() {
if (!pg_query_metrics_) {
throw CatalogException("Query metrics catalog has not been initialized");
}
return pg_query_metrics_;
}
ColumnStatsCatalog *GetColumnStatsCatalog() {
if (!pg_column_stats_) {
throw CatalogException("Column stats catalog has not been initialized");
}
return pg_column_stats_;
}
private:
ColumnCatalog *pg_attribute_;
SchemaCatalog *pg_namespace_;
TableCatalog *pg_table_;
IndexCatalog *pg_index_;
LayoutCatalog *pg_layout_;
ConstraintCatalog *pg_constraint_;
TriggerCatalog *pg_trigger_;
// ProcCatalog *pg_proc;
TableMetricsCatalog *pg_table_metrics_;
IndexMetricsCatalog *pg_index_metrics_;
QueryMetricsCatalog *pg_query_metrics_;
ColumnStatsCatalog * pg_column_stats_;
};
} // namespace catalog
} // namespace peloton