shared utility for mapd_server and string dictionary server to remove old files
More...
Go to the source code of this file.
|
void | file_delete (std::atomic< bool > &program_is_running, const unsigned int wait_interval_seconds, const std::string base_path) |
|
shared utility for mapd_server and string dictionary server to remove old files
- Author
- micha.nosp@m.el@o.nosp@m.mnisc.nosp@m.i.co.nosp@m.m>
Definition in file file_delete.h.
void file_delete |
( |
std::atomic< bool > & |
program_is_running, |
|
|
const unsigned int |
wait_interval_seconds, |
|
|
const std::string |
base_path |
|
) |
| |
Definition at line 228 of file File.cpp.
References logger::ERROR, error_code, logger::INFO, and LOG.
Referenced by startMapdServer().
231 const auto wait_duration = std::chrono::seconds(wait_interval_seconds);
232 const boost::filesystem::path path(base_path);
233 while (program_is_running) {
234 using vec = std::vector<boost::filesystem::path>;
240 copy(boost::filesystem::directory_iterator(path),
241 boost::filesystem::directory_iterator(),
243 for (vec::const_iterator it(v.begin()); it != v.end(); ++it) {
244 std::string object_name(it->string());
246 if (boost::algorithm::ends_with(object_name,
"DELETE_ME")) {
247 LOG(
INFO) <<
" removing object " << object_name;
248 boost::filesystem::remove_all(*it, ec);
249 if (ec.value() != boost::system::errc::success) {
250 LOG(
ERROR) <<
"Failed to remove object " << object_name <<
" error was " << ec;
255 std::this_thread::sleep_for(wait_duration);
const int8_t const int64_t const uint64_t const int32_t const int64_t int64_t uint32_t const int64_t int32_t * error_code