2019-05-31 10:58:43 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-12-06 14:37:21 +00:00
|
|
|
#include <Common/config.h>
|
|
|
|
|
|
|
|
#if USE_AWS_S3
|
|
|
|
|
2019-05-31 10:58:43 +00:00
|
|
|
#include <memory>
|
2019-09-19 10:25:31 +00:00
|
|
|
|
2019-05-31 10:58:43 +00:00
|
|
|
#include <IO/ConnectionTimeouts.h>
|
|
|
|
#include <IO/HTTPCommon.h>
|
|
|
|
#include <IO/ReadBuffer.h>
|
|
|
|
#include <Poco/Net/HTTPBasicCredentials.h>
|
|
|
|
#include <Poco/URI.h>
|
2019-12-03 16:23:24 +00:00
|
|
|
#include <aws/s3/S3Client.h>
|
2019-05-31 10:58:43 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2019-06-01 21:18:20 +00:00
|
|
|
/** Perform S3 HTTP GET request and provide response to read.
|
2019-05-31 10:58:43 +00:00
|
|
|
*/
|
2019-06-01 21:18:20 +00:00
|
|
|
class ReadBufferFromS3 : public ReadBuffer
|
2019-05-31 10:58:43 +00:00
|
|
|
{
|
2019-12-03 16:23:24 +00:00
|
|
|
private:
|
|
|
|
Logger * log = &Logger::get("ReadBufferFromS3");
|
|
|
|
Aws::S3::Model::GetObjectResult read_result;
|
|
|
|
|
2019-05-31 18:14:39 +00:00
|
|
|
protected:
|
|
|
|
std::unique_ptr<ReadBuffer> impl;
|
2019-05-31 10:58:43 +00:00
|
|
|
|
|
|
|
public:
|
2019-12-03 16:23:24 +00:00
|
|
|
explicit ReadBufferFromS3(const std::shared_ptr<Aws::S3::S3Client> & client_ptr,
|
|
|
|
const String & bucket,
|
|
|
|
const String & key,
|
|
|
|
size_t buffer_size_ = DBMS_DEFAULT_BUFFER_SIZE);
|
2019-05-31 18:14:39 +00:00
|
|
|
|
|
|
|
bool nextImpl() override;
|
2019-05-31 10:58:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2019-12-06 14:37:21 +00:00
|
|
|
|
|
|
|
#endif
|