Browse Source

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

iddqd 3 years ago
parent
commit
ff241e1daf

+ 2 - 2
build/ymake.core.conf

@@ -1478,9 +1478,9 @@ when ($COMMON_LINK_SETTINGS == "yes") {
             "BM" ? {
                 PEERDIR+=library/cpp/balloc_market
             }
-            "C" ? { 
+            "C" ? {
                 PEERDIR+=library/cpp/malloc/calloc
-            } 
+            }
             "LOCKLESS" ? {
                 PEERDIR+=library/cpp/malloc/lockless
             }

+ 5 - 5
library/cpp/actors/core/executor_thread.cpp

@@ -10,9 +10,9 @@
 #include <library/cpp/actors/util/datetime.h>
 #include <library/cpp/actors/util/thread.h>
 
-#ifdef BALLOC 
+#ifdef BALLOC
 #include <library/cpp/balloc/optional/operators.h>
-#endif 
+#endif
 
 #ifdef _linux_
 #include <sys/syscall.h>
@@ -293,9 +293,9 @@ namespace NActors {
         AtomicSet(ThreadId, (ui64)tid);
 #endif
 
-#ifdef BALLOC 
-        ThreadDisableBalloc(); 
-#endif 
+#ifdef BALLOC
+        ThreadDisableBalloc();
+#endif
 
         if (ThreadName) {
             ::SetCurrentThreadName(ThreadName);

+ 5 - 5
library/cpp/actors/core/scheduler_basic.cpp

@@ -4,9 +4,9 @@
 #include <library/cpp/actors/util/datetime.h>
 #include <library/cpp/actors/util/thread.h>
 
-#ifdef BALLOC 
+#ifdef BALLOC
 #include <library/cpp/balloc/optional/operators.h>
-#endif 
+#endif
 
 namespace NActors {
 
@@ -50,9 +50,9 @@ namespace NActors {
     }
 
     void TBasicSchedulerThread::CycleFunc() {
-#ifdef BALLOC 
-        ThreadDisableBalloc(); 
-#endif 
+#ifdef BALLOC
+        ThreadDisableBalloc();
+#endif
         ::SetCurrentThreadName("Scheduler");
 
         ui64 currentMonotonic = RelaxedLoad(CurrentMonotonic);

+ 2 - 2
library/cpp/actors/core/ya.make

@@ -16,8 +16,8 @@ IF (ALLOCATOR == "B" OR ALLOCATOR == "BS" OR ALLOCATOR == "C")
     PEERDIR(
         library/cpp/balloc/optional
     )
-ENDIF() 
- 
+ENDIF()
+
 SRCS(
     actor_bootstrapped.h
     actor_coroutine.cpp

+ 1 - 1
library/cpp/balloc/balloc.cpp

@@ -24,7 +24,7 @@ namespace NBalloc {
             // ltls.Mode == Disabled
             const size_t extsize = size + sizeof(TAllocHeader);
             TAllocHeader* allocHeader = (TAllocHeader*)LibcMalloc(extsize);
-            allocHeader->Encode(allocHeader, size, DISABLED_SIGNATURE); 
+            allocHeader->Encode(allocHeader, size, DISABLED_SIGNATURE);
             return allocHeader + 1;
         }
     }

+ 1 - 1
library/cpp/bucket_quoter/bucket_quoter.h

@@ -155,7 +155,7 @@ public:
         return Max<i64>(0, Bucket);
     }
 
-    void Use(ui64 tokens, bool sleep = false) { 
+    void Use(ui64 tokens, bool sleep = false) {
         TGuard<Lock> g(BucketMutex);
         UseNoLock(tokens, sleep);
     }

+ 79 - 79
library/cpp/cache/thread_safe_cache.h

@@ -1,11 +1,11 @@
-#pragma once 
- 
-#include "cache.h" 
- 
-#include <util/generic/singleton.h> 
-#include <util/system/rwlock.h> 
- 
-namespace NPrivate { 
+#pragma once
+
+#include "cache.h"
+
+#include <util/generic/singleton.h>
+#include <util/system/rwlock.h>
+
+namespace NPrivate {
     // We are interested in getters promotion policy _here_ because of Read-Write-Lock optimizations.
     enum class EGettersPromotionPolicy {
         Promoted,   // LRU, TLRU, MRU, etc.
@@ -13,29 +13,29 @@ namespace NPrivate {
     };
 
     template <class Key, class Value, template <class, class> class List, EGettersPromotionPolicy GettersPromotionPolicy, class... TArgs>
-    class TThreadSafeCache { 
-    public: 
+    class TThreadSafeCache {
+    public:
         using TPtr = TAtomicSharedPtr<Value>;
 
-        class ICallbacks { 
-        public: 
-            using TKey = Key; 
-            using TValue = Value; 
+        class ICallbacks {
+        public:
+            using TKey = Key;
+            using TValue = Value;
             using TOwner = TThreadSafeCache<Key, Value, List, GettersPromotionPolicy, TArgs...>;
- 
-        public: 
+
+        public:
             virtual ~ICallbacks() = default;
-            virtual TKey GetKey(TArgs... args) const = 0; 
-            virtual TValue* CreateObject(TArgs... args) const = 0; 
-        }; 
- 
-    public: 
+            virtual TKey GetKey(TArgs... args) const = 0;
+            virtual TValue* CreateObject(TArgs... args) const = 0;
+        };
+
+    public:
         TThreadSafeCache(const ICallbacks& callbacks, size_t maxSize = Max<size_t>())
-            : Callbacks(callbacks) 
+            : Callbacks(callbacks)
             , Cache(maxSize)
         {
         }
- 
+
         bool Insert(const Key& key, const TPtr& value) {
             if (!Contains(key)) {
                 TWriteGuard w(Mutex);
@@ -51,17 +51,17 @@ namespace NPrivate {
 
         const TPtr Get(TArgs... args) const {
             return GetValue<true>(args...);
-        } 
- 
+        }
+
         const TPtr GetUnsafe(TArgs... args) const {
             return GetValue<false>(args...);
         }
 
-        void Clear() { 
-            TWriteGuard w(Mutex); 
-            Cache.Clear(); 
-        } 
- 
+        void Clear() {
+            TWriteGuard w(Mutex);
+            Cache.Clear();
+        }
+
         void Erase(TArgs... args) {
             Key key = Callbacks.GetKey(args...);
             if (!Contains(key)) {
@@ -83,19 +83,19 @@ namespace NPrivate {
 
         template <class TCallbacks>
         static const TPtr Get(TArgs... args) {
-            return TThreadSafeCacheSingleton<TCallbacks>::Get(args...); 
-        } 
- 
+            return TThreadSafeCacheSingleton<TCallbacks>::Get(args...);
+        }
+
         template <class TCallbacks>
         static const TPtr Erase(TArgs... args) {
             return TThreadSafeCacheSingleton<TCallbacks>::Erase(args...);
         }
 
         template <class TCallbacks>
-        static void Clear() { 
-            return TThreadSafeCacheSingleton<TCallbacks>::Clear(); 
-        } 
- 
+        static void Clear() {
+            return TThreadSafeCacheSingleton<TCallbacks>::Clear();
+        }
+
         size_t GetMaxSize() const {
             TReadGuard w(Mutex);
             return Cache.GetMaxSize();
@@ -106,7 +106,7 @@ namespace NPrivate {
             Cache.SetMaxSize(newSize);
         }
 
-    private: 
+    private:
         template <bool AllowNullValues>
         const TPtr GetValue(TArgs... args) const {
             Key key = Callbacks.GetKey(args...);
@@ -136,53 +136,53 @@ namespace NPrivate {
 
     private:
         using TInternalCache = TCache<Key, TPtr, List<Key, TPtr>, TNoopDelete>;
- 
-        template <class TCallbacks> 
-        class TThreadSafeCacheSingleton { 
-        public: 
+
+        template <class TCallbacks>
+        class TThreadSafeCacheSingleton {
+        public:
             static const TPtr Get(TArgs... args) {
-                return Singleton<TThreadSafeCacheSingleton>()->Cache.Get(args...); 
-            } 
- 
+                return Singleton<TThreadSafeCacheSingleton>()->Cache.Get(args...);
+            }
+
             static const TPtr Erase(TArgs... args) {
                 return Singleton<TThreadSafeCacheSingleton>()->Cache.Erase(args...);
             }
 
-            static void Clear() { 
-                return Singleton<TThreadSafeCacheSingleton>()->Cache.Clear(); 
-            } 
- 
-            TThreadSafeCacheSingleton() 
-                : Cache(Callbacks) 
+            static void Clear() {
+                return Singleton<TThreadSafeCacheSingleton>()->Cache.Clear();
+            }
+
+            TThreadSafeCacheSingleton()
+                : Cache(Callbacks)
             {
             }
- 
-        private: 
-            TCallbacks Callbacks; 
-            typename TCallbacks::TOwner Cache; 
-        }; 
- 
-    private: 
-        TRWMutex Mutex; 
-        const ICallbacks& Callbacks; 
+
+        private:
+            TCallbacks Callbacks;
+            typename TCallbacks::TOwner Cache;
+        };
+
+    private:
+        TRWMutex Mutex;
+        const ICallbacks& Callbacks;
         mutable TInternalCache Cache;
-    }; 
- 
-    struct TLWHelper { 
-        template <class TValue> 
-        struct TConstWeighter { 
-            static int Weight(const TValue& /*value*/) { 
-                return 0; 
-            } 
-        }; 
- 
-        template <class TKey, class TValue> 
+    };
+
+    struct TLWHelper {
+        template <class TValue>
+        struct TConstWeighter {
+            static int Weight(const TValue& /*value*/) {
+                return 0;
+            }
+        };
+
+        template <class TKey, class TValue>
         using TListType = TLWList<TKey, TValue, int, TConstWeighter<TValue>>;
- 
-        template <class TKey, class TValue, class... TArgs> 
+
+        template <class TKey, class TValue, class... TArgs>
         using TCache = TThreadSafeCache<TKey, TValue, TListType, EGettersPromotionPolicy::Unpromoted, TArgs...>;
-    }; 
- 
+    };
+
     struct TLRUHelper {
         template <class TKey, class TValue>
         using TListType = TLRUList<TKey, TValue>;
@@ -191,10 +191,10 @@ namespace NPrivate {
         using TCache = TThreadSafeCache<TKey, TValue, TListType, EGettersPromotionPolicy::Promoted, TArgs...>;
     };
 
-} 
- 
-template <class TKey, class TValue, class... TArgs> 
-using TThreadSafeCache = typename NPrivate::TLWHelper::template TCache<TKey, TValue, TArgs...>; 
+}
+
+template <class TKey, class TValue, class... TArgs>
+using TThreadSafeCache = typename NPrivate::TLWHelper::template TCache<TKey, TValue, TArgs...>;
 
 template <class TKey, class TValue, class... TArgs>
 using TThreadSafeLRUCache = typename NPrivate::TLRUHelper::template TCache<TKey, TValue, TArgs...>;

+ 12 - 12
library/cpp/cache/ut/cache_ut.cpp

@@ -356,30 +356,30 @@ Y_UNIT_TEST_SUITE(TCacheTest) {
         UNIT_ASSERT(s.Find(1) != s.End()); // Key 2 should have been deleted
     }
 }
- 
+
 Y_UNIT_TEST_SUITE(TThreadSafeCacheTest) {
     typedef TThreadSafeCache<ui32, TString, ui32> TCache;
- 
-    const char* VALS[] = {"abcd", "defg", "hjkl"}; 
- 
+
+    const char* VALS[] = {"abcd", "defg", "hjkl"};
+
     class TCallbacks: public TCache::ICallbacks {
-    public: 
+    public:
         TKey GetKey(ui32 i) const override {
-            return i; 
-        } 
+            return i;
+        }
         TValue* CreateObject(ui32 i) const override {
             Creations++;
             return new TString(VALS[i]);
-        } 
+        }
 
         mutable i32 Creations = 0;
-    }; 
- 
+    };
+
     Y_UNIT_TEST(SimpleTest) {
         for (ui32 i = 0; i < Y_ARRAY_SIZE(VALS); ++i) {
             const TString data = *TCache::Get<TCallbacks>(i);
             UNIT_ASSERT(data == VALS[i]);
-        } 
+        }
     }
 
     Y_UNIT_TEST(InsertUpdateTest) {
@@ -404,7 +404,7 @@ Y_UNIT_TEST_SUITE(TThreadSafeCacheTest) {
         UNIT_ASSERT(callbacks.Creations == 0);
         UNIT_ASSERT(*item == "hjk");
     }
-} 
+}
 
 Y_UNIT_TEST_SUITE(TThreadSafeCacheUnsafeTest) {
     typedef TThreadSafeCache<ui32, TString, ui32> TCache;

+ 2 - 2
library/cpp/digest/md5/md5.h

@@ -13,7 +13,7 @@ public:
 
     void Init();
 
-    inline MD5& Update(const void* data, size_t len) { 
+    inline MD5& Update(const void* data, size_t len) {
         return Update(MakeArrayRef(static_cast<const ui8*>(data), len));
     }
 
@@ -23,7 +23,7 @@ public:
 
     inline MD5& Update(const TArrayRef<const ui8> data) {
         UpdatePart(data);
-        return *this; 
+        return *this;
     }
 
     void Pad();

+ 2 - 2
library/cpp/histogram/ya.make

@@ -4,6 +4,6 @@ RECURSE(
     hdr/ut
     simple
     simple/ut
-    rt 
-    rt/ut 
+    rt
+    rt/ut
 )

Some files were not shown because too many files changed in this diff