2020-07-29 15:05:02 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Disks/IDisk.h"
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2020-10-20 01:29:13 +00:00
|
|
|
|
|
|
|
/** Forwards all methods to another disk.
|
|
|
|
* Methods can be overridden by descendants.
|
|
|
|
*/
|
2020-07-29 15:05:02 +00:00
|
|
|
class DiskDecorator : public IDisk
|
|
|
|
{
|
|
|
|
public:
|
2020-07-29 18:15:20 +00:00
|
|
|
explicit DiskDecorator(const DiskPtr & delegate_);
|
2020-07-29 15:05:02 +00:00
|
|
|
const String & getName() const override;
|
|
|
|
ReservationPtr reserve(UInt64 bytes) override;
|
|
|
|
~DiskDecorator() override = default;
|
|
|
|
const String & getPath() const override;
|
|
|
|
UInt64 getTotalSpace() const override;
|
|
|
|
UInt64 getAvailableSpace() const override;
|
|
|
|
UInt64 getUnreservedSpace() const override;
|
|
|
|
UInt64 getKeepingFreeSpace() const override;
|
|
|
|
bool exists(const String & path) const override;
|
|
|
|
bool isFile(const String & path) const override;
|
|
|
|
bool isDirectory(const String & path) const override;
|
|
|
|
size_t getFileSize(const String & path) const override;
|
|
|
|
void createDirectory(const String & path) override;
|
|
|
|
void createDirectories(const String & path) override;
|
2020-10-23 12:01:50 +00:00
|
|
|
void clearDirectory(const String & path) override;
|
2020-07-29 15:05:02 +00:00
|
|
|
void moveDirectory(const String & from_path, const String & to_path) override;
|
|
|
|
DiskDirectoryIteratorPtr iterateDirectory(const String & path) override;
|
|
|
|
void createFile(const String & path) override;
|
|
|
|
void moveFile(const String & from_path, const String & to_path) override;
|
|
|
|
void replaceFile(const String & from_path, const String & to_path) override;
|
|
|
|
void copyFile(const String & from_path, const String & to_path) override;
|
|
|
|
void copy(const String & from_path, const std::shared_ptr<IDisk> & to_disk, const String & to_path) override;
|
|
|
|
void listFiles(const String & path, std::vector<String> & file_names) override;
|
|
|
|
std::unique_ptr<ReadBufferFromFileBase>
|
|
|
|
readFile(const String & path, size_t buf_size, size_t estimated_size, size_t aio_threshold, size_t mmap_threshold) const override;
|
|
|
|
std::unique_ptr<WriteBufferFromFileBase>
|
|
|
|
writeFile(const String & path, size_t buf_size, WriteMode mode, size_t estimated_size, size_t aio_threshold) override;
|
2020-10-23 12:01:50 +00:00
|
|
|
void remove(const String & path) override;
|
|
|
|
void removeRecursive(const String & path) override;
|
|
|
|
void removeShared(const String & path, bool keep_s3) override;
|
|
|
|
void removeSharedRecursive(const String & path, bool keep_s3) override;
|
2020-07-29 15:05:02 +00:00
|
|
|
void setLastModified(const String & path, const Poco::Timestamp & timestamp) override;
|
|
|
|
Poco::Timestamp getLastModified(const String & path) override;
|
|
|
|
void setReadOnly(const String & path) override;
|
|
|
|
void createHardLink(const String & src_path, const String & dst_path) override;
|
|
|
|
void truncateFile(const String & path, size_t size) override;
|
2020-08-24 13:09:23 +00:00
|
|
|
int open(const String & path, mode_t mode) const override;
|
|
|
|
void close(int fd) const override;
|
|
|
|
void sync(int fd) const override;
|
2020-07-30 13:42:05 +00:00
|
|
|
const String getType() const override { return delegate->getType(); }
|
2020-10-22 09:32:05 +00:00
|
|
|
String getUniqueId(const String & path) const override { return delegate->getUniqueId(path); }
|
2020-10-14 15:05:59 +00:00
|
|
|
bool checkFile(const String & path) const override { return delegate->checkFile(path); }
|
2020-10-07 11:35:28 +00:00
|
|
|
Executor & getExecutor() override;
|
2020-07-29 15:05:02 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
DiskPtr delegate;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|