mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-10-17 22:10:54 +00:00
28 lines
591 B
C++
28 lines
591 B
C++
|
#include <Common/filesystemHelpers.h>
|
||
|
#include <common/config_common.h>
|
||
|
#include <Poco/File.h>
|
||
|
#include <Poco/Path.h>
|
||
|
|
||
|
namespace DB
|
||
|
{
|
||
|
|
||
|
bool checkFreeSpace(const std::string & path, size_t data_size)
|
||
|
{
|
||
|
#if !UNBUNDLED
|
||
|
auto free_space = Poco::File(path).freeSpace();
|
||
|
if (data_size > free_space)
|
||
|
return false;
|
||
|
#endif
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
std::unique_ptr<TemporaryFile> createTemporaryFile(const std::string & path)
|
||
|
{
|
||
|
Poco::File(path).createDirectories();
|
||
|
|
||
|
/// NOTE: std::make_shared cannot use protected constructors
|
||
|
return std::make_unique<TemporaryFile>(path);
|
||
|
}
|
||
|
|
||
|
}
|