1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#pragma once
#include "Storages/MergeTree/IDataPartStorage.h"
#include <Storages/MergeTree/DataPartStorageOnDiskBase.h>
namespace DB
{
/// A storage for data part that stores files on filesystem as is.
class DataPartStorageOnDiskFull final : public DataPartStorageOnDiskBase
{
public:
DataPartStorageOnDiskFull(VolumePtr volume_, std::string root_path_, std::string part_dir_);
MergeTreeDataPartStorageType getType() const override { return MergeTreeDataPartStorageType::Full; }
MutableDataPartStoragePtr getProjection(const std::string & name, bool use_parent_transaction = true) override; // NOLINT
DataPartStoragePtr getProjection(const std::string & name) const override;
bool exists() const override;
bool exists(const std::string & name) const override;
bool isDirectory(const std::string & name) const override;
DataPartStorageIteratorPtr iterate() const override;
Poco::Timestamp getFileLastModified(const String & file_name) const override;
size_t getFileSize(const std::string & file_name) const override;
UInt32 getRefCount(const std::string & file_name) const override;
std::string getRemotePath(const std::string & file_name) const override;
String getUniqueId() const override;
std::unique_ptr<ReadBufferFromFileBase> readFile(
const std::string & name,
const ReadSettings & settings,
std::optional<size_t> read_hint,
std::optional<size_t> file_size) const override;
void createProjection(const std::string & name) override;
std::unique_ptr<WriteBufferFromFileBase> writeFile(
const String & name,
size_t buf_size,
WriteMode mode,
const WriteSettings & settings) override;
void createFile(const String & name) override;
void moveFile(const String & from_name, const String & to_name) override;
void replaceFile(const String & from_name, const String & to_name) override;
void removeFile(const String & name) override;
void removeFileIfExists(const String & name) override;
void createHardLinkFrom(const IDataPartStorage & source, const std::string & from, const std::string & to) override;
void beginTransaction() override;
void commitTransaction() override;
void precommitTransaction() override {}
bool hasActiveTransaction() const override { return transaction != nullptr; }
private:
DataPartStorageOnDiskFull(VolumePtr volume_, std::string root_path_, std::string part_dir_, DiskTransactionPtr transaction_);
MutableDataPartStoragePtr create(VolumePtr volume_, std::string root_path_, std::string part_dir_, bool initialize_) const override;
NameSet getActualFileNamesOnDisk(const NameSet & file_names) const override { return file_names; }
};
}
|