OmniSciDB  b24e664e58
 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 123 of file SysCatalog.h.

Constructor & Destructor Documentation

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

Definition at line 125 of file SysCatalog.h.

125 : base_path_(base_path) {}

Member Function Documentation

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

Definition at line 78 of file SysCatalog.cpp.

References base_path_.

Referenced by duplicateAndRenameCatalog(), and removeCatalogByName().

78  {
79  return base_path_ + "/mapd_catalogs/" + name;
80 };

+ Here is the caller graph for this function:

auto Catalog_Namespace::CommonFileOperations::duplicateAndRenameCatalog ( std::string const &  current_name,
std::string const &  new_name 
)
inline

Definition at line 90 of file SysCatalog.cpp.

References assembleCatalogName(), logger::ERROR, and LOG.

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

91  {
92  auto full_current_path = assembleCatalogName(current_name);
93  auto full_new_path = assembleCatalogName(new_name);
94 
95  try {
96  boost::filesystem::copy_file(full_current_path, full_new_path);
97  } catch (std::exception& e) {
98  std::string err_message{"Could not copy file " + full_current_path + " to " +
99  full_new_path + " exception was " + e.what()};
100  LOG(ERROR) << err_message;
101  throw std::runtime_error(err_message);
102  }
103 
104  return std::make_pair(full_current_path, full_new_path);
105 };
#define LOG(tag)
Definition: Logger.h:185
auto assembleCatalogName(std::string const &name)
Definition: SysCatalog.cpp:78

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 82 of file SysCatalog.cpp.

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

82  {
83  boost::filesystem::remove(full_path);
84 }

+ Here is the caller graph for this function:

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

Definition at line 86 of file SysCatalog.cpp.

References assembleCatalogName().

86  {
87  boost::filesystem::remove(assembleCatalogName(name));
88 };
auto assembleCatalogName(std::string const &name)
Definition: SysCatalog.cpp:78

+ Here is the call graph for this function:

Member Data Documentation

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

Definition at line 134 of file SysCatalog.h.

Referenced by assembleCatalogName().


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