2020-07-29 15:05:02 +00:00
|
|
|
#include "DiskDecorator.h"
|
|
|
|
#include <IO/ReadBufferFromFileBase.h>
|
|
|
|
#include <IO/WriteBufferFromFileBase.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
DiskDecorator::DiskDecorator(const DiskPtr & delegate_) : delegate(delegate_)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
const String & DiskDecorator::getName() const
|
|
|
|
{
|
|
|
|
return delegate->getName();
|
|
|
|
}
|
|
|
|
|
|
|
|
ReservationPtr DiskDecorator::reserve(UInt64 bytes)
|
|
|
|
{
|
|
|
|
return delegate->reserve(bytes);
|
|
|
|
}
|
|
|
|
|
|
|
|
const String & DiskDecorator::getPath() const
|
|
|
|
{
|
|
|
|
return delegate->getPath();
|
|
|
|
}
|
|
|
|
|
|
|
|
UInt64 DiskDecorator::getTotalSpace() const
|
|
|
|
{
|
|
|
|
return delegate->getTotalSpace();
|
|
|
|
}
|
|
|
|
|
|
|
|
UInt64 DiskDecorator::getAvailableSpace() const
|
|
|
|
{
|
|
|
|
return delegate->getAvailableSpace();
|
|
|
|
}
|
|
|
|
|
|
|
|
UInt64 DiskDecorator::getUnreservedSpace() const
|
|
|
|
{
|
|
|
|
return delegate->getUnreservedSpace();
|
|
|
|
}
|
|
|
|
|
|
|
|
UInt64 DiskDecorator::getKeepingFreeSpace() const
|
|
|
|
{
|
|
|
|
return delegate->getKeepingFreeSpace();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool DiskDecorator::exists(const String & path) const
|
|
|
|
{
|
|
|
|
return delegate->exists(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool DiskDecorator::isFile(const String & path) const
|
|
|
|
{
|
|
|
|
return delegate->isFile(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool DiskDecorator::isDirectory(const String & path) const
|
|
|
|
{
|
|
|
|
return delegate->isDirectory(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t DiskDecorator::getFileSize(const String & path) const
|
|
|
|
{
|
|
|
|
return delegate->getFileSize(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DiskDecorator::createDirectory(const String & path)
|
|
|
|
{
|
|
|
|
delegate->createDirectory(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DiskDecorator::createDirectories(const String & path)
|
|
|
|
{
|
|
|
|
delegate->createDirectories(path);
|
|
|
|
}
|
|
|
|
|
2020-10-23 12:01:50 +00:00
|
|
|
void DiskDecorator::clearDirectory(const String & path)
|
2020-07-29 15:05:02 +00:00
|
|
|
{
|
2020-10-23 12:01:50 +00:00
|
|
|
delegate->clearDirectory(path);
|
2020-07-29 15:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DiskDecorator::moveDirectory(const String & from_path, const String & to_path)
|
|
|
|
{
|
|
|
|
delegate->moveDirectory(from_path, to_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
DiskDirectoryIteratorPtr DiskDecorator::iterateDirectory(const String & path)
|
|
|
|
{
|
|
|
|
return delegate->iterateDirectory(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DiskDecorator::createFile(const String & path)
|
|
|
|
{
|
|
|
|
delegate->createFile(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DiskDecorator::moveFile(const String & from_path, const String & to_path)
|
|
|
|
{
|
|
|
|
delegate->moveFile(from_path, to_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DiskDecorator::replaceFile(const String & from_path, const String & to_path)
|
|
|
|
{
|
|
|
|
delegate->replaceFile(from_path, to_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DiskDecorator::copy(const String & from_path, const std::shared_ptr<IDisk> & to_disk, const String & to_path)
|
|
|
|
{
|
|
|
|
delegate->copy(from_path, to_disk, to_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DiskDecorator::listFiles(const String & path, std::vector<String> & file_names)
|
|
|
|
{
|
|
|
|
delegate->listFiles(path, file_names);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<ReadBufferFromFileBase>
|
2021-03-28 01:10:30 +00:00
|
|
|
DiskDecorator::readFile(
|
2022-01-03 18:36:34 +00:00
|
|
|
const String & path, const ReadSettings & settings, std::optional<size_t> read_hint, std::optional<size_t> file_size) const
|
2020-07-29 15:05:02 +00:00
|
|
|
{
|
2022-01-03 18:36:34 +00:00
|
|
|
return delegate->readFile(path, settings, read_hint, file_size);
|
2020-07-29 15:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<WriteBufferFromFileBase>
|
2022-03-14 18:40:53 +00:00
|
|
|
DiskDecorator::writeFile(const String & path, size_t buf_size, WriteMode mode, const WriteSettings & settings)
|
2020-07-29 15:05:02 +00:00
|
|
|
{
|
2022-03-14 18:40:53 +00:00
|
|
|
return delegate->writeFile(path, buf_size, mode, settings);
|
2020-07-29 15:05:02 +00:00
|
|
|
}
|
|
|
|
|
2021-01-14 16:24:13 +00:00
|
|
|
void DiskDecorator::removeFile(const String & path)
|
2020-07-29 15:05:02 +00:00
|
|
|
{
|
2021-01-14 16:24:13 +00:00
|
|
|
delegate->removeFile(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DiskDecorator::removeFileIfExists(const String & path)
|
|
|
|
{
|
|
|
|
delegate->removeFileIfExists(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DiskDecorator::removeDirectory(const String & path)
|
|
|
|
{
|
|
|
|
delegate->removeDirectory(path);
|
2020-07-29 15:05:02 +00:00
|
|
|
}
|
|
|
|
|
2020-10-23 12:01:50 +00:00
|
|
|
void DiskDecorator::removeRecursive(const String & path)
|
2020-07-29 15:05:02 +00:00
|
|
|
{
|
2020-10-23 12:01:50 +00:00
|
|
|
delegate->removeRecursive(path);
|
|
|
|
}
|
|
|
|
|
2021-01-20 09:48:22 +00:00
|
|
|
void DiskDecorator::removeSharedFile(const String & path, bool keep_s3)
|
2020-10-23 12:01:50 +00:00
|
|
|
{
|
2021-01-20 09:48:22 +00:00
|
|
|
delegate->removeSharedFile(path, keep_s3);
|
2020-10-23 12:01:50 +00:00
|
|
|
}
|
|
|
|
|
2022-04-18 23:09:09 +00:00
|
|
|
void DiskDecorator::removeSharedFiles(const RemoveBatchRequest & files, bool keep_all_batch_metadata, const NameSet & file_names_remove_metadata_only)
|
2022-02-01 10:36:51 +00:00
|
|
|
{
|
2022-04-18 23:09:09 +00:00
|
|
|
delegate->removeSharedFiles(files, keep_all_batch_metadata, file_names_remove_metadata_only);
|
2022-02-01 10:36:51 +00:00
|
|
|
}
|
|
|
|
|
2022-04-18 23:09:09 +00:00
|
|
|
void DiskDecorator::removeSharedRecursive(const String & path, bool keep_all_batch_metadata, const NameSet & file_names_remove_metadata_only)
|
2020-10-23 12:01:50 +00:00
|
|
|
{
|
2022-04-18 23:09:09 +00:00
|
|
|
delegate->removeSharedRecursive(path, keep_all_batch_metadata, file_names_remove_metadata_only);
|
2020-07-29 15:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DiskDecorator::setLastModified(const String & path, const Poco::Timestamp & timestamp)
|
|
|
|
{
|
|
|
|
delegate->setLastModified(path, timestamp);
|
|
|
|
}
|
|
|
|
|
|
|
|
Poco::Timestamp DiskDecorator::getLastModified(const String & path)
|
|
|
|
{
|
|
|
|
return delegate->getLastModified(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DiskDecorator::setReadOnly(const String & path)
|
|
|
|
{
|
|
|
|
delegate->setReadOnly(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DiskDecorator::createHardLink(const String & src_path, const String & dst_path)
|
|
|
|
{
|
|
|
|
delegate->createHardLink(src_path, dst_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DiskDecorator::truncateFile(const String & path, size_t size)
|
|
|
|
{
|
|
|
|
delegate->truncateFile(path, size);
|
|
|
|
}
|
|
|
|
|
2021-01-26 13:29:45 +00:00
|
|
|
Executor & DiskDecorator::getExecutor()
|
2020-08-24 13:09:23 +00:00
|
|
|
{
|
2021-01-26 13:29:45 +00:00
|
|
|
return delegate->getExecutor();
|
2020-08-24 13:09:23 +00:00
|
|
|
}
|
|
|
|
|
2021-01-26 13:29:45 +00:00
|
|
|
SyncGuardPtr DiskDecorator::getDirectorySyncGuard(const String & path) const
|
2020-08-24 13:09:23 +00:00
|
|
|
{
|
2021-01-26 13:29:45 +00:00
|
|
|
return delegate->getDirectorySyncGuard(path);
|
2020-08-24 13:09:23 +00:00
|
|
|
}
|
|
|
|
|
2021-01-12 17:18:40 +00:00
|
|
|
void DiskDecorator::onFreeze(const String & path)
|
2020-10-07 11:35:28 +00:00
|
|
|
{
|
2021-01-12 17:18:40 +00:00
|
|
|
delegate->onFreeze(path);
|
2020-10-07 11:35:28 +00:00
|
|
|
}
|
|
|
|
|
2021-04-20 18:29:03 +00:00
|
|
|
void DiskDecorator::shutdown()
|
|
|
|
{
|
|
|
|
delegate->shutdown();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DiskDecorator::startup()
|
|
|
|
{
|
|
|
|
delegate->startup();
|
|
|
|
}
|
|
|
|
|
2021-06-18 05:28:08 +00:00
|
|
|
void DiskDecorator::applyNewSettings(const Poco::Util::AbstractConfiguration & config, ContextPtr context, const String & config_prefix, const DisksMap & map)
|
2021-04-20 18:29:03 +00:00
|
|
|
{
|
2021-05-14 21:48:34 +00:00
|
|
|
delegate->applyNewSettings(config, context, config_prefix, map);
|
2021-04-20 18:29:03 +00:00
|
|
|
}
|
|
|
|
|
2020-07-29 15:05:02 +00:00
|
|
|
}
|