OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MigrationMgr.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <string>
20 
21 #include "Catalog/Types.h"
24 
25 namespace Catalog_Namespace {
26 class Catalog;
27 }
28 
29 namespace migrations {
30 
31 class MigrationMgr {
32  public:
33  static void migrateDateInDaysMetadata(
34  const Catalog_Namespace::TableDescriptorMapById& table_descriptors_by_id,
35  const int database_id,
37  SqliteConnector& sqlite);
38 
39  static bool dropRenderGroupColumns(
40  const Catalog_Namespace::TableDescriptorMapById& table_descriptors_by_id,
42 
43  static void executeRebrandMigration(const std::string& base_path);
44 
45  static void takeMigrationLock(const std::string& base_path);
46  static void relaxMigrationLock();
47  static bool migrationEnabled() { return migration_enabled_; }
48 
49  static void destroy() {
50  if (migration_mutex_) {
51  migration_mutex_->unlock();
52  migration_mutex_.reset();
53  }
54  }
55 
56  private:
57  static inline std::unique_ptr<heavyai::DistributedSharedMutex> migration_mutex_;
58  static inline bool migration_enabled_{false};
59 };
60 
61 } // namespace migrations
std::string cat(Ts &&...args)
class for a per-database catalog. also includes metadata for the current database and the current use...
Definition: Catalog.h:143
static bool dropRenderGroupColumns(const Catalog_Namespace::TableDescriptorMapById &table_descriptors_by_id, Catalog_Namespace::Catalog *cat)
static void relaxMigrationLock()
std::map< int, TableDescriptor * > TableDescriptorMapById
Definition: Types.h:35
static bool migration_enabled_
Definition: MigrationMgr.h:58
static bool migrationEnabled()
Definition: MigrationMgr.h:47
static void executeRebrandMigration(const std::string &base_path)
static void takeMigrationLock(const std::string &base_path)
static void migrateDateInDaysMetadata(const Catalog_Namespace::TableDescriptorMapById &table_descriptors_by_id, const int database_id, Catalog_Namespace::Catalog *cat, SqliteConnector &sqlite)
static std::unique_ptr< heavyai::DistributedSharedMutex > migration_mutex_
Definition: MigrationMgr.h:57