ClickHouse/src/Storages/MergeTree/DataPartStorageOnDisk.h

95 lines
2.8 KiB
C++
Raw Normal View History

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-12 18:59:49 +00:00
DataPartStorageOnDisk(VolumePtr volume_, std::string root_path_, std::string part_dir_);
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;
2022-04-12 18:59:49 +00:00
std::string getFullRelativePath() const override;
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;
2022-04-12 18:59:49 +00:00
std::string part_dir;
};
class DataPartStorageBuilderOnDisk final : public IDataPartStorageBuilder
{
DataPartStorageBuilderOnDisk(VolumePtr volume_, std::string root_path_, std::string part_dir_);
bool exists() const override;
bool exists(const std::string & path) const override;
void createDirectories() override;
std::string getFullPath() const override;
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;
std::unique_ptr<WriteBufferFromFileBase> writeFile(
const String & path,
size_t buf_size) override;
void removeFile(const String & path) override;
void removeRecursive() override;
ReservationPtr reserve(UInt64 bytes) override;
DataPartStorageBuilderPtr getProjection(const std::string & name) const override;
private:
VolumePtr volume;
std::string root_path;
std::string part_dir;
2022-04-05 19:12:48 +00:00
};
}