diff options
author | dima-zakharov <dima-zakharov@yandex-team.ru> | 2022-02-10 16:46:02 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:02 +0300 |
commit | 9ab30620977aa96ae9e9da959e2f7e1370cb796d (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c | |
parent | 41e8c41790ddd8d92722a09f7d4e1934aefff0c5 (diff) | |
download | ydb-9ab30620977aa96ae9e9da959e2f7e1370cb796d.tar.gz |
Restoring authorship annotation for <dima-zakharov@yandex-team.ru>. Commit 2 of 2.
-rw-r--r-- | build/rules/contrib_deps.policy | 4 | ||||
-rw-r--r-- | build/rules/contrib_python.policy | 6 | ||||
-rw-r--r-- | build/sysincl/misc.yml | 2 | ||||
-rw-r--r-- | contrib/restricted/ya.make | 4 | ||||
-rw-r--r-- | contrib/tools/ya.make | 6 | ||||
-rw-r--r-- | library/cpp/logger/log_ut.cpp | 110 | ||||
-rw-r--r-- | library/cpp/logger/thread.cpp | 30 | ||||
-rw-r--r-- | library/cpp/logger/thread.h | 8 | ||||
-rw-r--r-- | util/system/filemap.cpp | 8 | ||||
-rw-r--r-- | util/system/filemap.h | 10 |
10 files changed, 94 insertions, 94 deletions
diff --git a/build/rules/contrib_deps.policy b/build/rules/contrib_deps.policy index 2a282f2789..9af4b85cc2 100644 --- a/build/rules/contrib_deps.policy +++ b/build/rules/contrib_deps.policy @@ -65,8 +65,8 @@ ALLOW contrib/tests/subvertpy -> devtools/ya/yalibrary/svn/testing ALLOW contrib/tests/subvertpy -> library/python/windows ALLOW contrib/tests/subvertpy -> vcs/svn/wc/client -ALLOW contrib/tools/unbound -> infra/libs -ALLOW contrib/tools/unbound -> library/cpp/proto_config +ALLOW contrib/tools/unbound -> infra/libs +ALLOW contrib/tools/unbound -> library/cpp/proto_config ALLOW contrib/python/marshmallow-mongoengine/py[23]/tests -> library/python/pytest-mongodb diff --git a/build/rules/contrib_python.policy b/build/rules/contrib_python.policy index 58b808de9e..60fd149753 100644 --- a/build/rules/contrib_python.policy +++ b/build/rules/contrib_python.policy @@ -280,9 +280,9 @@ DENY .* -> contrib/python/face$ ALLOW contrib/python/webstruct -> contrib/python/webstruct ALLOW yweb/antimalware/direct/fraud_html_detector -> contrib/python/webstruct DENY .* -> contrib/python/webstruct - -ALLOW contrib/tools/unbound -> contrib/tools/unbound -DENY .* -> contrib/tools/unbound + +ALLOW contrib/tools/unbound -> contrib/tools/unbound +DENY .* -> contrib/tools/unbound # https://st.yandex-team.ru/CONTRIB-2042 ALLOW addappter/backend/addappter_backoffice -> contrib/python/sqlalchemy/sqlalchemy-1.2 diff --git a/build/sysincl/misc.yml b/build/sysincl/misc.yml index a116f8550f..e9e6095888 100644 --- a/build/sysincl/misc.yml +++ b/build/sysincl/misc.yml @@ -434,7 +434,7 @@ - alloc.h: contrib/libs/libsrtp/crypto/include/alloc.h - err.h: contrib/libs/libsrtp/crypto/include/err.h - stat.h: contrib/libs/libsrtp/crypto/include/stat.h - + - source_filter: "^contrib/restricted/openal-soft" includes: - threads.h: contrib/restricted/openal-soft/common/threads.h diff --git a/contrib/restricted/ya.make b/contrib/restricted/ya.make index 74c84b0809..b52a206733 100644 --- a/contrib/restricted/ya.make +++ b/contrib/restricted/ya.make @@ -47,8 +47,8 @@ RECURSE( noc openal-soft patched - protobuf-c - protoc-c + protobuf-c + protoc-c protozero range-v3 rnnoise diff --git a/contrib/tools/ya.make b/contrib/tools/ya.make index d4c40b1e71..750911c587 100644 --- a/contrib/tools/ya.make +++ b/contrib/tools/ya.make @@ -26,7 +26,7 @@ RECURSE( open-vcdiff/bin plantuml protoc - protoc-c + protoc-c protoc_std python python3 @@ -41,8 +41,8 @@ RECURSE( tpce-benchmark tpch-benchmark tre - unbound - unbound/build + unbound + unbound/build vowpal_wabbit wapiti word2vec diff --git a/library/cpp/logger/log_ut.cpp b/library/cpp/logger/log_ut.cpp index c5fd158c85..8de46f17f5 100644 --- a/library/cpp/logger/log_ut.cpp +++ b/library/cpp/logger/log_ut.cpp @@ -3,8 +3,8 @@ #include <library/cpp/testing/unittest/registar.h> #include <util/system/fs.h> -#include <util/system/rwlock.h> -#include <util/system/yield.h> +#include <util/system/rwlock.h> +#include <util/system/yield.h> #include <util/memory/blob.h> #include <util/stream/file.h> #include <util/generic/string.h> @@ -16,7 +16,7 @@ class TLogTest: public TTestBase { UNIT_TEST(TestFormat) UNIT_TEST(TestWrite) UNIT_TEST(TestThreaded) - UNIT_TEST(TestThreadedWithOverflow) + UNIT_TEST(TestThreadedWithOverflow) UNIT_TEST(TestNoFlush) UNIT_TEST_SUITE_END(); @@ -25,7 +25,7 @@ private: void TestFormat(); void TestWrite(); void TestThreaded(); - void TestThreadedWithOverflow(); + void TestThreadedWithOverflow(); void TestNoFlush(); void SetUp() override; void TearDown() override; @@ -78,59 +78,59 @@ void TLogTest::TestThreaded() { UNIT_ASSERT_EQUAL(TString((const char*)data.Begin(), data.Size()), "some useful data 12, 34, 3.000000, qwqwqw\n"); } -void TLogTest::TestThreadedWithOverflow() { - class TFakeLogBackend: public TLogBackend { - public: - TWriteGuard Guard() { - return TWriteGuard(Lock_); - } - - void WriteData(const TLogRecord&) override { - TReadGuard guard(Lock_); - } - - void ReopenLog() override { - TWriteGuard guard(Lock_); - } - - private: - TRWMutex Lock_; - }; - - auto waitForFreeQueue = [](const TLog& log) { - ThreadYield(); - while (log.BackEndQueueSize() > 0) { - Sleep(TDuration::MilliSeconds(1)); - } - }; - - TFakeLogBackend fb; - { +void TLogTest::TestThreadedWithOverflow() { + class TFakeLogBackend: public TLogBackend { + public: + TWriteGuard Guard() { + return TWriteGuard(Lock_); + } + + void WriteData(const TLogRecord&) override { + TReadGuard guard(Lock_); + } + + void ReopenLog() override { + TWriteGuard guard(Lock_); + } + + private: + TRWMutex Lock_; + }; + + auto waitForFreeQueue = [](const TLog& log) { + ThreadYield(); + while (log.BackEndQueueSize() > 0) { + Sleep(TDuration::MilliSeconds(1)); + } + }; + + TFakeLogBackend fb; + { TLog log(THolder(new TThreadedLogBackend(&fb, 2))); - - auto guard = fb.Guard(); - log.AddLog("first write"); - waitForFreeQueue(log); - log.AddLog("second write (first in queue)"); - log.AddLog("third write (second in queue)"); - UNIT_ASSERT_EXCEPTION(log.AddLog("fourth write (queue overflow)"), yexception); - } - - { - ui32 overflows = 0; + + auto guard = fb.Guard(); + log.AddLog("first write"); + waitForFreeQueue(log); + log.AddLog("second write (first in queue)"); + log.AddLog("third write (second in queue)"); + UNIT_ASSERT_EXCEPTION(log.AddLog("fourth write (queue overflow)"), yexception); + } + + { + ui32 overflows = 0; TLog log(THolder(new TThreadedLogBackend(&fb, 2, [&overflows] { ++overflows; }))); - - auto guard = fb.Guard(); - log.AddLog("first write"); - waitForFreeQueue(log); - log.AddLog("second write (first in queue)"); - log.AddLog("third write (second in queue)"); - UNIT_ASSERT_EQUAL(overflows, 0); - log.AddLog("fourth write (queue overflow)"); - UNIT_ASSERT_EQUAL(overflows, 1); - } -} - + + auto guard = fb.Guard(); + log.AddLog("first write"); + waitForFreeQueue(log); + log.AddLog("second write (first in queue)"); + log.AddLog("third write (second in queue)"); + UNIT_ASSERT_EQUAL(overflows, 0); + log.AddLog("fourth write (queue overflow)"); + UNIT_ASSERT_EQUAL(overflows, 1); + } +} + void TLogTest::TestNoFlush() { { TFileLogBackend fb(LOGFILE); diff --git a/library/cpp/logger/thread.cpp b/library/cpp/logger/thread.cpp index d12c5ee2fd..0ccf9e374b 100644 --- a/library/cpp/logger/thread.cpp +++ b/library/cpp/logger/thread.cpp @@ -58,9 +58,9 @@ class TThreadedLogBackend::TImpl { }; public: - inline TImpl(TLogBackend* slave, size_t queuelen, std::function<void()> queueOverflowCallback = {}) + inline TImpl(TLogBackend* slave, size_t queuelen, std::function<void()> queueOverflowCallback = {}) : Slave_(slave) - , QueueOverflowCallback_(std::move(queueOverflowCallback)) + , QueueOverflowCallback_(std::move(queueOverflowCallback)) { Queue_.Start(1, queuelen); } @@ -72,14 +72,14 @@ public: inline void WriteData(const TLogRecord& rec) { THolder<TRec> obj(new (rec.Len) TRec(this, rec)); - if (Queue_.Add(obj.Get())) { - Y_UNUSED(obj.Release()); - return; - } - - if (QueueOverflowCallback_) { - QueueOverflowCallback_(); - } else { + if (Queue_.Add(obj.Get())) { + Y_UNUSED(obj.Release()); + return; + } + + if (QueueOverflowCallback_) { + QueueOverflowCallback_(); + } else { ythrow yexception() << "log queue exhausted"; } } @@ -113,7 +113,7 @@ public: private: TLogBackend* Slave_; TThreadPool Queue_{"ThreadedLogBack"}; - const std::function<void()> QueueOverflowCallback_; + const std::function<void()> QueueOverflowCallback_; }; TThreadedLogBackend::TThreadedLogBackend(TLogBackend* slave) @@ -121,8 +121,8 @@ TThreadedLogBackend::TThreadedLogBackend(TLogBackend* slave) { } -TThreadedLogBackend::TThreadedLogBackend(TLogBackend* slave, size_t queuelen, std::function<void()> queueOverflowCallback) - : Impl_(new TImpl(slave, queuelen, std::move(queueOverflowCallback))) +TThreadedLogBackend::TThreadedLogBackend(TLogBackend* slave, size_t queuelen, std::function<void()> queueOverflowCallback) + : Impl_(new TImpl(slave, queuelen, std::move(queueOverflowCallback))) { } @@ -155,9 +155,9 @@ TOwningThreadedLogBackend::TOwningThreadedLogBackend(TLogBackend* slave) { } -TOwningThreadedLogBackend::TOwningThreadedLogBackend(TLogBackend* slave, size_t queuelen, std::function<void()> queueOverflowCallback) +TOwningThreadedLogBackend::TOwningThreadedLogBackend(TLogBackend* slave, size_t queuelen, std::function<void()> queueOverflowCallback) : THolder<TLogBackend>(slave) - , TThreadedLogBackend(Get(), queuelen, std::move(queueOverflowCallback)) + , TThreadedLogBackend(Get(), queuelen, std::move(queueOverflowCallback)) { } diff --git a/library/cpp/logger/thread.h b/library/cpp/logger/thread.h index ebb31e6218..65f7a88e87 100644 --- a/library/cpp/logger/thread.h +++ b/library/cpp/logger/thread.h @@ -4,12 +4,12 @@ #include <util/generic/ptr.h> -#include <functional> - +#include <functional> + class TThreadedLogBackend: public TLogBackend { public: TThreadedLogBackend(TLogBackend* slave); - TThreadedLogBackend(TLogBackend* slave, size_t queuelen, std::function<void()> queueOverflowCallback = {}); + TThreadedLogBackend(TLogBackend* slave, size_t queuelen, std::function<void()> queueOverflowCallback = {}); ~TThreadedLogBackend() override; void WriteData(const TLogRecord& rec) override; @@ -29,6 +29,6 @@ private: class TOwningThreadedLogBackend: private THolder<TLogBackend>, public TThreadedLogBackend { public: TOwningThreadedLogBackend(TLogBackend* slave); - TOwningThreadedLogBackend(TLogBackend* slave, size_t queuelen, std::function<void()> queueOverflowCallback = {}); + TOwningThreadedLogBackend(TLogBackend* slave, size_t queuelen, std::function<void()> queueOverflowCallback = {}); ~TOwningThreadedLogBackend() override; }; diff --git a/util/system/filemap.cpp b/util/system/filemap.cpp index cc8f0b4889..7454a4cb94 100644 --- a/util/system/filemap.cpp +++ b/util/system/filemap.cpp @@ -431,10 +431,10 @@ bool TMemoryMap::IsWritable() const noexcept { return Impl_->IsWritable(); } -TMemoryMap::EOpenMode TMemoryMap::GetMode() const noexcept { - return Impl_->GetMode(); -} - +TMemoryMap::EOpenMode TMemoryMap::GetMode() const noexcept { + return Impl_->GetMode(); +} + TFile TMemoryMap::GetFile() const noexcept { return Impl_->GetFile(); } diff --git a/util/system/filemap.h b/util/system/filemap.h index 645e01fddc..11be64bff4 100644 --- a/util/system/filemap.h +++ b/util/system/filemap.h @@ -89,7 +89,7 @@ public: i64 Length() const noexcept; bool IsOpen() const noexcept; bool IsWritable() const noexcept; - EOpenMode GetMode() const noexcept; + EOpenMode GetMode() const noexcept; TFile GetFile() const noexcept; void SetSequential(); @@ -150,10 +150,10 @@ public: return Map_.IsWritable(); } - EOpenMode GetMode() const noexcept { - return Map_.GetMode(); - } - + EOpenMode GetMode() const noexcept { + return Map_.GetMode(); + } + inline void* Ptr() const noexcept { return Region_.MappedData(); } |