aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/IO/S3/SessionAwareIOStream.h
blob: babe52545d1fefe19aa60e66b41748f74ef7a7b4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#pragma once

#include <iosfwd>


namespace DB::S3
{
/**
 * Wrapper of IOStream to store response stream and corresponding HTTP session.
 */
template <typename Session>
class SessionAwareIOStream : public std::iostream
{
public:
    SessionAwareIOStream(Session session_, std::streambuf * sb)
        : std::iostream(sb)
        , session(std::move(session_))
    {
    }

    Session & getSession() { return session; }

    const Session & getSession() const { return session; }

private:
    /// Poco HTTP session is holder of response stream.
    Session session;
};

}