aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Common/atomicRename.h
blob: 6da8a8f623bf56b5c6908dc0e748316cc0b8d327 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#pragma once
#include <string>


namespace DB
{

/// Returns true, if the following functions supported by the system
bool supportsAtomicRename();

/// 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);

/// Returns false instead of throwing exception if renameat2 is not supported
bool renameExchangeIfSupported(const std::string & old_path, const std::string & new_path);

}