2021-03-19 21:49:18 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-04-10 14:58:29 +00:00
|
|
|
#if !defined(ARCADIA_BUILD)
|
2021-03-24 21:02:21 +00:00
|
|
|
#include <Common/config.h>
|
2021-04-10 14:58:29 +00:00
|
|
|
#endif
|
2021-03-24 21:02:21 +00:00
|
|
|
|
|
|
|
#if USE_AWS_S3
|
|
|
|
|
2021-03-19 21:49:18 +00:00
|
|
|
#include "Client/Connection.h"
|
2021-04-08 00:09:15 +00:00
|
|
|
#include <Interpreters/Cluster.h>
|
|
|
|
#include <IO/S3Common.h>
|
|
|
|
#include <Storages/StorageS3.h>
|
2021-03-19 21:49:18 +00:00
|
|
|
|
|
|
|
#include <memory>
|
2021-03-22 17:12:31 +00:00
|
|
|
#include <optional>
|
2021-03-19 21:49:18 +00:00
|
|
|
#include "ext/shared_ptr_helper.h"
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class Context;
|
|
|
|
|
2021-03-24 18:36:31 +00:00
|
|
|
struct ClientAuthentificationBuilder
|
|
|
|
{
|
|
|
|
String access_key_id;
|
|
|
|
String secret_access_key;
|
|
|
|
UInt64 max_connections;
|
|
|
|
};
|
2021-03-19 21:49:18 +00:00
|
|
|
|
2021-04-12 21:42:52 +00:00
|
|
|
class StorageS3Cluster : public ext::shared_ptr_helper<StorageS3Cluster>, public IStorage
|
2021-03-19 21:49:18 +00:00
|
|
|
{
|
2021-04-12 21:42:52 +00:00
|
|
|
friend struct ext::shared_ptr_helper<StorageS3Cluster>;
|
2021-03-19 21:49:18 +00:00
|
|
|
public:
|
2021-04-12 21:42:52 +00:00
|
|
|
std::string getName() const override { return "S3Cluster"; }
|
2021-03-19 21:49:18 +00:00
|
|
|
|
2021-04-12 19:35:26 +00:00
|
|
|
Pipe read(const Names &, const StorageMetadataPtr &, SelectQueryInfo &,
|
|
|
|
ContextPtr, QueryProcessingStage::Enum, size_t /*max_block_size*/, unsigned /*num_streams*/) override;
|
2021-03-19 21:49:18 +00:00
|
|
|
|
2021-04-12 19:35:26 +00:00
|
|
|
QueryProcessingStage::Enum getQueryProcessingStage(ContextPtr, QueryProcessingStage::Enum, SelectQueryInfo &) const override;
|
2021-04-06 19:18:45 +00:00
|
|
|
|
|
|
|
NamesAndTypesList getVirtuals() const override;
|
2021-03-19 21:49:18 +00:00
|
|
|
|
|
|
|
protected:
|
2021-04-12 21:42:52 +00:00
|
|
|
StorageS3Cluster(
|
2021-04-12 19:35:26 +00:00
|
|
|
const String & filename_, const String & access_key_id_, const String & secret_access_key_, const StorageID & table_id_,
|
|
|
|
String cluster_name_, const String & format_name_, UInt64 max_connections_, const ColumnsDescription & columns_,
|
|
|
|
const ConstraintsDescription & constraints_, ContextPtr context_, const String & compression_method_);
|
2021-03-19 21:49:18 +00:00
|
|
|
|
|
|
|
private:
|
2021-03-22 17:12:31 +00:00
|
|
|
/// Connections from initiator to other nodes
|
2021-03-19 21:49:18 +00:00
|
|
|
std::vector<std::shared_ptr<Connection>> connections;
|
2021-04-08 00:09:15 +00:00
|
|
|
StorageS3::ClientAuthentificaiton client_auth;
|
|
|
|
|
2021-04-06 19:18:45 +00:00
|
|
|
String filename;
|
2021-04-12 19:35:26 +00:00
|
|
|
String cluster_name;
|
2021-03-22 17:12:31 +00:00
|
|
|
String format_name;
|
|
|
|
String compression_method;
|
2021-03-19 21:49:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2021-03-24 21:02:21 +00:00
|
|
|
|
|
|
|
#endif
|