diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/on_disk/chunks/reader.h | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/on_disk/chunks/reader.h')
-rw-r--r-- | library/cpp/on_disk/chunks/reader.h | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/library/cpp/on_disk/chunks/reader.h b/library/cpp/on_disk/chunks/reader.h index aba81a355f..c5fe783319 100644 --- a/library/cpp/on_disk/chunks/reader.h +++ b/library/cpp/on_disk/chunks/reader.h @@ -7,51 +7,51 @@ class TBlob; class TChunkedDataReader { -public: - TChunkedDataReader(const TBlob& blob); +public: + TChunkedDataReader(const TBlob& blob); - inline const void* GetBlock(size_t index) const { - CheckIndex(index); - return Offsets[index]; - } + inline const void* GetBlock(size_t index) const { + CheckIndex(index); + return Offsets[index]; + } - inline size_t GetBlockLen(size_t index) const { - CheckIndex(index); + inline size_t GetBlockLen(size_t index) const { + CheckIndex(index); - if (Version == 0) { - if (index + 1 < Offsets.size()) { - return Offsets[index + 1] - Offsets[index]; + if (Version == 0) { + if (index + 1 < Offsets.size()) { + return Offsets[index + 1] - Offsets[index]; } - return Size - (Offsets.back() - Offsets.front()); + return Size - (Offsets.back() - Offsets.front()); } - return Lengths[index]; - } + return Lengths[index]; + } - TBlob GetBlob(size_t index) const; + TBlob GetBlob(size_t index) const; - template <typename T> + template <typename T> TArrayRef<const T> GetRegion(size_t index) const { - size_t len = GetBlockLen(index); - Y_ENSURE(len % sizeof(T) == 0, "wrong data padding"); + size_t len = GetBlockLen(index); + Y_ENSURE(len % sizeof(T) == 0, "wrong data padding"); return TArrayRef<const T>(reinterpret_cast<const T*>(GetBlock(index)), len / sizeof(T)); - } + } - inline size_t GetBlocksCount() const { - return Offsets.size(); - } + inline size_t GetBlocksCount() const { + return Offsets.size(); + } -private: - inline void CheckIndex(size_t index) const { - if (index >= GetBlocksCount()) { - ythrow yexception() << "requested block " << index << " of " << GetBlocksCount() << " blocks"; +private: + inline void CheckIndex(size_t index) const { + if (index >= GetBlocksCount()) { + ythrow yexception() << "requested block " << index << " of " << GetBlocksCount() << " blocks"; } - } + } -private: - ui64 Version = 0; - TVector<const char*> Offsets; - TVector<size_t> Lengths; - size_t Size = 0; +private: + ui64 Version = 0; + TVector<const char*> Offsets; + TVector<size_t> Lengths; + size_t Size = 0; }; |