mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
File deletion prototype
This commit is contained in:
parent
a0cfafa387
commit
6755c5e897
@ -31,10 +31,14 @@ class BlobStoragePathKeeper : public RemoteFSPathKeeper
|
||||
public:
|
||||
BlobStoragePathKeeper(size_t chunk_limit_) : RemoteFSPathKeeper(chunk_limit_) {}
|
||||
|
||||
void addPath(const String &) override
|
||||
void addPath(const String & path) override
|
||||
{
|
||||
|
||||
paths.push_back(path);
|
||||
}
|
||||
|
||||
// TODO: maybe introduce a getter?
|
||||
// private:
|
||||
std::vector<String> paths;
|
||||
};
|
||||
|
||||
|
||||
@ -144,9 +148,17 @@ bool DiskBlobStorage::checkUniqueId(const String & id) const
|
||||
}
|
||||
|
||||
|
||||
void DiskBlobStorage::removeFromRemoteFS(RemoteFSPathKeeperPtr)
|
||||
void DiskBlobStorage::removeFromRemoteFS(RemoteFSPathKeeperPtr fs_paths_keeper)
|
||||
{
|
||||
auto * paths_keeper = dynamic_cast<BlobStoragePathKeeper *>(fs_paths_keeper.get());
|
||||
|
||||
if (paths_keeper)
|
||||
{
|
||||
for (auto path : paths_keeper->paths)
|
||||
{
|
||||
blob_container_client.DeleteBlob(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,14 +56,19 @@ void checkReadAccess(IDisk & disk)
|
||||
|
||||
void checkRemoveAccess(IDisk & disk)
|
||||
{
|
||||
// TODO: make this an assert (== true)
|
||||
std::cout << disk.checkUniqueId(test_file) << "\n";
|
||||
if (!disk.checkUniqueId(test_file))
|
||||
{
|
||||
// TODO: improve error codes
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Expected the file to exist, but did not find it: {}", test_file);
|
||||
}
|
||||
|
||||
// TODO: implement actually removing the file from Blob Storage cloud, now it seems only the metadata file is removed
|
||||
disk.removeFile(test_file);
|
||||
|
||||
// TODO: make this an assert (== false)
|
||||
std::cout << disk.checkUniqueId(test_file) << "\n";
|
||||
if (disk.checkUniqueId(test_file))
|
||||
{
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Expected the file not to exist, but found it: {}", test_file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user