OmniSciDB  471d68cefb
 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 constbase_path_
 

Detailed Description

Definition at line 153 of file SysCatalog.h.

Constructor & Destructor Documentation

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

Definition at line 155 of file SysCatalog.h.

155 : base_path_(base_path) {}

Member Function Documentation

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

Definition at line 131 of file SysCatalog.cpp.

References setup::name.

131  {
132  return base_path_ + "/mapd_catalogs/" + name;
133 };
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 143 of file SysCatalog.cpp.

References logger::ERROR, and LOG.

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

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

+ Here is the caller graph for this function:

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

Definition at line 135 of file SysCatalog.cpp.

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

135  {
136  boost::filesystem::remove(full_path);
137 }

+ Here is the caller graph for this function:

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

Definition at line 139 of file SysCatalog.cpp.

139  {
140  boost::filesystem::remove(assembleCatalogName(name));
141 };
string name
Definition: setup.in.py:72
auto assembleCatalogName(std::string const &name)
Definition: SysCatalog.cpp:131

Member Data Documentation

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

Definition at line 164 of file SysCatalog.h.


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