#pragma once #if !defined(ARCADIA_BUILD) #include #endif #if USE_AWS_S3 # include # include # include # include # include "SeekableReadBuffer.h" namespace Aws::S3 { class S3Client; } namespace DB { /** * Perform S3 HTTP GET request and provide response to read. */ class ReadBufferFromS3 : public SeekableReadBuffer { private: std::shared_ptr client_ptr; String bucket; String key; UInt64 max_single_read_retries; size_t buffer_size; off_t offset = 0; Aws::S3::Model::GetObjectResult read_result; std::unique_ptr impl; Poco::Logger * log = &Poco::Logger::get("ReadBufferFromS3"); public: ReadBufferFromS3( std::shared_ptr client_ptr_, const String & bucket_, const String & key_, UInt64 max_single_read_retries_, size_t buffer_size_, bool use_external_buffer = false); bool nextImpl() override; off_t seek(off_t off, int whence) override; off_t getPosition() override; private: std::unique_ptr initialize(); bool use_external_buffer; }; } #endif