OmniSciDB  085a039ca4
 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 133 of file SysCatalog.cpp.

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

133  {
134  return base_path_ + "/" + shared::kCatalogDirectoryName + "/" + name;
135 };
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 145 of file SysCatalog.cpp.

References logger::ERROR, and LOG.

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

146  {
147  auto full_current_path = assembleCatalogName(current_name);
148  auto full_new_path = assembleCatalogName(new_name);
149 
150  try {
151  boost::filesystem::copy_file(full_current_path, full_new_path);
152  } catch (std::exception& e) {
153  std::string err_message{"Could not copy file " + full_current_path + " to " +
154  full_new_path + " exception was " + e.what()};
155  LOG(ERROR) << err_message;
156  throw std::runtime_error(err_message);
157  }
158 
159  return std::make_pair(full_current_path, full_new_path);
160 };
#define LOG(tag)
Definition: Logger.h:217
auto assembleCatalogName(std::string const &name)
Definition: SysCatalog.cpp:133

+ Here is the caller graph for this function:

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

Definition at line 137 of file SysCatalog.cpp.

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

137  {
138  boost::filesystem::remove(full_path);
139 }

+ Here is the caller graph for this function:

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

Definition at line 141 of file SysCatalog.cpp.

141  {
142  boost::filesystem::remove(assembleCatalogName(name));
143 };
auto assembleCatalogName(std::string const &name)
Definition: SysCatalog.cpp:133
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: