shared utility for the db 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 the db server and string dictionary server to remove old files
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 304 of file File.cpp.
References gpu_enabled::copy(), logger::ERROR, logger::INFO, and LOG.
Referenced by startHeavyDBServer().
307 const auto wait_duration = std::chrono::seconds(wait_interval_seconds);
308 const boost::filesystem::path path(base_path);
309 while (program_is_running) {
310 using vec = std::vector<boost::filesystem::path>;
312 boost::system::error_code ec;
316 copy(boost::filesystem::directory_iterator(path),
317 boost::filesystem::directory_iterator(),
319 for (vec::const_iterator it(v.begin()); it != v.end(); ++it) {
320 std::string object_name(it->string());
322 if (boost::algorithm::ends_with(object_name,
"DELETE_ME")) {
323 LOG(
INFO) <<
" removing object " << object_name;
324 boost::filesystem::remove_all(*it, ec);
325 if (ec.value() != boost::system::errc::success) {
326 LOG(
ERROR) <<
"Failed to remove object " << object_name <<
" error was " << ec;
331 std::this_thread::sleep_for(wait_duration);
DEVICE auto copy(ARGS &&...args)