2021-09-28 14:37:38 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Common/config.h>
|
|
|
|
|
|
|
|
#if USE_AZURE_BLOB_STORAGE
|
|
|
|
|
2021-10-01 13:41:10 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2021-09-28 14:37:38 +00:00
|
|
|
#include <IO/BufferWithOwnMemory.h>
|
|
|
|
#include <IO/WriteBuffer.h>
|
2022-07-11 17:19:57 +00:00
|
|
|
#include <IO/WriteSettings.h>
|
2021-10-01 08:32:28 +00:00
|
|
|
#include <azure/storage/blobs.hpp>
|
2021-10-01 13:41:10 +00:00
|
|
|
#include <azure/core/io/body_stream.hpp>
|
2021-10-01 08:32:28 +00:00
|
|
|
|
2021-09-28 14:37:38 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2021-12-16 22:57:08 +00:00
|
|
|
class WriteBufferFromAzureBlobStorage : public BufferWithOwnMemory<WriteBuffer>
|
2021-09-28 14:37:38 +00:00
|
|
|
{
|
|
|
|
public:
|
2021-10-06 15:12:24 +00:00
|
|
|
|
2022-05-19 17:25:45 +00:00
|
|
|
WriteBufferFromAzureBlobStorage(
|
|
|
|
std::shared_ptr<const Azure::Storage::Blobs::BlobContainerClient> blob_container_client_,
|
2021-10-01 08:32:28 +00:00
|
|
|
const String & blob_path_,
|
2021-11-16 13:35:21 +00:00
|
|
|
size_t max_single_part_upload_size_,
|
2022-05-19 17:25:45 +00:00
|
|
|
size_t buf_size_,
|
2022-07-11 17:19:57 +00:00
|
|
|
const WriteSettings & write_settings_,
|
2022-05-19 17:25:45 +00:00
|
|
|
std::optional<std::map<std::string, std::string>> attributes_ = {});
|
2021-09-28 14:37:38 +00:00
|
|
|
|
2021-12-16 22:57:08 +00:00
|
|
|
~WriteBufferFromAzureBlobStorage() override;
|
2021-10-01 08:32:28 +00:00
|
|
|
|
2021-11-30 15:44:28 +00:00
|
|
|
void nextImpl() override;
|
2021-10-21 10:14:41 +00:00
|
|
|
|
2021-10-01 08:32:28 +00:00
|
|
|
private:
|
2021-12-24 12:40:54 +00:00
|
|
|
void finalizeImpl() override;
|
|
|
|
|
2022-05-19 17:25:45 +00:00
|
|
|
std::shared_ptr<const Azure::Storage::Blobs::BlobContainerClient> blob_container_client;
|
2021-11-16 12:57:21 +00:00
|
|
|
size_t max_single_part_upload_size;
|
2021-10-01 08:32:28 +00:00
|
|
|
const String blob_path;
|
2022-07-11 17:19:57 +00:00
|
|
|
WriteSettings write_settings;
|
2022-05-19 17:25:45 +00:00
|
|
|
std::optional<std::map<std::string, std::string>> attributes;
|
2021-09-28 14:37:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|