Browse Source

Restoring authorship annotation for <kalabukdima@yandex-team.ru>. Commit 1 of 2.

kalabukdima 3 years ago
parent
commit
b688e76378

+ 3 - 3
build/prebuilt/tools/enum_parser/enum_parser/ya.make.resource

@@ -1,9 +1,9 @@
 IF (OS_DARWIN AND ARCH_X86_64)
 IF (OS_DARWIN AND ARCH_X86_64)
-    SET(SANDBOX_RESOURCE_ID 2265845868)
+    SET(SANDBOX_RESOURCE_ID 2265845868) 
 ELSEIF (OS_LINUX AND ARCH_X86_64)
 ELSEIF (OS_LINUX AND ARCH_X86_64)
-    SET(SANDBOX_RESOURCE_ID 2265846387)
+    SET(SANDBOX_RESOURCE_ID 2265846387) 
 ELSEIF (OS_WINDOWS AND ARCH_X86_64)
 ELSEIF (OS_WINDOWS AND ARCH_X86_64)
-    SET(SANDBOX_RESOURCE_ID 2265845307)
+    SET(SANDBOX_RESOURCE_ID 2265845307) 
 ELSE()
 ELSE()
     SET(SANDBOX_RESOURCE_ID)
     SET(SANDBOX_RESOURCE_ID)
 ENDIF()
 ENDIF()

+ 35 - 35
util/memory/blob.cpp

@@ -117,13 +117,13 @@ public:
             ythrow yexception() << "can not map(" << offset << ", " << len << ")";
             ythrow yexception() << "can not map(" << offset << ", " << len << ")";
         }
         }
 
 
-        if (Mode_ == EMappingMode::Locked) {
+        if (Mode_ == EMappingMode::Locked) { 
             LockMemory(Data(), Length());
             LockMemory(Data(), Length());
         }
         }
     }
     }
 
 
     ~TMappedBlobBase() override {
     ~TMappedBlobBase() override {
-        if (Mode_ == EMappingMode::Locked && Length()) {
+        if (Mode_ == EMappingMode::Locked && Length()) { 
             UnlockMemory(Data(), Length());
             UnlockMemory(Data(), Length());
         }
         }
     }
     }
