| 1 | #pragma once |
|---|---|
| 2 | |
| 3 | #include <Common/config.h> |
| 4 | |
| 5 | #if USE_AWS_S3 |
| 6 | |
| 7 | #include <memory> |
| 8 | |
| 9 | #include <IO/HTTPCommon.h> |
| 10 | #include <IO/ReadBuffer.h> |
| 11 | #include <aws/s3/model/GetObjectResult.h> |
| 12 | |
| 13 | namespace Aws::S3 |
| 14 | { |
| 15 | class S3Client; |
| 16 | } |
| 17 | |
| 18 | namespace DB |
| 19 | { |
| 20 | /** Perform S3 HTTP GET request and provide response to read. |
| 21 | */ |
| 22 | class ReadBufferFromS3 : public ReadBuffer |
| 23 | { |
| 24 | private: |
| 25 | Logger * log = &Logger::get("ReadBufferFromS3"); |
| 26 | Aws::S3::Model::GetObjectResult read_result; |
| 27 | |
| 28 | protected: |
| 29 | std::unique_ptr<ReadBuffer> impl; |
| 30 | |
| 31 | public: |
| 32 | explicit ReadBufferFromS3(const std::shared_ptr<Aws::S3::S3Client> & client_ptr, |
| 33 | const String & bucket, |
| 34 | const String & key, |
| 35 | size_t buffer_size_ = DBMS_DEFAULT_BUFFER_SIZE); |
| 36 | |
| 37 | bool nextImpl() override; |
| 38 | }; |
| 39 | |
| 40 | } |
| 41 | |
| 42 | #endif |
| 43 |