aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/encode/buffered
diff options
context:
space:
mode:
authorprime <prime@yandex-team.ru>2022-02-10 16:46:01 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:01 +0300
commite34f3f0e381020a427f44fbd50463d9a04089db3 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/monlib/encode/buffered
parent3695a7cd42b74a4987d8d5a8f2e2443556998943 (diff)
downloadydb-e34f3f0e381020a427f44fbd50463d9a04089db3.tar.gz
Restoring authorship annotation for <prime@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/monlib/encode/buffered')
-rw-r--r--library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp36
-rw-r--r--library/cpp/monlib/encode/buffered/buffered_encoder_base.h2
-rw-r--r--library/cpp/monlib/encode/buffered/string_pool.cpp20
-rw-r--r--library/cpp/monlib/encode/buffered/string_pool.h2
-rw-r--r--library/cpp/monlib/encode/buffered/string_pool_ut.cpp8
5 files changed, 34 insertions, 34 deletions
diff --git a/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp b/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp
index 3f18e42d6e..87c832d642 100644
--- a/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp
+++ b/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp
@@ -89,25 +89,25 @@ void TBufferedEncoderBase::OnLabel(TStringBuf name, TStringBuf value) {
labels->emplace_back(LabelNamesPool_.PutIfAbsent(name), LabelValuesPool_.PutIfAbsent(value));
}
-void TBufferedEncoderBase::OnLabel(ui32 name, ui32 value) {
- TPooledLabels* labels;
- if (State_ == TEncoderState::EState::METRIC_LABELS) {
- labels = &Metrics_.back().Labels;
- } else if (State_ == TEncoderState::EState::COMMON_LABELS) {
- labels = &CommonLabels_;
- } else {
- State_.ThrowInvalid("expected LABELS or COMMON_LABELS");
- }
-
- labels->emplace_back(LabelNamesPool_.GetByIndex(name), LabelValuesPool_.GetByIndex(value));
-}
-
+void TBufferedEncoderBase::OnLabel(ui32 name, ui32 value) {
+ TPooledLabels* labels;
+ if (State_ == TEncoderState::EState::METRIC_LABELS) {
+ labels = &Metrics_.back().Labels;
+ } else if (State_ == TEncoderState::EState::COMMON_LABELS) {
+ labels = &CommonLabels_;
+ } else {
+ State_.ThrowInvalid("expected LABELS or COMMON_LABELS");
+ }
+
+ labels->emplace_back(LabelNamesPool_.GetByIndex(name), LabelValuesPool_.GetByIndex(value));
+}
+
std::pair<ui32, ui32> TBufferedEncoderBase::PrepareLabel(TStringBuf name, TStringBuf value) {
- auto nameLabel = LabelNamesPool_.PutIfAbsent(name);
- auto valueLabel = LabelValuesPool_.PutIfAbsent(value);
- return std::make_pair(nameLabel->Index, valueLabel->Index);
-}
-
+ auto nameLabel = LabelNamesPool_.PutIfAbsent(name);
+ auto valueLabel = LabelValuesPool_.PutIfAbsent(value);
+ return std::make_pair(nameLabel->Index, valueLabel->Index);
+}
+
void TBufferedEncoderBase::OnDouble(TInstant time, double value) {
State_.Expect(TEncoderState::EState::METRIC);
TMetric& metric = Metrics_.back();
diff --git a/library/cpp/monlib/encode/buffered/buffered_encoder_base.h b/library/cpp/monlib/encode/buffered/buffered_encoder_base.h
index 165d92203e..fe3714e58f 100644
--- a/library/cpp/monlib/encode/buffered/buffered_encoder_base.h
+++ b/library/cpp/monlib/encode/buffered/buffered_encoder_base.h
@@ -26,7 +26,7 @@ public:
void OnLabelsBegin() override;
void OnLabelsEnd() override;
void OnLabel(TStringBuf name, TStringBuf value) override;
- void OnLabel(ui32 name, ui32 value) override;
+ void OnLabel(ui32 name, ui32 value) override;
std::pair<ui32, ui32> PrepareLabel(TStringBuf name, TStringBuf value) override;
void OnDouble(TInstant time, double value) override;
diff --git a/library/cpp/monlib/encode/buffered/string_pool.cpp b/library/cpp/monlib/encode/buffered/string_pool.cpp
index d819e11ae7..b4c7988ba3 100644
--- a/library/cpp/monlib/encode/buffered/string_pool.cpp
+++ b/library/cpp/monlib/encode/buffered/string_pool.cpp
@@ -10,8 +10,8 @@ namespace NMonitoring {
auto [it, isInserted] = StrMap_.try_emplace(str, Max<ui32>(), 0);
if (isInserted) {
BytesSize_ += str.size();
- it->second.Index = StrVector_.size();
- StrVector_.emplace_back(it->first, &it->second);
+ it->second.Index = StrVector_.size();
+ StrVector_.emplace_back(it->first, &it->second);
}
TValue* value = &it->second;
@@ -19,10 +19,10 @@ namespace NMonitoring {
return value;
}
- const TStringPoolBuilder::TValue* TStringPoolBuilder::GetByIndex(ui32 index) const {
- return StrVector_.at(index).second;
- }
-
+ const TStringPoolBuilder::TValue* TStringPoolBuilder::GetByIndex(ui32 index) const {
+ return StrVector_.at(index).second;
+ }
+
TStringPoolBuilder& TStringPoolBuilder::Build() {
if (RequiresSorting_) {
// sort in reversed order
@@ -30,10 +30,10 @@ namespace NMonitoring {
return a.second->Frequency > b.second->Frequency;
});
- ui32 i = 0;
- for (auto& value : StrVector_) {
- value.second->Index = i++;
- }
+ ui32 i = 0;
+ for (auto& value : StrVector_) {
+ value.second->Index = i++;
+ }
}
IsBuilt_ = true;
diff --git a/library/cpp/monlib/encode/buffered/string_pool.h b/library/cpp/monlib/encode/buffered/string_pool.h
index e216cff388..00e5644608 100644
--- a/library/cpp/monlib/encode/buffered/string_pool.h
+++ b/library/cpp/monlib/encode/buffered/string_pool.h
@@ -22,7 +22,7 @@ namespace NMonitoring {
public:
const TValue* PutIfAbsent(TStringBuf str);
- const TValue* GetByIndex(ui32 index) const;
+ const TValue* GetByIndex(ui32 index) const;
/// Determines whether pool must be sorted by value frequencies
TStringPoolBuilder& SetSorted(bool sorted) {
diff --git a/library/cpp/monlib/encode/buffered/string_pool_ut.cpp b/library/cpp/monlib/encode/buffered/string_pool_ut.cpp
index 21839ccb47..9fc3421d0b 100644
--- a/library/cpp/monlib/encode/buffered/string_pool_ut.cpp
+++ b/library/cpp/monlib/encode/buffered/string_pool_ut.cpp
@@ -16,10 +16,10 @@ Y_UNIT_TEST_SUITE(TStringPoolTest) {
UNIT_ASSERT(h2 == h3);
UNIT_ASSERT_VALUES_EQUAL(h1->Frequency, 1);
- UNIT_ASSERT_VALUES_EQUAL(h1->Index, 0);
+ UNIT_ASSERT_VALUES_EQUAL(h1->Index, 0);
UNIT_ASSERT_VALUES_EQUAL(h2->Frequency, 2);
- UNIT_ASSERT_VALUES_EQUAL(h2->Index, 1);
+ UNIT_ASSERT_VALUES_EQUAL(h2->Index, 1);
UNIT_ASSERT_VALUES_EQUAL(strPool.BytesSize(), 6);
UNIT_ASSERT_VALUES_EQUAL(strPool.Count(), 2);
@@ -49,8 +49,8 @@ Y_UNIT_TEST_SUITE(TStringPoolTest) {
Y_UNIT_TEST(ForEach) {
TStringPoolBuilder strPool;
- strPool.SetSorted(true);
-
+ strPool.SetSorted(true);
+
strPool.PutIfAbsent("one");
strPool.PutIfAbsent("two");
strPool.PutIfAbsent("two");