MCPcopy Create free account
hub / github.com/activeloopai/deeplake / table_storage

Class table_storage

cpp/deeplake_pg/table_storage.hpp:50–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48};
49
50class table_storage
51{
52public:
53 static table_storage& instance()
54 {
55 static table_storage storage;
56 if (!storage.tables_loaded_) {
57 storage.load_table_metadata();
58 }
59 return storage;
60 }
61
62 void create_table(const std::string& table_name, Oid table_id, TupleDesc tupdesc);
63 void drop_table(const std::string& table_name);
64
65 inline bool table_exists(Oid table_id) const noexcept
66 {
67 return tables_.contains(table_id);
68 }
69
70 inline table_data* get_table_data_if_exists(Oid table_id) noexcept
71 {
72 auto it = tables_.find(table_id);
73 if (it != tables_.end()) {
74 return &it->second;
75 }
76 return nullptr;
77 }
78
79 inline table_data* get_table_data_if_exists(const std::string& table_name) noexcept
80 {
81 for (auto& [_, table] : tables_) {
82 if (table.get_table_name() == table_name) {
83 return &table;
84 }
85 }
86 return nullptr;
87 }
88
89 inline void reset_requested_columns() noexcept
90 {
91 for (auto& [_, table] : tables_) {
92 table.reset_requested_columns();
93 }
94 }
95
96 inline bool table_exists(const std::string& table_name) const noexcept
97 {
98 for (const auto& [_, table] : tables_) {
99 if (table.get_table_name() == table_name) {
100 return true;
101 }
102 }
103 return false;
104 }
105
106 inline bool erase_table(const std::string& table_name)
107 {

Callers

nothing calls this directly

Calls 1

load_table_metadataMethod · 0.80

Tested by

no test coverage detected