aboutsummaryrefslogtreecommitdiffstats
path: root/util/memory/blob.cpp
diff options
context:
space:
mode:
authorsereglond <sereglond@yandex-team.ru>2022-02-10 16:47:47 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:47 +0300
commit73bb02f2495181e0719a800f979df508924f4b71 (patch)
treec0748b5dcbade83af788c0abfa89c0383d6b779c /util/memory/blob.cpp
parenteb3d925534734c808602b31b38b953677f0a279f (diff)
downloadydb-73bb02f2495181e0719a800f979df508924f4b71.tar.gz
Restoring authorship annotation for <sereglond@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/memory/blob.cpp')
-rw-r--r--util/memory/blob.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/util/memory/blob.cpp b/util/memory/blob.cpp
index e794e73b7f..91da5cadca 100644
--- a/util/memory/blob.cpp
+++ b/util/memory/blob.cpp
@@ -209,7 +209,7 @@ static inline TBlob ConstructFromMap(const TMemoryMap& map, ui64 offset, size_t
template <class TCounter, class T>
static inline TBlob ConstructAsMap(const T& t, EMappingMode mode) {
TMemoryMap::EOpenMode openMode = (mode == EMappingMode::Precharged) ? (TMemoryMap::oRdOnly | TMemoryMap::oPrecharge) : TMemoryMap::oRdOnly;
-
+
TMemoryMap map(t, openMode);
const ui64 toMap = map.Length();
@@ -301,7 +301,7 @@ TBlob TBlob::FromMemoryMap(const TMemoryMap& map, ui64 offset, size_t length) {
}
template <class TCounter>
-static inline TBlob ReadFromFile(const TFile& file, ui64 offset, size_t length) {
+static inline TBlob ReadFromFile(const TFile& file, ui64 offset, size_t length) {
using TBase = TDynamicBlobBase<TCounter>;
THolder<TBase> base(new (length) TBase);
@@ -316,32 +316,32 @@ static inline TBlob ReadFromFile(const TFile& file, ui64 offset, size_t length)
}
template <class TCounter>
-static inline TBlob ConstructFromFileContent(const TFile& file, ui64 offset, ui64 length) {
- if (length > Max<size_t>()) {
- ythrow yexception() << "can not read whole file(length = " << length << ")";
- }
-
- return ReadFromFile<TCounter>(file, offset, static_cast<size_t>(length));
+static inline TBlob ConstructFromFileContent(const TFile& file, ui64 offset, ui64 length) {
+ if (length > Max<size_t>()) {
+ ythrow yexception() << "can not read whole file(length = " << length << ")";
+ }
+
+ return ReadFromFile<TCounter>(file, offset, static_cast<size_t>(length));
}
TBlob TBlob::FromFileContentSingleThreaded(const TString& path) {
- TFile file(path, RdOnly);
- return ConstructFromFileContent<TSimpleCounter>(file, 0, file.GetLength());
-}
-
+ TFile file(path, RdOnly);
+ return ConstructFromFileContent<TSimpleCounter>(file, 0, file.GetLength());
+}
+
TBlob TBlob::FromFileContent(const TString& path) {
- TFile file(path, RdOnly);
- return ConstructFromFileContent<TAtomicCounter>(file, 0, file.GetLength());
-}
-
+ TFile file(path, RdOnly);
+ return ConstructFromFileContent<TAtomicCounter>(file, 0, file.GetLength());
+}
+
TBlob TBlob::FromFileContentSingleThreaded(const TFile& file) {
- return ConstructFromFileContent<TSimpleCounter>(file, 0, file.GetLength());
-}
-
+ return ConstructFromFileContent<TSimpleCounter>(file, 0, file.GetLength());
+}
+
TBlob TBlob::FromFileContent(const TFile& file) {
- return ConstructFromFileContent<TAtomicCounter>(file, 0, file.GetLength());
-}
-
+ return ConstructFromFileContent<TAtomicCounter>(file, 0, file.GetLength());
+}
+
TBlob TBlob::FromFileContentSingleThreaded(const TFile& file, ui64 offset, size_t length) {
return ConstructFromFileContent<TSimpleCounter>(file, offset, length);
}