ClickHouse/src/Common/renameat2.h

21 lines
679 B
C++
Raw Normal View History

2020-03-23 00:12:13 +00:00
#pragma once
#include <string>
2020-04-08 01:02:00 +00:00
2020-03-23 00:12:13 +00:00
namespace DB
{
2020-04-09 22:22:43 +00:00
/// Returns true, if the following functions supported by the system
bool supportsRenameat2();
2020-03-23 00:12:13 +00:00
/// Atomically rename old_path to new_path. If new_path exists, do not overwrite it and throw exception
void renameNoReplace(const std::string & old_path, const std::string & new_path);
/// Atomically exchange oldpath and newpath. Throw exception if some of them does not exist
void renameExchange(const std::string & old_path, const std::string & new_path);
2020-09-19 14:19:06 +00:00
/// Returns false instead of throwing exception if renameat2 is not supported
bool renameExchangeIfSupported(const std::string & old_path, const std::string & new_path);
2020-03-23 00:12:13 +00:00
}