OmniSciDB  0fdbebe030
 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 const & base_path_
 

Detailed Description

Definition at line 122 of file SysCatalog.h.

Constructor & Destructor Documentation

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

Definition at line 124 of file SysCatalog.h.

124 : base_path_(base_path) {}

Member Function Documentation

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

Definition at line 83 of file SysCatalog.cpp.

83  {
84  return base_path_ + "/mapd_catalogs/" + name;
85 };
auto Catalog_Namespace::CommonFileOperations::duplicateAndRenameCatalog ( std::string const &  current_name,
std::string const &  new_name 
)
inline

Definition at line 95 of file SysCatalog.cpp.

References logger::ERROR, and LOG.

96  {
97  auto full_current_path = assembleCatalogName(current_name);
98  auto full_new_path = assembleCatalogName(new_name);
99 
100  try {
101  boost::filesystem::copy_file(full_current_path, full_new_path);
102  } catch (std::exception& e) {
103  std::string err_message{"Could not copy file " + full_current_path + " to " +
104  full_new_path + " exception was " + e.what()};
105  LOG(ERROR) << err_message;
106  throw std::runtime_error(err_message);
107  }
108 
109  return std::make_pair(full_current_path, full_new_path);
110 };
#define LOG(tag)
Definition: Logger.h:188
auto assembleCatalogName(std::string const &name)
Definition: SysCatalog.cpp:83
void Catalog_Namespace::CommonFileOperations::removeCatalogByFullPath ( std::string const &  full_path)
inline

Definition at line 87 of file SysCatalog.cpp.

87  {
88  boost::filesystem::remove(full_path);
89 }
void Catalog_Namespace::CommonFileOperations::removeCatalogByName ( std::string const &  name)
inline

Definition at line 91 of file SysCatalog.cpp.

91  {
92  boost::filesystem::remove(assembleCatalogName(name));
93 };
auto assembleCatalogName(std::string const &name)
Definition: SysCatalog.cpp:83

Member Data Documentation

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

Definition at line 133 of file SysCatalog.h.


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