OmniSciDB  c1a53651b2
 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 void executeRebrandMigration(const std::string& base_path);
40 
41  static void takeMigrationLock(const std::string& base_path);
42  static void relaxMigrationLock();
43  static bool migrationEnabled() { return migration_enabled_; }
44 
45  static void destroy() {
46  if (migration_mutex_) {
47  migration_mutex_->unlock();
48  migration_mutex_.reset();
49  }
50  }
51 
52  private:
53  static inline std::unique_ptr<heavyai::DistributedSharedMutex> migration_mutex_;
54  static inline bool migration_enabled_{false};
55 };
56 
57 } // 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:132
static void relaxMigrationLock()
std::map< int, TableDescriptor * > TableDescriptorMapById
Definition: Types.h:35
static bool migration_enabled_
Definition: MigrationMgr.h:54
static bool migrationEnabled()
Definition: MigrationMgr.h:43
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:53