| 114 | } |
| 115 | |
| 116 | StoragePtr DatabaseFilesystem::tryGetTableFromCache(const std::string & name) const |
| 117 | { |
| 118 | StoragePtr table = nullptr; |
| 119 | { |
| 120 | std::lock_guard lock(mutex); |
| 121 | auto it = loaded_tables.find(name); |
| 122 | if (it != loaded_tables.end()) |
| 123 | table = it->second; |
| 124 | } |
| 125 | |
| 126 | /// Invalidate cache if file no longer exists. |
| 127 | if (table && !fs::exists(getTablePath(name))) |
| 128 | { |
| 129 | std::lock_guard lock(mutex); |
| 130 | loaded_tables.erase(name); |
| 131 | return nullptr; |
| 132 | } |
| 133 | |
| 134 | return table; |
| 135 | } |
| 136 | |
| 137 | bool DatabaseFilesystem::isTableExist(const String & name, ContextPtr context_) const |
| 138 | { |
nothing calls this directly
no test coverage detected