aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/IO/WithFileSize.h
blob: 0ae3af98ea09e731bdf851740b9b4a74d6db1deb (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
#pragma once
#include <base/types.h>
#include <optional>

namespace DB
{

class ReadBuffer;

class WithFileSize
{
public:
    virtual size_t getFileSize() = 0;
    virtual ~WithFileSize() = default;
};

bool isBufferWithFileSize(const ReadBuffer & in);

size_t getFileSizeFromReadBuffer(ReadBuffer & in);

/// Return nullopt if couldn't find out file size;
std::optional<size_t> tryGetFileSizeFromReadBuffer(ReadBuffer & in);

size_t getDataOffsetMaybeCompressed(const ReadBuffer & in);

}