aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/on_disk/chunks/reader.h
diff options
context:
space:
mode:
authordenplusplus <denplusplus@yandex-team.ru>2022-02-10 16:47:34 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:34 +0300
commitaddb3626ed629a8c7d9c8c30e87365b478a8c266 (patch)
treec0748b5dcbade83af788c0abfa89c0383d6b779c /library/cpp/on_disk/chunks/reader.h
parent57c20d143e8a438cd76b9fdc3ca2e8ee3ac1f32a (diff)
downloadydb-addb3626ed629a8c7d9c8c30e87365b478a8c266.tar.gz
Restoring authorship annotation for <denplusplus@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/on_disk/chunks/reader.h')
-rw-r--r--library/cpp/on_disk/chunks/reader.h38
1 files changed, 19 insertions, 19 deletions
diff --git a/library/cpp/on_disk/chunks/reader.h b/library/cpp/on_disk/chunks/reader.h
index 66b0155995..c5fe783319 100644
--- a/library/cpp/on_disk/chunks/reader.h
+++ b/library/cpp/on_disk/chunks/reader.h
@@ -1,31 +1,31 @@
-#pragma once
-
+#pragma once
+
#include <util/generic/array_ref.h>
-#include <util/generic/vector.h>
-#include <util/generic/yexception.h>
-
-class TBlob;
-
-class TChunkedDataReader {
+#include <util/generic/vector.h>
+#include <util/generic/yexception.h>
+
+class TBlob;
+
+class TChunkedDataReader {
public:
TChunkedDataReader(const TBlob& blob);
-
+
inline const void* GetBlock(size_t index) const {
CheckIndex(index);
return Offsets[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];
- }
-
+ }
+
return Size - (Offsets.back() - Offsets.front());
- }
-
+ }
+
return Lengths[index];
}
@@ -41,17 +41,17 @@ public:
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:
ui64 Version = 0;
TVector<const char*> Offsets;
TVector<size_t> Lengths;
size_t Size = 0;
-};
+};