aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/tvmauth/client/misc/api
diff options
context:
space:
mode:
authorfeldsherov <feldsherov@yandex-team.ru>2022-02-10 16:49:29 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:29 +0300
commit077ab504815199e62ffc54daee873cf1d6b64297 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/tvmauth/client/misc/api
parente73723ec73b27276cd45b9b46b752138a51d669c (diff)
downloadydb-077ab504815199e62ffc54daee873cf1d6b64297.tar.gz
Restoring authorship annotation for <feldsherov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/tvmauth/client/misc/api')
-rw-r--r--library/cpp/tvmauth/client/misc/api/dynamic_dst/tvm_client.cpp8
-rw-r--r--library/cpp/tvmauth/client/misc/api/dynamic_dst/tvm_client.h2
-rw-r--r--library/cpp/tvmauth/client/misc/api/dynamic_dst/ut/tvm_client_ut.cpp142
-rw-r--r--library/cpp/tvmauth/client/misc/api/settings.h12
-rw-r--r--library/cpp/tvmauth/client/misc/api/threaded_updater.cpp16
5 files changed, 90 insertions, 90 deletions
diff --git a/library/cpp/tvmauth/client/misc/api/dynamic_dst/tvm_client.cpp b/library/cpp/tvmauth/client/misc/api/dynamic_dst/tvm_client.cpp
index f441cc3c35..6ec15c0e88 100644
--- a/library/cpp/tvmauth/client/misc/api/dynamic_dst/tvm_client.cpp
+++ b/library/cpp/tvmauth/client/misc/api/dynamic_dst/tvm_client.cpp
@@ -53,10 +53,10 @@ namespace NTvmAuth::NDynamicClient {
{
}
- TTvmClient::~TTvmClient() {
- TBase::StopWorker();
- }
-
+ TTvmClient::~TTvmClient() {
+ TBase::StopWorker();
+ }
+
void TTvmClient::Worker() {
TBase::Worker();
ProcessTasks();
diff --git a/library/cpp/tvmauth/client/misc/api/dynamic_dst/tvm_client.h b/library/cpp/tvmauth/client/misc/api/dynamic_dst/tvm_client.h
index ed9ba237a5..58ed953b63 100644
--- a/library/cpp/tvmauth/client/misc/api/dynamic_dst/tvm_client.h
+++ b/library/cpp/tvmauth/client/misc/api/dynamic_dst/tvm_client.h
@@ -30,7 +30,7 @@ namespace NTvmAuth::NDynamicClient {
class TTvmClient: public NTvmApi::TThreadedUpdater {
public:
static TAsyncUpdaterPtr Create(const NTvmApi::TClientSettings& settings, TLoggerPtr logger);
- virtual ~TTvmClient();
+ virtual ~TTvmClient();
NThreading::TFuture<TAddResponse> Add(TDsts&& dsts);
std::optional<TString> GetOptionalServiceTicketFor(const TTvmId dst);
diff --git a/library/cpp/tvmauth/client/misc/api/dynamic_dst/ut/tvm_client_ut.cpp b/library/cpp/tvmauth/client/misc/api/dynamic_dst/ut/tvm_client_ut.cpp
index cd20efc4d9..89403c15e4 100644
--- a/library/cpp/tvmauth/client/misc/api/dynamic_dst/ut/tvm_client_ut.cpp
+++ b/library/cpp/tvmauth/client/misc/api/dynamic_dst/ut/tvm_client_ut.cpp
@@ -86,7 +86,7 @@ Y_UNIT_TEST_SUITE(DynamicClient) {
mutable std::vector<TString> Tickets;
};
- Y_UNIT_TEST(StartWithIncompleteTicketsSet) {
+ Y_UNIT_TEST(StartWithIncompleteTicketsSet) {
TInstant now = TInstant::Now();
CleanCache();
WriteFile("./service_tickets",
@@ -96,12 +96,12 @@ Y_UNIT_TEST_SUITE(DynamicClient) {
NTvmApi::TClientSettings s;
s.SetSelfTvmId(100500);
- s.EnableServiceTicketsFetchOptions("qwerty", {{"blackbox", 19}, {"kolmo", 213}}, false);
- s.SetDiskCacheDir(CACHE_DIR);
-
- auto l = MakeIntrusive<TLogger>();
-
- {
+ s.EnableServiceTicketsFetchOptions("qwerty", {{"blackbox", 19}, {"kolmo", 213}}, false);
+ s.SetDiskCacheDir(CACHE_DIR);
+
+ auto l = MakeIntrusive<TLogger>();
+
+ {
TOfflineUpdater client(s,
l,
false,
@@ -109,51 +109,51 @@ Y_UNIT_TEST_SUITE(DynamicClient) {
R"({"213" : { "error" : "some error"}})",
R"({"123" : { "ticket" : "service_ticket_3"}})",
});
- UNIT_ASSERT_VALUES_EQUAL(TClientStatus::IncompleteTicketsSet, client.GetStatus());
+ UNIT_ASSERT_VALUES_EQUAL(TClientStatus::IncompleteTicketsSet, client.GetStatus());
UNIT_ASSERT(client.GetCachedServiceTickets()->TicketsById.contains(19));
UNIT_ASSERT(!client.GetCachedServiceTickets()->TicketsById.contains(213));
UNIT_ASSERT(!client.GetCachedServiceTickets()->ErrorsById.contains(19));
UNIT_ASSERT(client.GetCachedServiceTickets()->ErrorsById.contains(213));
-
- NThreading::TFuture<TAddResponse> fut = client.Add({123});
- UNIT_ASSERT_VALUES_EQUAL(TClientStatus::IncompleteTicketsSet, client.GetStatus());
-
- client.Worker();
- UNIT_ASSERT_VALUES_EQUAL(TClientStatus::IncompleteTicketsSet, client.GetStatus());
-
+
+ NThreading::TFuture<TAddResponse> fut = client.Add({123});
+ UNIT_ASSERT_VALUES_EQUAL(TClientStatus::IncompleteTicketsSet, client.GetStatus());
+
+ client.Worker();
+ UNIT_ASSERT_VALUES_EQUAL(TClientStatus::IncompleteTicketsSet, client.GetStatus());
+
UNIT_ASSERT(client.GetCachedServiceTickets()->TicketsById.contains(19));
UNIT_ASSERT(!client.GetCachedServiceTickets()->TicketsById.contains(213));
UNIT_ASSERT(client.GetCachedServiceTickets()->TicketsById.contains(123));
UNIT_ASSERT(!client.GetCachedServiceTickets()->ErrorsById.contains(19));
UNIT_ASSERT(client.GetCachedServiceTickets()->ErrorsById.contains(213));
UNIT_ASSERT(!client.GetCachedServiceTickets()->ErrorsById.contains(123));
-
- UNIT_ASSERT(fut.HasValue());
- TAddResponse resp{
- {123, {EDstStatus::Success, ""}},
- };
- UNIT_ASSERT_VALUES_EQUAL(resp, fut.GetValue());
-
+
+ UNIT_ASSERT(fut.HasValue());
+ TAddResponse resp{
+ {123, {EDstStatus::Success, ""}},
+ };
+ UNIT_ASSERT_VALUES_EQUAL(resp, fut.GetValue());
+
UNIT_ASSERT(client.Tickets.empty());
-
- TDsts dsts{19, 123, 213};
- UNIT_ASSERT_VALUES_EQUAL(dsts, client.GetDsts());
-
- UNIT_ASSERT_EXCEPTION_CONTAINS(client.GetOptionalServiceTicketFor(213), TMissingServiceTicket, "some error");
- }
- }
-
- Y_UNIT_TEST(StartWithEmptyTicketsSet) {
+
+ TDsts dsts{19, 123, 213};
+ UNIT_ASSERT_VALUES_EQUAL(dsts, client.GetDsts());
+
+ UNIT_ASSERT_EXCEPTION_CONTAINS(client.GetOptionalServiceTicketFor(213), TMissingServiceTicket, "some error");
+ }
+ }
+
+ Y_UNIT_TEST(StartWithEmptyTicketsSet) {
CleanCache();
-
- NTvmApi::TClientSettings s;
- s.SetSelfTvmId(100500);
- s.EnableServiceTicketsFetchOptions("qwerty", {{"kolmo", 213}}, false);
- s.SetDiskCacheDir(CACHE_DIR);
-
- auto l = MakeIntrusive<TLogger>();
-
- {
+
+ NTvmApi::TClientSettings s;
+ s.SetSelfTvmId(100500);
+ s.EnableServiceTicketsFetchOptions("qwerty", {{"kolmo", 213}}, false);
+ s.SetDiskCacheDir(CACHE_DIR);
+
+ auto l = MakeIntrusive<TLogger>();
+
+ {
TOfflineUpdater client(s,
l,
false,
@@ -161,46 +161,46 @@ Y_UNIT_TEST_SUITE(DynamicClient) {
R"({"213" : { "error" : "some error"}})",
R"({"123" : { "ticket" : "3:serv:CBAQ__________9_IgYIlJEGEHs:CcafYQH-FF5XaXMuJrgLZj98bIC54cs1ZkcFS9VV_9YM9iOM_0PXCtMkdg85rFjxE_BMpg7bE8ZuoqNfdw0FPt0BAKNeISwlydj4o0IjY82--LZBpP8CRn-EpAnkRaDShdlfrcF2pk1SSmEX8xdyZVQEnkUPY0cHGlFnu231vnE"}})",
});
- UNIT_ASSERT_VALUES_EQUAL(TClientStatus::IncompleteTicketsSet, client.GetStatus());
+ UNIT_ASSERT_VALUES_EQUAL(TClientStatus::IncompleteTicketsSet, client.GetStatus());
UNIT_ASSERT(!client.GetCachedServiceTickets()->TicketsById.contains(213));
UNIT_ASSERT(client.GetCachedServiceTickets()->ErrorsById.contains(213));
- UNIT_ASSERT_EXCEPTION_CONTAINS(client.GetOptionalServiceTicketFor(213), TMissingServiceTicket, "some error");
-
- NThreading::TFuture<TAddResponse> fut = client.Add({123});
- UNIT_ASSERT_VALUES_EQUAL(TClientStatus::IncompleteTicketsSet, client.GetStatus());
-
- client.Worker();
- UNIT_ASSERT_VALUES_EQUAL(TClientStatus::IncompleteTicketsSet, client.GetStatus());
-
+ UNIT_ASSERT_EXCEPTION_CONTAINS(client.GetOptionalServiceTicketFor(213), TMissingServiceTicket, "some error");
+
+ NThreading::TFuture<TAddResponse> fut = client.Add({123});
+ UNIT_ASSERT_VALUES_EQUAL(TClientStatus::IncompleteTicketsSet, client.GetStatus());
+
+ client.Worker();
+ UNIT_ASSERT_VALUES_EQUAL(TClientStatus::IncompleteTicketsSet, client.GetStatus());
+
UNIT_ASSERT(!client.GetCachedServiceTickets()->TicketsById.contains(213));
UNIT_ASSERT(client.GetCachedServiceTickets()->TicketsById.contains(123));
UNIT_ASSERT(client.GetCachedServiceTickets()->ErrorsById.contains(213));
UNIT_ASSERT(!client.GetCachedServiceTickets()->ErrorsById.contains(123));
-
- UNIT_ASSERT(fut.HasValue());
- TAddResponse resp{
- {123, {EDstStatus::Success, ""}},
- };
- UNIT_ASSERT_VALUES_EQUAL(resp, fut.GetValue());
-
+
+ UNIT_ASSERT(fut.HasValue());
+ TAddResponse resp{
+ {123, {EDstStatus::Success, ""}},
+ };
+ UNIT_ASSERT_VALUES_EQUAL(resp, fut.GetValue());
+
UNIT_ASSERT(client.Tickets.empty());
-
- TDsts dsts{123, 213};
- UNIT_ASSERT_VALUES_EQUAL(dsts, client.GetDsts());
-
- UNIT_ASSERT_EXCEPTION_CONTAINS(client.GetOptionalServiceTicketFor(213), TMissingServiceTicket, "some error");
- }
- };
- Y_UNIT_TEST(StartWithIncompleteCacheAndAdd) {
- TInstant now = TInstant::Now();
+
+ TDsts dsts{123, 213};
+ UNIT_ASSERT_VALUES_EQUAL(dsts, client.GetDsts());
+
+ UNIT_ASSERT_EXCEPTION_CONTAINS(client.GetOptionalServiceTicketFor(213), TMissingServiceTicket, "some error");
+ }
+ };
+ Y_UNIT_TEST(StartWithIncompleteCacheAndAdd) {
+ TInstant now = TInstant::Now();
CleanCache();
WriteFile("./service_tickets",
- R"({"19" : { "ticket" : "3:serv:CBAQ__________9_IgYIKhCUkQY:CX"}})"
- "\t100500",
- now);
-
- NTvmApi::TClientSettings s;
- s.SetSelfTvmId(100500);
+ R"({"19" : { "ticket" : "3:serv:CBAQ__________9_IgYIKhCUkQY:CX"}})"
+ "\t100500",
+ now);
+
+ NTvmApi::TClientSettings s;
+ s.SetSelfTvmId(100500);
s.EnableServiceTicketsFetchOptions("qwerty", {{"blackbox", 19}, {"kolmo", 213}});
s.SetDiskCacheDir(CACHE_DIR);
diff --git a/library/cpp/tvmauth/client/misc/api/settings.h b/library/cpp/tvmauth/client/misc/api/settings.h
index f0050b65e7..715ab3e02c 100644
--- a/library/cpp/tvmauth/client/misc/api/settings.h
+++ b/library/cpp/tvmauth/client/misc/api/settings.h
@@ -163,9 +163,9 @@ namespace NTvmAuth::NTvmApi {
}
// Deprecated: set attributes directly
- void EnableServiceTicketsFetchOptions(const TStringBuf selfSecret,
- TDstMap&& dsts,
- const bool considerIncompleteTicketsSetAsError = true) {
+ void EnableServiceTicketsFetchOptions(const TStringBuf selfSecret,
+ TDstMap&& dsts,
+ const bool considerIncompleteTicketsSetAsError = true) {
IsIncompleteTicketsSetAnError = considerIncompleteTicketsSetAsError;
Secret = selfSecret;
@@ -179,9 +179,9 @@ namespace NTvmAuth::NTvmApi {
}
// Deprecated: set attributes directly
- void EnableServiceTicketsFetchOptions(const TStringBuf selfSecret,
- TDstVector&& dsts,
- const bool considerIncompleteTicketsSetAsError = true) {
+ void EnableServiceTicketsFetchOptions(const TStringBuf selfSecret,
+ TDstVector&& dsts,
+ const bool considerIncompleteTicketsSetAsError = true) {
IsIncompleteTicketsSetAnError = considerIncompleteTicketsSetAsError;
Secret = selfSecret;
FetchServiceTicketsForDsts = std::move(dsts);
diff --git a/library/cpp/tvmauth/client/misc/api/threaded_updater.cpp b/library/cpp/tvmauth/client/misc/api/threaded_updater.cpp
index 3b691042cd..a7df49c05d 100644
--- a/library/cpp/tvmauth/client/misc/api/threaded_updater.cpp
+++ b/library/cpp/tvmauth/client/misc/api/threaded_updater.cpp
@@ -50,7 +50,7 @@ namespace NTvmAuth::NTvmApi {
TClientStatus TThreadedUpdater::GetStatus() const {
const TClientStatus::ECode state = GetState();
- return TClientStatus(state, GetLastError(state == TClientStatus::Ok || state == TClientStatus::IncompleteTicketsSet));
+ return TClientStatus(state, GetLastError(state == TClientStatus::Ok || state == TClientStatus::IncompleteTicketsSet));
}
NRoles::TRolesPtr TThreadedUpdater::GetRoles() const {
@@ -72,10 +72,10 @@ namespace NTvmAuth::NTvmApi {
}
if (tickets->TicketsById.size() < Destinations_.size()) {
if (Settings_.IsIncompleteTicketsSetAnError) {
- return TClientStatus::Error;
- } else {
- return TClientStatus::IncompleteTicketsSet;
- }
+ return TClientStatus::Error;
+ } else {
+ return TClientStatus::IncompleteTicketsSet;
+ }
}
}
if ((Settings_.IsServiceTicketCheckingRequired() || Settings_.IsUserTicketCheckingRequired()) && ArePublicKeysInvalid(now)) {
@@ -375,9 +375,9 @@ namespace NTvmAuth::NTvmApi {
SetUpdateTimeOfServiceTickets(time);
- if (count > 0) {
- LogInfo(TStringBuilder() << "Cache was updated with " << count << " service ticket(s): " << time);
- }
+ if (count > 0) {
+ LogInfo(TStringBuilder() << "Cache was updated with " << count << " service ticket(s): " << time);
+ }
}
void TThreadedUpdater::UpdatePublicKeysCache(const TString& publicKeys, TInstant time) {