aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/actors/testlib
diff options
context:
space:
mode:
authorsingle <single@yandex-team.ru>2022-02-10 16:50:29 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:29 +0300
commit8ae96df130bbede609c3504aa9af1bc6ff5361b3 (patch)
tree4751832974bd75ca721269aa54faa15d76032dfb /library/cpp/actors/testlib
parent5d4e7b7c923852e0f6398791ec98a60cf9faab46 (diff)
downloadydb-8ae96df130bbede609c3504aa9af1bc6ff5361b3.tar.gz
Restoring authorship annotation for <single@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/actors/testlib')
-rw-r--r--library/cpp/actors/testlib/test_runtime.cpp64
-rw-r--r--library/cpp/actors/testlib/test_runtime.h26
-rw-r--r--library/cpp/actors/testlib/ya.make36
3 files changed, 63 insertions, 63 deletions
diff --git a/library/cpp/actors/testlib/test_runtime.cpp b/library/cpp/actors/testlib/test_runtime.cpp
index 6fa25b99656..7c4871399d4 100644
--- a/library/cpp/actors/testlib/test_runtime.cpp
+++ b/library/cpp/actors/testlib/test_runtime.cpp
@@ -1,4 +1,4 @@
-#include "test_runtime.h"
+#include "test_runtime.h"
#include <library/cpp/actors/core/actor_bootstrapped.h>
#include <library/cpp/actors/core/callstack.h>
@@ -22,16 +22,16 @@
bool VERBOSE = false;
const bool PRINT_EVENT_BODY = false;
-namespace {
-
- TString MakeClusterId() {
- pid_t pid = getpid();
- TStringBuilder uuid;
- uuid << "Cluster for process with id: " << pid;
- return uuid;
- }
-}
+namespace {
+ TString MakeClusterId() {
+ pid_t pid = getpid();
+ TStringBuilder uuid;
+ uuid << "Cluster for process with id: " << pid;
+ return uuid;
+ }
+}
+
namespace NActors {
ui64 TScheduledEventQueueItem::NextUniqueId = 0;
@@ -80,7 +80,7 @@ namespace NActors {
TTestActorRuntimeBase::TNodeDataBase::~TNodeDataBase() {
Stop();
}
-
+
class TTestActorRuntimeBase::TEdgeActor : public TActor<TEdgeActor> {
public:
@@ -326,7 +326,7 @@ namespace NActors {
}
TDuration delay = (deadline - now);
- if (Runtime->SingleSysEnv || !Runtime->ScheduledEventFilterFunc(*Runtime, ev, delay, deadline)) {
+ if (Runtime->SingleSysEnv || !Runtime->ScheduledEventFilterFunc(*Runtime, ev, delay, deadline)) {
ui32 mailboxHint = ev->GetRecipientRewrite().Hint();
Runtime->GetMailbox(Runtime->FirstNodeId + NodeIndex, mailboxHint).Schedule(TScheduledEventQueueItem(deadline, ev, cookie));
Runtime->MailboxesHasEvents.Signal();
@@ -365,7 +365,7 @@ namespace NActors {
}
ui32 mailboxHint = ev->GetRecipientRewrite().Hint();
- if (ev->GetTypeRewrite() == ui32(NActors::NLog::EEv::Log)) {
+ if (ev->GetTypeRewrite() == ui32(NActors::NLog::EEv::Log)) {
const NActors::TActorId loggerActorId = NActors::TActorId(nodeId, "logger");
TActorId logger = node->ActorSystem->LookupLocalService(loggerActorId);
if (ev->GetRecipientRewrite() == logger) {
@@ -451,15 +451,15 @@ namespace NActors {
TTestActorRuntimeBase::TTestActorRuntimeBase(THeSingleSystemEnv)
: TTestActorRuntimeBase(1, 1, false)
- {
- SingleSysEnv = true;
- }
-
+ {
+ SingleSysEnv = true;
+ }
+
TTestActorRuntimeBase::TTestActorRuntimeBase(ui32 nodeCount, ui32 dataCenterCount, bool useRealThreads)
: ScheduledCount(0)
, ScheduledLimit(100000)
, MainThreadId(TThread::CurrentThreadId())
- , ClusterUUID(MakeClusterId())
+ , ClusterUUID(MakeClusterId())
, FirstNodeId(NextNodeId)
, NodeCount(nodeCount)
, DataCenterCount(dataCenterCount)
@@ -741,7 +741,7 @@ namespace NActors {
void TTestActorRuntimeBase::InitNodes() {
NextNodeId += NodeCount;
Y_VERIFY(NodeCount > 0);
-
+
for (ui32 nodeIndex = 0; nodeIndex < NodeCount; ++nodeIndex) {
auto nodeIt = Nodes.emplace(FirstNodeId + nodeIndex, GetNodeFactory().CreateNode()).first;
TNodeDataBase* node = nodeIt->second.Get();
@@ -900,7 +900,7 @@ namespace NActors {
const TActorId actorId(FirstNodeId + nodeIndex, poolId, localActorId, hint);
ActorNames[actorId] = TypeName(*actor);
RegistrationObserver(*this, parentId ? parentId : CurrentRecipient, actorId);
- DoActorInit(node->ActorSystem.Get(), actor, actorId, parentId ? parentId : CurrentRecipient);
+ DoActorInit(node->ActorSystem.Get(), actor, actorId, parentId ? parentId : CurrentRecipient);
switch (mailboxType) {
case TMailboxType::Simple:
@@ -944,7 +944,7 @@ namespace NActors {
const TActorId actorId(FirstNodeId + nodeIndex, poolId, localActorId, hint);
ActorNames[actorId] = TypeName(*actor);
RegistrationObserver(*this, parentId ? parentId : CurrentRecipient, actorId);
- DoActorInit(node->ActorSystem.Get(), actor, actorId, parentId ? parentId : CurrentRecipient);
+ DoActorInit(node->ActorSystem.Get(), actor, actorId, parentId ? parentId : CurrentRecipient);
return actorId;
}
@@ -1583,7 +1583,7 @@ namespace NActors {
TCallstack::GetTlsCallstack().SetLinesToSkip();
#endif
recipientActor->Receive(evHolder, ctx);
- node->ExecutorThread->DropUnregistered();
+ node->ExecutorThread->DropUnregistered();
}
CurrentRecipient = TActorId();
TlsActivationContext = prevTlsActivationContext;
@@ -1683,24 +1683,24 @@ namespace NActors {
NActors::TMailboxType::Simple, InterconnectPoolId()));
}
- if (!SingleSysEnv) { // Single system env should do this self
- TAutoPtr<TLogBackend> logBackend = LogBackend ? LogBackend : NActors::CreateStderrBackend();
- NActors::TLoggerActor *loggerActor = new NActors::TLoggerActor(node->LogSettings,
+ if (!SingleSysEnv) { // Single system env should do this self
+ TAutoPtr<TLogBackend> logBackend = LogBackend ? LogBackend : NActors::CreateStderrBackend();
+ NActors::TLoggerActor *loggerActor = new NActors::TLoggerActor(node->LogSettings,
logBackend, GetCountersForComponent(node->DynamicCounters, "utils"));
NActors::TActorSetupCmd loggerActorCmd(loggerActor, NActors::TMailboxType::Simple, node->GetLoggerPoolId());
std::pair<NActors::TActorId, NActors::TActorSetupCmd> loggerActorPair(node->LogSettings->LoggerActorId, loggerActorCmd);
- setup->LocalServices.push_back(loggerActorPair);
- }
+ setup->LocalServices.push_back(loggerActorPair);
+ }
return THolder<TActorSystem>(new TActorSystem(setup, node->GetAppData(), node->LogSettings));
}
TActorSystem* TTestActorRuntimeBase::SingleSys() const {
- Y_VERIFY(Nodes.size() == 1, "Works only for single system env");
-
- return Nodes.begin()->second->ActorSystem.Get();
- }
-
+ Y_VERIFY(Nodes.size() == 1, "Works only for single system env");
+
+ return Nodes.begin()->second->ActorSystem.Get();
+ }
+
TActorSystem* TTestActorRuntimeBase::GetAnyNodeActorSystem() {
for (auto& x : Nodes) {
return x.second->ActorSystem.Get();
diff --git a/library/cpp/actors/testlib/test_runtime.h b/library/cpp/actors/testlib/test_runtime.h
index 26e3b45c984..38e964835c4 100644
--- a/library/cpp/actors/testlib/test_runtime.h
+++ b/library/cpp/actors/testlib/test_runtime.h
@@ -39,8 +39,8 @@ const TDuration DEFAULT_DISPATCH_TIMEOUT = NSan::PlainOrUnderSanitizer(
namespace NActors {
- struct THeSingleSystemEnv { };
-
+ struct THeSingleSystemEnv { };
+
struct TEventMailboxId {
TEventMailboxId()
: NodeId(0)
@@ -200,7 +200,7 @@ namespace NActors {
typedef std::function<bool(TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event)> TEventFilter;
typedef std::function<bool(TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event, TDuration delay, TInstant& deadline)> TScheduledEventFilter;
typedef std::function<void(TTestActorRuntimeBase& runtime, const TActorId& parentId, const TActorId& actorId)> TRegistrationObserver;
-
+
TTestActorRuntimeBase(THeSingleSystemEnv);
TTestActorRuntimeBase(ui32 nodeCount, ui32 dataCenterCount, bool UseRealThreads);
@@ -284,7 +284,7 @@ namespace NActors {
return Nodes[FirstNodeId + nodeIdx]->LogSettings;
}
- TActorSystem* SingleSys() const;
+ TActorSystem* SingleSys() const;
TActorSystem* GetAnyNodeActorSystem();
TActorSystem* GetActorSystem(ui32 nodeId);
template <typename TEvent>
@@ -471,12 +471,12 @@ namespace NActors {
UseRealInterconnect = true;
}
- protected:
+ protected:
struct TNodeDataBase;
TNodeDataBase* GetRawNode(ui32 node) const {
- return Nodes.at(FirstNodeId + node).Get();
- }
-
+ return Nodes.at(FirstNodeId + node).Get();
+ }
+
static IExecutorPool* CreateExecutorPoolStub(TTestActorRuntimeBase* runtime, ui32 nodeIndex, TNodeDataBase* node, ui32 poolId);
virtual TIntrusivePtr<NMonitoring::TDynamicCounters> GetCountersForComponent(TIntrusivePtr<NMonitoring::TDynamicCounters> counters, const char* component) {
Y_UNUSED(counters);
@@ -492,7 +492,7 @@ namespace NActors {
Y_UNUSED(setup);
}
- private:
+ private:
IActor* FindActor(const TActorId& actorId, TNodeDataBase* node) const;
void SendInternal(IEventHandle* ev, ui32 nodeIndex, bool viaActorSystem);
TEventMailBox& GetMailbox(ui32 nodeId, ui32 hint);
@@ -507,12 +507,12 @@ namespace NActors {
THolder<TTempDir> TmpDir;
const TThread::TId MainThreadId;
- protected:
+ protected:
bool UseRealInterconnect = false;
TInterconnectMock InterconnectMock;
bool IsInitialized = false;
bool SingleSysEnv = false;
- const TString ClusterUUID;
+ const TString ClusterUUID;
const ui32 FirstNodeId;
const ui32 NodeCount;
const ui32 DataCenterCount;
@@ -535,7 +535,7 @@ namespace NActors {
TIntrusivePtr<IRandomProvider> RandomProvider;
TIntrusivePtr<ITimeProvider> TimeProvider;
- protected:
+ protected:
struct TNodeDataBase: public TThrRefBase {
TNodeDataBase();
void Stop();
@@ -598,7 +598,7 @@ namespace NActors {
protected:
THolder<INodeFactory> NodeFactory{new TDefaultNodeFactory};
- private:
+ private:
void InitNode(TNodeDataBase* node, size_t idx);
struct TDispatchContext {
diff --git a/library/cpp/actors/testlib/ya.make b/library/cpp/actors/testlib/ya.make
index 1afb3f60591..87dc50175ea 100644
--- a/library/cpp/actors/testlib/ya.make
+++ b/library/cpp/actors/testlib/ya.make
@@ -1,26 +1,26 @@
-LIBRARY()
-
-OWNER(
- g:kikimr
-)
-
-SRCS(
- test_runtime.cpp
-)
-
-PEERDIR(
+LIBRARY()
+
+OWNER(
+ g:kikimr
+)
+
+SRCS(
+ test_runtime.cpp
+)
+
+PEERDIR(
library/cpp/actors/core
library/cpp/actors/interconnect/mock
library/cpp/actors/protos
library/cpp/random_provider
library/cpp/time_provider
-)
-
-IF (GCC)
- CFLAGS(-fno-devirtualize-speculatively)
-ENDIF()
-
-END()
+)
+
+IF (GCC)
+ CFLAGS(-fno-devirtualize-speculatively)
+ENDIF()
+
+END()
RECURSE_FOR_TESTS(
ut