OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Catalog_Namespace::CommonFileOperations Class Reference

#include <SysCatalog.h>

+ Inheritance diagram for Catalog_Namespace::CommonFileOperations:

Public Member Functions

 CommonFileOperations (std::string const &base_path)
 
void removeCatalogByFullPath (std::string const &full_path)
 
void removeCatalogByName (std::string const &name)
 
auto duplicateAndRenameCatalog (std::string const &current_name, std::string const &new_name)
 
auto assembleCatalogName (std::string const &name)
 

Private Attributes

std::string const & base_path_
 

Detailed Description

Definition at line 147 of file SysCatalog.h.

Constructor & Destructor Documentation

Catalog_Namespace::CommonFileOperations::CommonFileOperations ( std::string const &  base_path)
inline

Definition at line 149 of file SysCatalog.h.

149 : base_path_(base_path) {}

Member Function Documentation

auto Catalog_Namespace::CommonFileOperations::assembleCatalogName ( std::string const &  name)
inline

Definition at line 162 of file SysCatalog.cpp.

References shared::kCatalogDirectoryName, and setup::name.

162  {
163  return base_path_ + "/" + shared::kCatalogDirectoryName + "/" + name;
164 };
const std::string kCatalogDirectoryName
string name
Definition: setup.in.py:72
auto Catalog_Namespace::CommonFileOperations::duplicateAndRenameCatalog ( std::string const &  current_name,
std::string const &  new_name 
)
inline

Definition at line 174 of file SysCatalog.cpp.

References logger::ERROR, and LOG.

Referenced by Catalog_Namespace::SysCatalog::renameDatabase().

175  {
176  auto full_current_path = assembleCatalogName(current_name);
177  auto full_new_path = assembleCatalogName(new_name);
178 
179  try {
180  boost::filesystem::copy_file(full_current_path, full_new_path);
181  } catch (std::exception& e) {
182  std::string err_message{"Could not copy file " + full_current_path + " to " +
183  full_new_path + " exception was " + e.what()};
184  LOG(ERROR) << err_message;
185  throw std::runtime_error(err_message);
186  }
187 
188  return std::make_pair(full_current_path, full_new_path);
189 };
#define LOG(tag)
Definition: Logger.h:285
auto assembleCatalogName(std::string const &name)
Definition: SysCatalog.cpp:162

+ Here is the caller graph for this function:

void Catalog_Namespace::CommonFileOperations::removeCatalogByFullPath ( std::string const &  full_path)
inline

Definition at line 166 of file SysCatalog.cpp.

Referenced by Catalog_Namespace::SysCatalog::renameDatabase().

166  {
167  boost::filesystem::remove(full_path);
168 }

+ Here is the caller graph for this function:

void Catalog_Namespace::CommonFileOperations::removeCatalogByName ( std::string const &  name)
inline

Definition at line 170 of file SysCatalog.cpp.

170  {
171  boost::filesystem::remove(assembleCatalogName(name));
172 };
auto assembleCatalogName(std::string const &name)
Definition: SysCatalog.cpp:162
string name
Definition: setup.in.py:72

Member Data Documentation

std::string const& Catalog_Namespace::CommonFileOperations::base_path_
private

Definition at line 158 of file SysCatalog.h.


The documentation for this class was generated from the following files: