2022-04-17 12:11:43 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Core/Types.h>
|
2022-08-19 14:58:30 +00:00
|
|
|
#include <Disks/DiskType.h>
|
2022-08-21 16:18:35 +00:00
|
|
|
#include <Disks/IDisk.h>
|
2022-04-17 12:11:43 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
class SeekableReadBuffer;
|
|
|
|
class WriteBuffer;
|
|
|
|
|
|
|
|
/// Represents operations of loading from disk or downloading for reading a backup.
|
2022-07-27 08:36:56 +00:00
|
|
|
class IBackupReader /// BackupReaderFile, BackupReaderDisk
|
2022-04-17 12:11:43 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~IBackupReader() = default;
|
|
|
|
virtual bool fileExists(const String & file_name) = 0;
|
2022-07-27 08:36:56 +00:00
|
|
|
virtual UInt64 getFileSize(const String & file_name) = 0;
|
2022-04-17 12:11:43 +00:00
|
|
|
virtual std::unique_ptr<SeekableReadBuffer> readFile(const String & file_name) = 0;
|
2022-08-19 14:58:30 +00:00
|
|
|
virtual DataSourceDescription getDataSourceDescription() const = 0;
|
2022-04-17 12:11:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/// Represents operations of storing to disk or uploading for writing a backup.
|
2022-07-27 08:36:56 +00:00
|
|
|
class IBackupWriter /// BackupWriterFile, BackupWriterDisk
|
2022-04-17 12:11:43 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~IBackupWriter() = default;
|
|
|
|
virtual bool fileExists(const String & file_name) = 0;
|
2022-07-27 08:36:56 +00:00
|
|
|
virtual UInt64 getFileSize(const String & file_name) = 0;
|
2022-07-15 07:42:56 +00:00
|
|
|
virtual bool fileContentsEqual(const String & file_name, const String & expected_file_contents) = 0;
|
2022-04-17 12:11:43 +00:00
|
|
|
virtual std::unique_ptr<WriteBuffer> writeFile(const String & file_name) = 0;
|
2022-07-15 07:42:56 +00:00
|
|
|
virtual void removeFiles(const Strings & file_names) = 0;
|
2022-08-19 14:58:30 +00:00
|
|
|
virtual DataSourceDescription getDataSourceDescription() const = 0;
|
2022-08-19 11:31:25 +00:00
|
|
|
virtual void copyFileThroughBuffer(std::unique_ptr<SeekableReadBuffer> && source, const String & file_name);
|
2022-08-19 14:58:30 +00:00
|
|
|
|
|
|
|
virtual bool supportNativeCopy(DataSourceDescription /* data_source_description */) const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2022-08-24 15:45:20 +00:00
|
|
|
virtual void copyFileNative(DiskPtr from_disk, const String & file_name_from, const String & file_name_to);
|
2022-04-17 12:11:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|