2022-04-26 12:57:02 +00:00
|
|
|
#pragma once
|
|
|
|
#include <base/types.h>
|
|
|
|
#include <optional>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class ReadBuffer;
|
|
|
|
|
|
|
|
class WithFileSize
|
|
|
|
{
|
|
|
|
public:
|
2024-07-18 02:54:36 +00:00
|
|
|
/// Returns nullopt if couldn't find out file size;
|
|
|
|
virtual std::optional<size_t> tryGetFileSize() = 0;
|
2022-04-26 12:57:02 +00:00
|
|
|
virtual ~WithFileSize() = default;
|
2024-07-18 02:54:36 +00:00
|
|
|
|
|
|
|
size_t getFileSize();
|
2022-04-26 12:57:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
bool isBufferWithFileSize(const ReadBuffer & in);
|
|
|
|
|
2022-05-25 14:49:40 +00:00
|
|
|
size_t getFileSizeFromReadBuffer(ReadBuffer & in);
|
2023-06-16 15:51:18 +00:00
|
|
|
std::optional<size_t> tryGetFileSizeFromReadBuffer(ReadBuffer & in);
|
|
|
|
|
|
|
|
size_t getDataOffsetMaybeCompressed(const ReadBuffer & in);
|
|
|
|
|
2022-04-26 12:57:02 +00:00
|
|
|
}
|