diff options
author | halin-george <halin-george@yandex-team.ru> | 2022-02-10 16:50:07 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:07 +0300 |
commit | 7c7a0655bcf00449b1fcacc2c658cc4d5c3aca7b (patch) | |
tree | 41c83fd863c44839297aff8b2c301ec6b1853244 /library/cpp | |
parent | 811ece47d06924d20a94f89d1b0f5cd37254a49c (diff) | |
download | ydb-7c7a0655bcf00449b1fcacc2c658cc4d5c3aca7b.tar.gz |
Restoring authorship annotation for <halin-george@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/coroutine/engine/impl.cpp | 2 | ||||
-rw-r--r-- | library/cpp/coroutine/engine/impl.h | 6 | ||||
-rw-r--r-- | library/cpp/coroutine/engine/trampoline.cpp | 2 | ||||
-rw-r--r-- | library/cpp/monlib/metrics/labels.h | 232 | ||||
-rw-r--r-- | library/cpp/threading/task_scheduler/task_scheduler.cpp | 6 | ||||
-rw-r--r-- | library/cpp/threading/task_scheduler/task_scheduler_ut.cpp | 2 | ||||
-rw-r--r-- | library/cpp/threading/task_scheduler/ut/ya.make | 16 | ||||
-rw-r--r-- | library/cpp/threading/task_scheduler/ya.make | 18 | ||||
-rw-r--r-- | library/cpp/yt/memory/ref_counted-inl.h | 4 | ||||
-rw-r--r-- | library/cpp/yt/yson_string/string.cpp | 6 | ||||
-rw-r--r-- | library/cpp/yt/yson_string/string.h | 4 |
11 files changed, 149 insertions, 149 deletions
diff --git a/library/cpp/coroutine/engine/impl.cpp b/library/cpp/coroutine/engine/impl.cpp index 7ae6f74051..ca532690a7 100644 --- a/library/cpp/coroutine/engine/impl.cpp +++ b/library/cpp/coroutine/engine/impl.cpp @@ -24,7 +24,7 @@ TCont::TCont(NCoro::NStack::IAllocator& allocator, NCoro::TTrampoline::TFunc func, const char* name) noexcept : Executor_(executor) - , Name_(name) + , Name_(name) , Trampoline_( allocator, stackSize, diff --git a/library/cpp/coroutine/engine/impl.h b/library/cpp/coroutine/engine/impl.h index 283a96ecf1..4154029c07 100644 --- a/library/cpp/coroutine/engine/impl.h +++ b/library/cpp/coroutine/engine/impl.h @@ -113,9 +113,9 @@ private: // TODO(velavokr): allow name storage owning (for generated names backed by TString) const char* Name_ = nullptr; - - NCoro::TTrampoline Trampoline_; - + + NCoro::TTrampoline Trampoline_; + TIntrusiveList<TJoinWait> Waiters_; bool Cancelled_ = false; bool Scheduled_ = false; diff --git a/library/cpp/coroutine/engine/trampoline.cpp b/library/cpp/coroutine/engine/trampoline.cpp index 10ea69ddc3..103177efef 100644 --- a/library/cpp/coroutine/engine/trampoline.cpp +++ b/library/cpp/coroutine/engine/trampoline.cpp @@ -16,7 +16,7 @@ namespace NCoro { TTrampoline::TTrampoline(NStack::IAllocator& allocator, ui32 stackSize, TFunc f, TCont* cont) noexcept : Stack_(allocator, stackSize, cont->Name()) - , Clo_{this, Stack_.Get(), cont->Name()} + , Clo_{this, Stack_.Get(), cont->Name()} , Ctx_(Clo_) , Func_(std::move(f)) , Cont_(cont) diff --git a/library/cpp/monlib/metrics/labels.h b/library/cpp/monlib/metrics/labels.h index 63dc997c28..285515cb9c 100644 --- a/library/cpp/monlib/metrics/labels.h +++ b/library/cpp/monlib/metrics/labels.h @@ -192,40 +192,40 @@ namespace NMonitoring { // TLabels /////////////////////////////////////////////////////////////////////////// template <typename TStringBackend> - class TLabelsImpl: public ILabels { + class TLabelsImpl: public ILabels { public: - using value_type = TLabelImpl<TStringBackend>; - - TLabelsImpl() = default; - - explicit TLabelsImpl(::NDetail::TReserveTag rt) - : Labels_(std::move(rt)) - {} - - explicit TLabelsImpl(size_t count) - : Labels_(count) - {} - - explicit TLabelsImpl(size_t count, const value_type& label) - : Labels_(count, label) - {} - - TLabelsImpl(std::initializer_list<value_type> il) - : Labels_(std::move(il)) - {} - - TLabelsImpl(const TLabelsImpl&) = default; - TLabelsImpl& operator=(const TLabelsImpl&) = default; - - TLabelsImpl(TLabelsImpl&&) noexcept = default; - TLabelsImpl& operator=(TLabelsImpl&&) noexcept = default; - + using value_type = TLabelImpl<TStringBackend>; + + TLabelsImpl() = default; + + explicit TLabelsImpl(::NDetail::TReserveTag rt) + : Labels_(std::move(rt)) + {} + + explicit TLabelsImpl(size_t count) + : Labels_(count) + {} + + explicit TLabelsImpl(size_t count, const value_type& label) + : Labels_(count, label) + {} + + TLabelsImpl(std::initializer_list<value_type> il) + : Labels_(std::move(il)) + {} + + TLabelsImpl(const TLabelsImpl&) = default; + TLabelsImpl& operator=(const TLabelsImpl&) = default; + + TLabelsImpl(TLabelsImpl&&) noexcept = default; + TLabelsImpl& operator=(TLabelsImpl&&) noexcept = default; + inline bool operator==(const TLabelsImpl& rhs) const { - return Labels_ == rhs.Labels_; + return Labels_ == rhs.Labels_; } inline bool operator!=(const TLabelsImpl& rhs) const { - return Labels_ != rhs.Labels_; + return Labels_ != rhs.Labels_; } bool Add(TStringBuf name, TStringBuf value) noexcept override { @@ -233,43 +233,43 @@ namespace NMonitoring { return false; } - Labels_.emplace_back(name, value); + Labels_.emplace_back(name, value); return true; } using ILabels::Add; bool Has(TStringBuf name) const noexcept override { - auto it = FindIf(Labels_, [name](const TLabelImpl<TStringBackend>& label) { + auto it = FindIf(Labels_, [name](const TLabelImpl<TStringBackend>& label) { return name == TStringBuf{label.Name()}; }); - return it != Labels_.end(); + return it != Labels_.end(); } bool Has(const TString& name) const noexcept { - auto it = FindIf(Labels_, [name](const TLabelImpl<TStringBackend>& label) { + auto it = FindIf(Labels_, [name](const TLabelImpl<TStringBackend>& label) { return name == TStringBuf{label.Name()}; }); - return it != Labels_.end(); + return it != Labels_.end(); } // XXX for backward compatibility TMaybe<TLabelImpl<TStringBackend>> Find(TStringBuf name) const { - auto it = FindIf(Labels_, [name](const TLabelImpl<TStringBackend>& label) { + auto it = FindIf(Labels_, [name](const TLabelImpl<TStringBackend>& label) { return name == TStringBuf{label.Name()}; }); - if (it == Labels_.end()) { + if (it == Labels_.end()) { return Nothing(); } return *it; } std::optional<const ILabel*> Get(TStringBuf name) const override { - auto it = FindIf(Labels_, [name] (auto&& l) { + auto it = FindIf(Labels_, [name] (auto&& l) { return name == l.Name(); }); - if (it == Labels_.end()) { + if (it == Labels_.end()) { return {}; } @@ -281,116 +281,116 @@ namespace NMonitoring { } TMaybe<TLabelImpl<TStringBackend>> Extract(TStringBuf name) { - auto it = FindIf(Labels_, [name](const TLabelImpl<TStringBackend>& label) { + auto it = FindIf(Labels_, [name](const TLabelImpl<TStringBackend>& label) { return name == TStringBuf{label.Name()}; }); - if (it == Labels_.end()) { + if (it == Labels_.end()) { return Nothing(); } TLabel tmp = *it; - Labels_.erase(it); + Labels_.erase(it); return tmp; } void SortByName() { - std::sort(Labels_.begin(), Labels_.end(), [](const auto& lhs, const auto& rhs) { + std::sort(Labels_.begin(), Labels_.end(), [](const auto& lhs, const auto& rhs) { return lhs.Name() < rhs.Name(); }); } inline size_t Hash() const noexcept override { - return TSimpleRangeHash()(Labels_); + return TSimpleRangeHash()(Labels_); } inline TLabel* Data() const noexcept { - return const_cast<TLabel*>(Labels_.data()); + return const_cast<TLabel*>(Labels_.data()); } inline size_t Size() const noexcept override { - return Labels_.size(); + return Labels_.size(); } inline bool Empty() const noexcept override { - return Labels_.empty(); + return Labels_.empty(); } inline void Clear() noexcept override { - Labels_.clear(); + Labels_.clear(); }; - TLabelImpl<TStringBackend>& front() { - return Labels_.front(); - } - - const TLabelImpl<TStringBackend>& front() const { - return Labels_.front(); - } - - TLabelImpl<TStringBackend>& back() { - return Labels_.back(); - } - - const TLabelImpl<TStringBackend>& back() const { - return Labels_.back(); - } - - TLabelImpl<TStringBackend>& operator[](size_t index) { - return Labels_[index]; - } - - const TLabelImpl<TStringBackend>& operator[](size_t index) const { - return Labels_[index]; - } - - TLabelImpl<TStringBackend>& at(size_t index) { - return Labels_.at(index); - } - - const TLabelImpl<TStringBackend>& at(size_t index) const { - return Labels_.at(index); - } - - size_t capacity() const { - return Labels_.capacity(); - } - - TLabelImpl<TStringBackend>* data() { - return Labels_.data(); - } - - const TLabelImpl<TStringBackend>* data() const { - return Labels_.data(); - } - - size_t size() const { - return Labels_.size(); - } - - bool empty() const { - return Labels_.empty(); - } - - void clear() { - Labels_.clear(); - } - - using ILabels::begin; - using ILabels::end; - - using iterator = ILabels::TIterator; - using const_iterator = iterator; - + TLabelImpl<TStringBackend>& front() { + return Labels_.front(); + } + + const TLabelImpl<TStringBackend>& front() const { + return Labels_.front(); + } + + TLabelImpl<TStringBackend>& back() { + return Labels_.back(); + } + + const TLabelImpl<TStringBackend>& back() const { + return Labels_.back(); + } + + TLabelImpl<TStringBackend>& operator[](size_t index) { + return Labels_[index]; + } + + const TLabelImpl<TStringBackend>& operator[](size_t index) const { + return Labels_[index]; + } + + TLabelImpl<TStringBackend>& at(size_t index) { + return Labels_.at(index); + } + + const TLabelImpl<TStringBackend>& at(size_t index) const { + return Labels_.at(index); + } + + size_t capacity() const { + return Labels_.capacity(); + } + + TLabelImpl<TStringBackend>* data() { + return Labels_.data(); + } + + const TLabelImpl<TStringBackend>* data() const { + return Labels_.data(); + } + + size_t size() const { + return Labels_.size(); + } + + bool empty() const { + return Labels_.empty(); + } + + void clear() { + Labels_.clear(); + } + + using ILabels::begin; + using ILabels::end; + + using iterator = ILabels::TIterator; + using const_iterator = iterator; + protected: - TVector<TLabelImpl<TStringBackend>>& AsVector() { - return Labels_; + TVector<TLabelImpl<TStringBackend>>& AsVector() { + return Labels_; } - const TVector<TLabelImpl<TStringBackend>>& AsVector() const { - return Labels_; + const TVector<TLabelImpl<TStringBackend>>& AsVector() const { + return Labels_; } - - private: - TVector<TLabelImpl<TStringBackend>> Labels_; + + private: + TVector<TLabelImpl<TStringBackend>> Labels_; }; using TLabels = TLabelsImpl<TString>; diff --git a/library/cpp/threading/task_scheduler/task_scheduler.cpp b/library/cpp/threading/task_scheduler/task_scheduler.cpp index 174dde4bf7..fc6c6c3082 100644 --- a/library/cpp/threading/task_scheduler/task_scheduler.cpp +++ b/library/cpp/threading/task_scheduler/task_scheduler.cpp @@ -1,4 +1,4 @@ -#include "task_scheduler.h" +#include "task_scheduler.h" #include <util/system/thread.h> #include <util/string/cast.h> @@ -44,7 +44,7 @@ TTaskScheduler::~TTaskScheduler() { try { Stop(); } catch (...) { - Cdbg << "task scheduled destruction error: " << CurrentExceptionMessage(); + Cdbg << "task scheduled destruction error: " << CurrentExceptionMessage(); } } @@ -201,7 +201,7 @@ void TTaskScheduler::WorkerFunc(TWorkerThread* thread) { try { repeat = toDo->Process(); } catch (...) { - Cdbg << "task scheduler error: " << CurrentExceptionMessage(); + Cdbg << "task scheduler error: " << CurrentExceptionMessage(); } } diff --git a/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp b/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp index 3b5203194a..28c6983ca2 100644 --- a/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp +++ b/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp @@ -5,7 +5,7 @@ #include <util/system/atomic.h> #include <util/generic/vector.h> -#include "task_scheduler.h" +#include "task_scheduler.h" class TTaskSchedulerTest: public TTestBase { UNIT_TEST_SUITE(TTaskSchedulerTest); diff --git a/library/cpp/threading/task_scheduler/ut/ya.make b/library/cpp/threading/task_scheduler/ut/ya.make index 07ee8b0877..4696c290dd 100644 --- a/library/cpp/threading/task_scheduler/ut/ya.make +++ b/library/cpp/threading/task_scheduler/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/threading/task_scheduler) - -OWNER(g:middle) - -SRCS( - task_scheduler_ut.cpp -) - -END() + +OWNER(g:middle) + +SRCS( + task_scheduler_ut.cpp +) + +END() diff --git a/library/cpp/threading/task_scheduler/ya.make b/library/cpp/threading/task_scheduler/ya.make index 5b14c0aa63..2964c97984 100644 --- a/library/cpp/threading/task_scheduler/ya.make +++ b/library/cpp/threading/task_scheduler/ya.make @@ -1,9 +1,9 @@ -LIBRARY() - -OWNER(g:middle) - -SRCS( - task_scheduler.cpp -) - -END() +LIBRARY() + +OWNER(g:middle) + +SRCS( + task_scheduler.cpp +) + +END() diff --git a/library/cpp/yt/memory/ref_counted-inl.h b/library/cpp/yt/memory/ref_counted-inl.h index e6d64fec18..3cbeb65703 100644 --- a/library/cpp/yt/memory/ref_counted-inl.h +++ b/library/cpp/yt/memory/ref_counted-inl.h @@ -71,7 +71,7 @@ Y_FORCE_INLINE int TRefCounter::GetRefCount() const noexcept Y_FORCE_INLINE void TRefCounter::Ref() const noexcept { - // It is safe to use relaxed here, since new reference is always created from another live reference. + // It is safe to use relaxed here, since new reference is always created from another live reference. StrongCount_.fetch_add(1, std::memory_order_relaxed); YT_ASSERT(WeakCount_.load(std::memory_order_relaxed) > 0); @@ -93,7 +93,7 @@ Y_FORCE_INLINE bool TRefCounter::Unref() const // // See http://www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html#boost_atomic.usage_examples.example_reference_counters // - auto oldStrongCount = StrongCount_.fetch_sub(1, std::memory_order_release); + auto oldStrongCount = StrongCount_.fetch_sub(1, std::memory_order_release); YT_ASSERT(oldStrongCount > 0); if (oldStrongCount == 1) { StrongCount_.load(std::memory_order_acquire); diff --git a/library/cpp/yt/yson_string/string.cpp b/library/cpp/yt/yson_string/string.cpp index 99d45e8616..b6880e1e03 100644 --- a/library/cpp/yt/yson_string/string.cpp +++ b/library/cpp/yt/yson_string/string.cpp @@ -34,10 +34,10 @@ TYsonStringBuf::TYsonStringBuf(const TString& data, EYsonType type) TYsonStringBuf::TYsonStringBuf(TStringBuf data, EYsonType type) : Data_(data) - , Type_(type) + , Type_(type) , Null_(false) -{ } - +{ } + TYsonStringBuf::TYsonStringBuf(const char* data, EYsonType type) : TYsonStringBuf(TStringBuf(data), type) { } diff --git a/library/cpp/yt/yson_string/string.h b/library/cpp/yt/yson_string/string.h index e13af37a6d..cf649e39aa 100644 --- a/library/cpp/yt/yson_string/string.h +++ b/library/cpp/yt/yson_string/string.h @@ -29,8 +29,8 @@ public: //! Constructs a non-null instance with given type and content. explicit TYsonStringBuf( TStringBuf data, - EYsonType type = EYsonType::Node); - + EYsonType type = EYsonType::Node); + //! Constructs a non-null instance with given type and content //! (without this overload there is no way to construct TYsonStringBuf from //! string literal). |