Skip to content

Commit

Permalink
[*] use std::vector and std::string
Browse files Browse the repository at this point in the history
  • Loading branch information
Alek5andr-Kotov committed Feb 6, 2025
1 parent 28a1f28 commit f6d76f7
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions ydb/public/sdk/cpp/src/client/topic/ut/topic_to_table_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,12 @@ class TFixture : public NUnitTest::TBaseFixture {
ui64 GetTopicTabletId(const TActorId& actorId,
const TString& topicPath,
ui32 partition);
TVector<TString> GetTabletKeys(const TActorId& actorId,
ui64 tabletId);
TVector<TString> GetPQTabletDataKeys(const TActorId& actorId,
ui64 tabletId);
TVector<NKikimr::NPQ::TEvPqCache::TEvCacheKeysResponse::TKey> GetPQCacheKeys(const TActorId& actorId,
ui64 tabletId);
std::vector<std::string> GetTabletKeys(const TActorId& actorId,
ui64 tabletId);
std::vector<std::string> GetPQTabletDataKeys(const TActorId& actorId,
ui64 tabletId);
std::vector<NKikimr::NPQ::TEvPqCache::TEvCacheKeysResponse::TKey> GetPQCacheKeys(const TActorId& actorId,
ui64 tabletId);
NPQ::TWriteId GetTransactionWriteId(const TActorId& actorId,
ui64 tabletId);
void SendLongTxLockStatus(const TActorId& actorId,
Expand Down Expand Up @@ -1054,7 +1054,8 @@ ui64 TFixture::GetTopicTabletId(const TActorId& actorId, const TString& topicPat
return Max<ui64>();
}

TVector<TString> TFixture::GetTabletKeys(const TActorId& actorId, ui64 tabletId)
std::vector<std::string> TFixture::GetTabletKeys(const TActorId& actorId,
ui64 tabletId)
{
using TEvKeyValue = NKikimr::TEvKeyValue;

Expand All @@ -1079,7 +1080,7 @@ TVector<TString> TFixture::GetTabletKeys(const TActorId& actorId, ui64 tabletId)
UNIT_ASSERT_VALUES_EQUAL(response->Record.GetCookie(), 12345);
UNIT_ASSERT_VALUES_EQUAL(response->Record.ReadRangeResultSize(), 1);

TVector<TString> keys;
std::vector<std::string> keys;

auto& result = response->Record.GetReadRangeResult(0);
for (size_t i = 0; i < result.PairSize(); ++i) {
Expand All @@ -1090,12 +1091,12 @@ TVector<TString> TFixture::GetTabletKeys(const TActorId& actorId, ui64 tabletId)
return keys;
}

TVector<TString> TFixture::GetPQTabletDataKeys(const TActorId& actorId,
ui64 tabletId)
std::vector<std::string> TFixture::GetPQTabletDataKeys(const TActorId& actorId,
ui64 tabletId)
{
using namespace NKikimr::NPQ;

TVector<TString> keys;
std::vector<std::string> keys;

for (const auto& key : GetTabletKeys(actorId, tabletId)) {
if (key.empty() ||
Expand All @@ -1110,8 +1111,8 @@ TVector<TString> TFixture::GetPQTabletDataKeys(const TActorId& actorId,
return keys;
}

TVector<NKikimr::NPQ::TEvPqCache::TEvCacheKeysResponse::TKey> TFixture::GetPQCacheKeys(const TActorId& edge,
ui64 tabletId)
std::vector<NKikimr::NPQ::TEvPqCache::TEvCacheKeysResponse::TKey> TFixture::GetPQCacheKeys(const TActorId& edge,
ui64 tabletId)
{
using namespace NKikimr::NPQ;

Expand All @@ -1124,7 +1125,7 @@ TVector<NKikimr::NPQ::TEvPqCache::TEvCacheKeysResponse::TKey> TFixture::GetPQCac
TAutoPtr<IEventHandle> handle;
auto* result = runtime.GrabEdgeEvent<TEvPqCache::TEvCacheKeysResponse>(handle);

TVector<NKikimr::NPQ::TEvPqCache::TEvCacheKeysResponse::TKey> keys;
std::vector<NKikimr::NPQ::TEvPqCache::TEvCacheKeysResponse::TKey> keys;

for (const auto& key : result->Keys) {
if (key.TabletId == tabletId) {
Expand Down Expand Up @@ -1806,7 +1807,7 @@ void TFixture::CheckTabletKeys(const TString& topicName)
};

bool found;
TVector<TString> keys;
std::vector<std::string> keys;
for (size_t i = 0; i < 20; ++i) {
keys = GetTabletKeys(edge, tabletId);

Expand Down Expand Up @@ -1869,8 +1870,12 @@ void TFixture::EnsureKeysIsEqual(const TString& topicName, unsigned id)
std::sort(tabletKeys.begin(), tabletKeys.end());
std::sort(cacheKeys.begin(), cacheKeys.end(), compareBlobId);

auto toString = [](const std::string& s) -> TString {
return {s.begin(), s.end()};
};

for (size_t i = 0; i < tabletKeys.size(); ++i) {
const TKey key(tabletKeys[i]);
const TKey key(toString(tabletKeys[i]));
const auto& blobId = cacheKeys[i];

UNIT_ASSERT_VALUES_EQUAL_C(key.GetPartition().InternalPartitionId, blobId.Partition.InternalPartitionId,
Expand Down

0 comments on commit f6d76f7

Please sign in to comment.