OmniSciDB  fe05a0c208
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 131 of file SysCatalog.h.

Constructor & Destructor Documentation

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

Definition at line 133 of file SysCatalog.h.

133 : base_path_(base_path) {}

Member Function Documentation

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

Definition at line 129 of file SysCatalog.cpp.

References setup::name.

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

References logger::ERROR, and LOG.

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

Definition at line 133 of file SysCatalog.cpp.

133  {
134  boost::filesystem::remove(full_path);
135 }
void Catalog_Namespace::CommonFileOperations::removeCatalogByName ( std::string const name)
inline

Definition at line 137 of file SysCatalog.cpp.

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

Member Data Documentation

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

Definition at line 142 of file SysCatalog.h.


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