@@ -208,7 +208,7 @@ static inline TBlob ConstructFromMap(const TMemoryMap& map, ui64 offset, size_t
 
 
 template <class TCounter, class T>
 template <class TCounter, class T>
 static inline TBlob ConstructAsMap(const T& t, EMappingMode mode) {
 static inline TBlob ConstructAsMap(const T& t, EMappingMode mode) {
-    TMemoryMap::EOpenMode openMode = (mode == EMappingMode::Precharged) ? (TMemoryMap::oRdOnly | TMemoryMap::oPrecharge) : TMemoryMap::oRdOnly;
+    TMemoryMap::EOpenMode openMode = (mode == EMappingMode::Precharged) ? (TMemoryMap::oRdOnly | TMemoryMap::oPrecharge) : TMemoryMap::oRdOnly; 
 
 
     TMemoryMap map(t, openMode);
     TMemoryMap map(t, openMode);
     const ui64 toMap = map.Length();
     const ui64 toMap = map.Length();
@@ -220,84 +220,84 @@ static inline TBlob ConstructAsMap(const T& t, EMappingMode mode) {
     return ConstructFromMap<TCounter>(map, 0, static_cast<size_t>(toMap), mode);
     return ConstructFromMap<TCounter>(map, 0, static_cast<size_t>(toMap), mode);
 }
 }
 
 
-TBlob TBlob::FromFileSingleThreaded(const TString& path, EMappingMode mode) {
-    return ConstructAsMap<TSimpleCounter>(path, mode);
-}
-
-TBlob TBlob::FromFile(const TString& path, EMappingMode mode) {
-    return ConstructAsMap<TAtomicCounter>(path, mode);
-}
-
-TBlob TBlob::FromFileSingleThreaded(const TFile& file, EMappingMode mode) {
-    return ConstructAsMap<TSimpleCounter>(file, mode);
-}
-
-TBlob TBlob::FromFile(const TFile& file, EMappingMode mode) {
-    return ConstructAsMap<TAtomicCounter>(file, mode);
-}
-
+TBlob TBlob::FromFileSingleThreaded(const TString& path, EMappingMode mode) { 
+    return ConstructAsMap<TSimpleCounter>(path, mode); 
+} 
+ 
+TBlob TBlob::FromFile(const TString& path, EMappingMode mode) { 
+    return ConstructAsMap<TAtomicCounter>(path, mode); 
+} 
+ 
+TBlob TBlob::FromFileSingleThreaded(const TFile& file, EMappingMode mode) { 
+    return ConstructAsMap<TSimpleCounter>(file, mode); 
+} 
+ 
+TBlob TBlob::FromFile(const TFile& file, EMappingMode mode) { 
+    return ConstructAsMap<TAtomicCounter>(file, mode); 
+} 
+ 
 TBlob TBlob::FromFileSingleThreaded(const TString& path) {
 TBlob TBlob::FromFileSingleThreaded(const TString& path) {
-    return ConstructAsMap<TSimpleCounter>(path, EMappingMode::Standard);
+    return ConstructAsMap<TSimpleCounter>(path, EMappingMode::Standard); 
 }
 }
 
 
 TBlob TBlob::FromFile(const TString& path) {
 TBlob TBlob::FromFile(const TString& path) {
-    return ConstructAsMap<TAtomicCounter>(path, EMappingMode::Standard);
+    return ConstructAsMap<TAtomicCounter>(path, EMappingMode::Standard); 
 }
 }
 
 
 TBlob TBlob::FromFileSingleThreaded(const TFile& file) {
 TBlob TBlob::FromFileSingleThreaded(const TFile& file) {
-    return ConstructAsMap<TSimpleCounter>(file, EMappingMode::Standard);
+    return ConstructAsMap<TSimpleCounter>(file, EMappingMode::Standard); 
 }
 }
 
 
 TBlob TBlob::FromFile(const TFile& file) {
 TBlob TBlob::FromFile(const TFile& file) {
-    return ConstructAsMap<TAtomicCounter>(file, EMappingMode::Standard);
+    return ConstructAsMap<TAtomicCounter>(file, EMappingMode::Standard); 
 }
 }
 
 
 TBlob TBlob::PrechargedFromFileSingleThreaded(const TString& path) {
 TBlob TBlob::PrechargedFromFileSingleThreaded(const TString& path) {
-    return ConstructAsMap<TSimpleCounter>(path, EMappingMode::Precharged);
+    return ConstructAsMap<TSimpleCounter>(path, EMappingMode::Precharged); 
 }
 }
 
 
 TBlob TBlob::PrechargedFromFile(const TString& path) {
 TBlob TBlob::PrechargedFromFile(const TString& path) {
-    return ConstructAsMap<TAtomicCounter>(path, EMappingMode::Precharged);
+    return ConstructAsMap<TAtomicCounter>(path, EMappingMode::Precharged); 
 }
 }
 
 
 TBlob TBlob::PrechargedFromFileSingleThreaded(const TFile& file) {
 TBlob TBlob::PrechargedFromFileSingleThreaded(const TFile& file) {
-    return ConstructAsMap<TSimpleCounter>(file, EMappingMode::Precharged);
+    return ConstructAsMap<TSimpleCounter>(file, EMappingMode::Precharged); 
 }
 }
 
 
 TBlob TBlob::PrechargedFromFile(const TFile& file) {
 TBlob TBlob::PrechargedFromFile(const TFile& file) {
-    return ConstructAsMap<TAtomicCounter>(file, EMappingMode::Precharged);
+    return ConstructAsMap<TAtomicCounter>(file, EMappingMode::Precharged); 
 }
 }
 
 
 TBlob TBlob::LockedFromFileSingleThreaded(const TString& path) {
 TBlob TBlob::LockedFromFileSingleThreaded(const TString& path) {
-    return ConstructAsMap<TSimpleCounter>(path, EMappingMode::Locked);
+    return ConstructAsMap<TSimpleCounter>(path, EMappingMode::Locked); 
 }
 }
 
 
 TBlob TBlob::LockedFromFile(const TString& path) {
 TBlob TBlob::LockedFromFile(const TString& path) {
-    return ConstructAsMap<TAtomicCounter>(path, EMappingMode::Locked);
+    return ConstructAsMap<TAtomicCounter>(path, EMappingMode::Locked); 
 }
 }
 
 
 TBlob TBlob::LockedFromFileSingleThreaded(const TFile& file) {
 TBlob TBlob::LockedFromFileSingleThreaded(const TFile& file) {
-    return ConstructAsMap<TSimpleCounter>(file, EMappingMode::Locked);
+    return ConstructAsMap<TSimpleCounter>(file, EMappingMode::Locked); 
 }
 }
 
 
 TBlob TBlob::LockedFromFile(const TFile& file) {
 TBlob TBlob::LockedFromFile(const TFile& file) {
-    return ConstructAsMap<TAtomicCounter>(file, EMappingMode::Locked);
+    return ConstructAsMap<TAtomicCounter>(file, EMappingMode::Locked); 
 }
 }
 
 
 TBlob TBlob::LockedFromMemoryMapSingleThreaded(const TMemoryMap& map, ui64 offset, size_t length) {
 TBlob TBlob::LockedFromMemoryMapSingleThreaded(const TMemoryMap& map, ui64 offset, size_t length) {
-    return ConstructFromMap<TSimpleCounter>(map, offset, length, EMappingMode::Locked);
+    return ConstructFromMap<TSimpleCounter>(map, offset, length, EMappingMode::Locked); 
 }
 }
 
 
 TBlob TBlob::LockedFromMemoryMap(const TMemoryMap& map, ui64 offset, size_t length) {
 TBlob TBlob::LockedFromMemoryMap(const TMemoryMap& map, ui64 offset, size_t length) {
-    return ConstructFromMap<TAtomicCounter>(map, offset, length, EMappingMode::Locked);
+    return ConstructFromMap<TAtomicCounter>(map, offset, length, EMappingMode::Locked); 
 }
 }
 
 
 TBlob TBlob::FromMemoryMapSingleThreaded(const TMemoryMap& map, ui64 offset, size_t length) {
 TBlob TBlob::FromMemoryMapSingleThreaded(const TMemoryMap& map, ui64 offset, size_t length) {
-    return ConstructFromMap<TSimpleCounter>(map, offset, length, EMappingMode::Standard);
+    return ConstructFromMap<TSimpleCounter>(map, offset, length, EMappingMode::Standard); 
 }
 }
 
 
 TBlob TBlob::FromMemoryMap(const TMemoryMap& map, ui64 offset, size_t length) {
 TBlob TBlob::FromMemoryMap(const TMemoryMap& map, ui64 offset, size_t length) {
-    return ConstructFromMap<TAtomicCounter>(map, offset, length, EMappingMode::Standard);
+    return ConstructFromMap<TAtomicCounter>(map, offset, length, EMappingMode::Standard); 
 }
 }
 
 
 template <class TCounter>
 template <class TCounter>

+ 21 - 21
util/memory/blob.h

@@ -10,15 +10,15 @@ class IInputStream;
 class TFile;
 class TFile;
 class TBuffer;
 class TBuffer;
 
 
-enum class EMappingMode {
-    /// Just mmap a file allowing lazy page loading at access
-    Standard,
-    /// Same as previous but warmup the buffer with sequential access to it's data
-    Precharged,
-    /// Try to lock file in memory so that it doesn't wash away. See mlock(2)
-    Locked
-};
-
+enum class EMappingMode { 
+    /// Just mmap a file allowing lazy page loading at access 
+    Standard, 
+    /// Same as previous but warmup the buffer with sequential access to it's data 
+    Precharged, 
+    /// Try to lock file in memory so that it doesn't wash away. See mlock(2) 
+    Locked 
+}; 
+ 
 /// @addtogroup BLOBs
 /// @addtogroup BLOBs
 /// @{
 /// @{
 class TBlob {
 class TBlob {
@@ -201,18 +201,18 @@ public:
     static TBlob NoCopy(const void* data, size_t length);
     static TBlob NoCopy(const void* data, size_t length);
 
 
     /// Creates a blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data.
     /// Creates a blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data.
-    static TBlob FromFileSingleThreaded(const TString& path, EMappingMode);
-
-    /// Creates a blob with a multi-threaded (atomic) refcounter. It maps the file on the path as data.
-    static TBlob FromFile(const TString& path, EMappingMode);
-
-    /// Creates a blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data.
-    static TBlob FromFileSingleThreaded(const TFile& file, EMappingMode);
-
-    /// Creates a blob with a multi-threaded (atomic) refcounter. It maps the file on the path as data.
-    static TBlob FromFile(const TFile& file, EMappingMode);
-
-    /// Creates a blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data.
+    static TBlob FromFileSingleThreaded(const TString& path, EMappingMode); 
+ 
+    /// Creates a blob with a multi-threaded (atomic) refcounter. It maps the file on the path as data. 
+    static TBlob FromFile(const TString& path, EMappingMode); 
+ 
+    /// Creates a blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data. 
+    static TBlob FromFileSingleThreaded(const TFile& file, EMappingMode); 
+ 
+    /// Creates a blob with a multi-threaded (atomic) refcounter. It maps the file on the path as data. 
+    static TBlob FromFile(const TFile& file, EMappingMode); 
+ 
+    /// Creates a blob with a single-threaded (non atomic) refcounter. It maps the file on the path as data. 
     static TBlob FromFileSingleThreaded(const TString& path);
     static TBlob FromFileSingleThreaded(const TString& path);
 
 
     /// Creates a blob with a multi-threaded (atomic) refcounter. It maps the file on the path as data.
     /// Creates a blob with a multi-threaded (atomic) refcounter. It maps the file on the path as data.