diff options
author | emazhukin <emazhukin@yandex-team.ru> | 2022-02-10 16:48:57 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:57 +0300 |
commit | b53be0c12e1650189ff223aa1f3a646222a86057 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 | |
parent | 39c9b256341fc68d2d9f8e561ac985709f65f164 (diff) | |
download | ydb-b53be0c12e1650189ff223aa1f3a646222a86057.tar.gz |
Restoring authorship annotation for <emazhukin@yandex-team.ru>. Commit 2 of 2.
-rw-r--r-- | contrib/python/ya.make | 2 | ||||
-rw-r--r-- | library/cpp/cache/cache.cpp | 2 | ||||
-rw-r--r-- | library/cpp/cache/cache.h | 2 | ||||
-rw-r--r-- | library/cpp/cache/thread_safe_cache.cpp | 2 | ||||
-rw-r--r-- | library/cpp/cache/thread_safe_cache.h | 42 | ||||
-rw-r--r-- | library/cpp/cache/ut/cache_ut.cpp | 56 | ||||
-rw-r--r-- | library/cpp/cache/ut/ya.make | 10 | ||||
-rw-r--r-- | library/cpp/cache/ya.make | 16 | ||||
-rw-r--r-- | library/cpp/protobuf/json/json2proto.cpp | 16 | ||||
-rw-r--r-- | library/cpp/protobuf/json/ut/json2proto_ut.cpp | 12 | ||||
-rw-r--r-- | library/cpp/ya.make | 2 | ||||
-rw-r--r-- | util/digest/multi.h | 2 |
12 files changed, 82 insertions, 82 deletions
diff --git a/contrib/python/ya.make b/contrib/python/ya.make index c2b72423cd..d01ced9f3a 100644 --- a/contrib/python/ya.make +++ b/contrib/python/ya.make @@ -1030,7 +1030,7 @@ RECURSE( srptools srsly sshpubkeys - sshtunnel + sshtunnel stack-data starlette statsd diff --git a/library/cpp/cache/cache.cpp b/library/cpp/cache/cache.cpp index 656aac3a8d..05b26b0cf8 100644 --- a/library/cpp/cache/cache.cpp +++ b/library/cpp/cache/cache.cpp @@ -1 +1 @@ -#include "cache.h" +#include "cache.h" diff --git a/library/cpp/cache/cache.h b/library/cpp/cache/cache.h index 45a7b4a517..6dc997076d 100644 --- a/library/cpp/cache/cache.h +++ b/library/cpp/cache/cache.h @@ -4,7 +4,7 @@ #include <util/generic/ptr.h> #include <util/generic/intrlist.h> #include <util/generic/hash_set.h> -#include <util/generic/vector.h> +#include <util/generic/vector.h> #include <util/generic/yexception.h> #include <utility> diff --git a/library/cpp/cache/thread_safe_cache.cpp b/library/cpp/cache/thread_safe_cache.cpp index e4cbbc8719..de47076d6b 100644 --- a/library/cpp/cache/thread_safe_cache.cpp +++ b/library/cpp/cache/thread_safe_cache.cpp @@ -1 +1 @@ -#include "thread_safe_cache.h" +#include "thread_safe_cache.h" diff --git a/library/cpp/cache/thread_safe_cache.h b/library/cpp/cache/thread_safe_cache.h index 8c12fe2dae..71e1442717 100644 --- a/library/cpp/cache/thread_safe_cache.h +++ b/library/cpp/cache/thread_safe_cache.h @@ -36,19 +36,19 @@ namespace NPrivate { { } - bool Insert(const Key& key, const TPtr& value) { - if (!Contains(key)) { - TWriteGuard w(Mutex); - return Cache.Insert(key, value); - } - return false; - } - - void Update(const Key& key, const TPtr& value) { - TWriteGuard w(Mutex); - Cache.Update(key, value); - } - + bool Insert(const Key& key, const TPtr& value) { + if (!Contains(key)) { + TWriteGuard w(Mutex); + return Cache.Insert(key, value); + } + return false; + } + + void Update(const Key& key, const TPtr& value) { + TWriteGuard w(Mutex); + Cache.Update(key, value); + } + const TPtr Get(TArgs... args) const { return GetValue<true>(args...); } @@ -64,8 +64,8 @@ namespace NPrivate { void Erase(TArgs... args) { Key key = Callbacks.GetKey(args...); - if (!Contains(key)) { - return; + if (!Contains(key)) { + return; } TWriteGuard w(Mutex); typename TInternalCache::TIterator i = Cache.Find(key); @@ -75,12 +75,12 @@ namespace NPrivate { Cache.Erase(i); } - bool Contains(const Key& key) const { - TReadGuard r(Mutex); - auto iter = Cache.FindWithoutPromote(key); - return iter != Cache.End(); - } - + bool Contains(const Key& key) const { + TReadGuard r(Mutex); + auto iter = Cache.FindWithoutPromote(key); + return iter != Cache.End(); + } + template <class TCallbacks> static const TPtr Get(TArgs... args) { return TThreadSafeCacheSingleton<TCallbacks>::Get(args...); diff --git a/library/cpp/cache/ut/cache_ut.cpp b/library/cpp/cache/ut/cache_ut.cpp index 36c7d509d9..329872cfde 100644 --- a/library/cpp/cache/ut/cache_ut.cpp +++ b/library/cpp/cache/ut/cache_ut.cpp @@ -1,5 +1,5 @@ -#include <library/cpp/cache/cache.h> -#include <library/cpp/cache/thread_safe_cache.h> +#include <library/cpp/cache/cache.h> +#include <library/cpp/cache/thread_safe_cache.h> #include <library/cpp/testing/unittest/registar.h> struct TStrokaWeighter { @@ -368,11 +368,11 @@ Y_UNIT_TEST_SUITE(TThreadSafeCacheTest) { return i; } TValue* CreateObject(ui32 i) const override { - Creations++; + Creations++; return new TString(VALS[i]); } - - mutable i32 Creations = 0; + + mutable i32 Creations = 0; }; Y_UNIT_TEST(SimpleTest) { @@ -381,29 +381,29 @@ Y_UNIT_TEST_SUITE(TThreadSafeCacheTest) { UNIT_ASSERT(data == VALS[i]); } } - - Y_UNIT_TEST(InsertUpdateTest) { - TCallbacks callbacks; - TCache cache(callbacks, 10); - - cache.Insert(2, MakeAtomicShared<TString>("hj")); - TAtomicSharedPtr<TString> item = cache.Get(2); - - UNIT_ASSERT(callbacks.Creations == 0); - UNIT_ASSERT(*item == "hj"); - - cache.Insert(2, MakeAtomicShared<TString>("hjk")); - item = cache.Get(2); - - UNIT_ASSERT(callbacks.Creations == 0); - UNIT_ASSERT(*item == "hj"); - - cache.Update(2, MakeAtomicShared<TString>("hjk")); - item = cache.Get(2); - - UNIT_ASSERT(callbacks.Creations == 0); - UNIT_ASSERT(*item == "hjk"); - } + + Y_UNIT_TEST(InsertUpdateTest) { + TCallbacks callbacks; + TCache cache(callbacks, 10); + + cache.Insert(2, MakeAtomicShared<TString>("hj")); + TAtomicSharedPtr<TString> item = cache.Get(2); + + UNIT_ASSERT(callbacks.Creations == 0); + UNIT_ASSERT(*item == "hj"); + + cache.Insert(2, MakeAtomicShared<TString>("hjk")); + item = cache.Get(2); + + UNIT_ASSERT(callbacks.Creations == 0); + UNIT_ASSERT(*item == "hj"); + + cache.Update(2, MakeAtomicShared<TString>("hjk")); + item = cache.Get(2); + + UNIT_ASSERT(callbacks.Creations == 0); + UNIT_ASSERT(*item == "hjk"); + } } Y_UNIT_TEST_SUITE(TThreadSafeCacheUnsafeTest) { diff --git a/library/cpp/cache/ut/ya.make b/library/cpp/cache/ut/ya.make index bb61612e0c..f660872369 100644 --- a/library/cpp/cache/ut/ya.make +++ b/library/cpp/cache/ut/ya.make @@ -1,12 +1,12 @@ UNITTEST() -OWNER( - g:util - vskipin -) +OWNER( + g:util + vskipin +) PEERDIR( - library/cpp/cache + library/cpp/cache ) SRCS( diff --git a/library/cpp/cache/ya.make b/library/cpp/cache/ya.make index 8987af0f5c..fd73032bf8 100644 --- a/library/cpp/cache/ya.make +++ b/library/cpp/cache/ya.make @@ -1,16 +1,16 @@ LIBRARY() -OWNER( - g:util -) +OWNER( + g:util +) SRCS( cache.cpp - thread_safe_cache.cpp + thread_safe_cache.cpp ) END() - -RECURSE_FOR_TESTS( - ut -) + +RECURSE_FOR_TESTS( + ut +) diff --git a/library/cpp/protobuf/json/json2proto.cpp b/library/cpp/protobuf/json/json2proto.cpp index fc602e990f..640c10f5a5 100644 --- a/library/cpp/protobuf/json/json2proto.cpp +++ b/library/cpp/protobuf/json/json2proto.cpp @@ -292,11 +292,11 @@ Json2RepeatedFieldValue(const NJson::TJsonValue& jsonValue, Y_ASSERT(!!innerProto); if (key.Defined()) { const FieldDescriptor* keyField = innerProto->GetDescriptor()->FindFieldByName("key"); - Y_ENSURE(keyField, "Map entry key field not found: " << field.name()); + Y_ENSURE(keyField, "Map entry key field not found: " << field.name()); SetKey(*innerProto, *keyField, *key); const FieldDescriptor* valueField = innerProto->GetDescriptor()->FindFieldByName("value"); - Y_ENSURE(valueField, "Map entry value field not found."); + Y_ENSURE(valueField, "Map entry value field not found."); Json2SingleField(jsonValue, *innerProto, *valueField, config, /*isMapValue=*/true); } else { NProtobufJson::MergeJson2Proto(jsonValue, *innerProto, config); @@ -327,12 +327,12 @@ Json2RepeatedField(const NJson::TJsonValue& json, return; bool isMap = fieldJson.GetType() == NJson::JSON_MAP; - if (isMap) { - if (!config.MapAsObject) { - ythrow yexception() << "Map as object representation is not allowed, field: " << field.name(); - } else if (!field.is_map() && !fieldJson.GetMap().empty()) { - ythrow yexception() << "Field " << field.name() << " is not a map."; - } + if (isMap) { + if (!config.MapAsObject) { + ythrow yexception() << "Map as object representation is not allowed, field: " << field.name(); + } else if (!field.is_map() && !fieldJson.GetMap().empty()) { + ythrow yexception() << "Field " << field.name() << " is not a map."; + } } if (fieldJson.GetType() != NJson::JSON_ARRAY && !config.MapAsObject && !config.VectorizeScalars && !config.ValueVectorizer) { diff --git a/library/cpp/protobuf/json/ut/json2proto_ut.cpp b/library/cpp/protobuf/json/ut/json2proto_ut.cpp index 5da7b7bf1f..0dfe57bc7a 100644 --- a/library/cpp/protobuf/json/ut/json2proto_ut.cpp +++ b/library/cpp/protobuf/json/ut/json2proto_ut.cpp @@ -520,13 +520,13 @@ Y_UNIT_TEST(TestInvalidJson) { UNIT_ASSERT_EXCEPTION(Json2Proto(val, proto), yexception); } -Y_UNIT_TEST(TestInvalidRepeatedFieldWithMapAsObject) { - TCompositeRepeated proto; - TJson2ProtoConfig config; - config.MapAsObject = true; +Y_UNIT_TEST(TestInvalidRepeatedFieldWithMapAsObject) { + TCompositeRepeated proto; + TJson2ProtoConfig config; + config.MapAsObject = true; UNIT_ASSERT_EXCEPTION(Json2Proto(TStringBuf(R"({"Part":{"Boo":{}}})"), proto, config), yexception); -} - +} + Y_UNIT_TEST(TestStringTransforms) { // Check that strings and bytes are transformed { diff --git a/library/cpp/ya.make b/library/cpp/ya.make index 1ee92de56f..8c1193b007 100644 --- a/library/cpp/ya.make +++ b/library/cpp/ya.make @@ -164,7 +164,7 @@ RECURSE( infected_masks/ut int128 int128/ut - introspection + introspection ipmath ipreg ipreg/ut diff --git a/util/digest/multi.h b/util/digest/multi.h index 36a95027d9..8e4597c9dc 100644 --- a/util/digest/multi.h +++ b/util/digest/multi.h @@ -9,6 +9,6 @@ constexpr size_t MultiHash(const TOne& one) noexcept { return THash<TOne>()(one); } template <typename THead, typename... TTail> -constexpr size_t MultiHash(const THead& head, const TTail&... tail) noexcept { +constexpr size_t MultiHash(const THead& head, const TTail&... tail) noexcept { return CombineHashes(MultiHash(tail...), THash<THead>()(head)); } |