2022-04-05 19:12:48 +00:00
|
|
|
#pragma once
|
|
|
|
#include <Storages/MergeTree/IDataPartStorage.h>
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class IVolume;
|
|
|
|
using VolumePtr = std::shared_ptr<IVolume>;
|
|
|
|
|
|
|
|
|
|
|
|
class DataPartStorageOnDisk final : public IDataPartStorage
|
|
|
|
{
|
|
|
|
public:
|
2022-04-07 11:58:38 +00:00
|
|
|
explicit DataPartStorageOnDisk(VolumePtr volume_, std::string root_path_);
|
2022-04-05 19:12:48 +00:00
|
|
|
|
|
|
|
std::unique_ptr<ReadBufferFromFileBase> readFile(
|
|
|
|
const std::string & path,
|
|
|
|
const ReadSettings & settings,
|
|
|
|
std::optional<size_t> read_hint,
|
|
|
|
std::optional<size_t> file_size) const override;
|
|
|
|
|
|
|
|
bool exists(const std::string & path) const override;
|
|
|
|
bool exists() const override;
|
|
|
|
|
2022-04-08 18:56:08 +00:00
|
|
|
Poco::Timestamp getLastModified() const override;
|
|
|
|
|
2022-04-05 19:12:48 +00:00
|
|
|
size_t getFileSize(const std::string & path) const override;
|
|
|
|
|
|
|
|
DiskDirectoryIteratorPtr iterate() const override;
|
|
|
|
DiskDirectoryIteratorPtr iterateDirectory(const std::string & path) const override;
|
|
|
|
|
2022-04-07 11:58:38 +00:00
|
|
|
std::string getFullPath() const override;
|
|
|
|
std::string getFullRelativePath() const override { return root_path; }
|
2022-04-05 19:12:48 +00:00
|
|
|
|
|
|
|
UInt64 calculateTotalSizeOnDisk() const override;
|
|
|
|
|
2022-04-07 17:44:49 +00:00
|
|
|
bool isStoredOnRemoteDisk() const override;
|
2022-04-08 18:56:08 +00:00
|
|
|
bool supportZeroCopyReplication() const override;
|
2022-04-07 17:44:49 +00:00
|
|
|
|
2022-04-05 19:12:48 +00:00
|
|
|
void writeChecksums(MergeTreeDataPartChecksums & checksums) const override;
|
|
|
|
void writeColumns(NamesAndTypesList & columns) const override;
|
2022-04-08 18:56:08 +00:00
|
|
|
void writeDeleteOnDestroyMarker(Poco::Logger * log) const override;
|
2022-04-05 19:12:48 +00:00
|
|
|
|
2022-04-07 17:44:49 +00:00
|
|
|
bool shallParticipateInMerges(const IStoragePolicy &) const override;
|
2022-04-07 11:58:38 +00:00
|
|
|
|
|
|
|
void rename(const String & new_relative_path, Poco::Logger * log, bool remove_new_dir_if_exists, bool fsync) override;
|
|
|
|
|
2022-04-05 19:12:48 +00:00
|
|
|
std::string getName() const override;
|
|
|
|
|
|
|
|
DataPartStoragePtr getProjection(const std::string & name) const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
VolumePtr volume;
|
|
|
|
std::string root_path;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|