aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authorxenoxeno <xeno@ydb.tech>2023-04-14 19:33:25 +0300
committerxenoxeno <xeno@ydb.tech>2023-04-14 19:33:25 +0300
commitdf5ff1cecdb0e5b003bac878ed54c7b5bf168009 (patch)
tree3681eb0f167229ba21a7005ce9b60cb18221f2ca /library/cpp
parent54a1101ec4016353864a87ca24d4e97fa58b747d (diff)
downloadydb-df5ff1cecdb0e5b003bac878ed54c7b5bf168009.tar.gz
getting rid of TActorContext in state functions
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/actors/core/actor.cpp6
-rw-r--r--library/cpp/actors/core/actor.h21
-rw-r--r--library/cpp/actors/core/actor_bootstrapped.h4
-rw-r--r--library/cpp/actors/core/actor_ut.cpp8
-rw-r--r--library/cpp/actors/core/executor_pool_basic_ut.cpp1
-rw-r--r--library/cpp/actors/core/executor_pool_united_ut.cpp1
-rw-r--r--library/cpp/actors/core/executor_thread.cpp2
-rw-r--r--library/cpp/actors/core/hfunc.h24
-rw-r--r--library/cpp/actors/core/log.h12
-rw-r--r--library/cpp/actors/examples/01_ping_pong/main.cpp2
-rw-r--r--library/cpp/actors/examples/02_discovery/endpoint.cpp2
-rw-r--r--library/cpp/actors/examples/02_discovery/lookup.cpp2
-rw-r--r--library/cpp/actors/examples/02_discovery/publish.cpp3
-rw-r--r--library/cpp/actors/examples/02_discovery/replica.cpp1
-rw-r--r--library/cpp/actors/interconnect/handshake_broker.h1
-rw-r--r--library/cpp/actors/interconnect/interconnect_nameserver_base.h4
-rw-r--r--library/cpp/actors/interconnect/interconnect_proxy_wrapper.cpp2
-rw-r--r--library/cpp/actors/interconnect/interconnect_tcp_proxy.cpp2
-rw-r--r--library/cpp/actors/interconnect/interconnect_tcp_proxy.h2
-rw-r--r--library/cpp/actors/interconnect/mock/ic_mock.cpp5
-rw-r--r--library/cpp/actors/testlib/test_runtime.cpp10
21 files changed, 66 insertions, 49 deletions
diff --git a/library/cpp/actors/core/actor.cpp b/library/cpp/actors/core/actor.cpp
index 00eef387ea4..5e28d30e5e0 100644
--- a/library/cpp/actors/core/actor.cpp
+++ b/library/cpp/actors/core/actor.cpp
@@ -12,6 +12,10 @@ namespace NActors {
SelfActorId.Out(out);
}
+ bool IActor::Send(TAutoPtr<IEventHandle> ev) const noexcept {
+ return TActivationContext::Send(ev);
+ }
+
bool IActor::Send(const TActorId& recipient, IEventBase* ev, ui32 flags, ui64 cookie, NWilson::TTraceId traceId) const noexcept {
return SelfActorId.Send(recipient, ev, flags, cookie, std::move(traceId));
}
@@ -142,7 +146,7 @@ namespace NActors {
}
void TActorCallbackBehaviour::Receive(IActor* actor, TAutoPtr<IEventHandle>& ev) {
- (actor->*StateFunc)(ev, TActivationContext::AsActorContext());
+ (actor->*StateFunc)(ev);
}
void TActorVirtualBehaviour::Receive(IActor* actor, std::unique_ptr<IEventHandle> ev) {
diff --git a/library/cpp/actors/core/actor.h b/library/cpp/actors/core/actor.h
index 4a674f2108b..6f160ac4e87 100644
--- a/library/cpp/actors/core/actor.h
+++ b/library/cpp/actors/core/actor.h
@@ -274,7 +274,7 @@ namespace NActors {
using TBase = IActor;
friend class TDecorator;
public:
- using TReceiveFunc = void (IActor::*)(TAutoPtr<IEventHandle>& ev, const TActorContext& ctx);
+ using TReceiveFunc = void (IActor::*)(TAutoPtr<IEventHandle>& ev);
private:
TReceiveFunc StateFunc = nullptr;
public:
@@ -499,7 +499,7 @@ namespace NActors {
return SelfActorId;
}
- void Receive(TAutoPtr<IEventHandle>& ev, const TActorContext& /*ctx*/) {
+ void Receive(TAutoPtr<IEventHandle>& ev) {
++HandledEvents;
LastReceiveTimestamp = TActivationContext::Monotonic();
if (CImpl.Initialized()) {
@@ -509,6 +509,10 @@ namespace NActors {
}
}
+ TActorContext ActorContext() const {
+ return TActivationContext::ActorContextFor(SelfId());
+ }
+
protected:
void SetEnoughCpu(bool isEnough) {
if (TlsThreadContext) {
@@ -517,6 +521,7 @@ namespace NActors {
}
void Describe(IOutputStream&) const noexcept override;
+ bool Send(TAutoPtr<IEventHandle> ev) const noexcept;
bool Send(const TActorId& recipient, IEventBase* ev, ui32 flags = 0, ui64 cookie = 0, NWilson::TTraceId traceId = {}) const noexcept final;
bool Send(const TActorId& recipient, THolder<IEventBase> ev, ui32 flags = 0, ui64 cookie = 0, NWilson::TTraceId traceId = {}) const{
return Send(recipient, ev.Release(), flags, cookie, std::move(traceId));
@@ -646,7 +651,7 @@ namespace NActors {
protected:
// static constexpr char ActorName[] = "UNNAMED";
- TActor(void (TDerived::*func)(TAutoPtr<IEventHandle>& ev, const TActorContext&), ui32 activityType = GetActivityTypeIndex())
+ TActor(void (TDerived::*func)(TAutoPtr<IEventHandle>& ev), ui32 activityType = GetActivityTypeIndex())
: IActorCallback(static_cast<TReceiveFunc>(func), activityType)
{
}
@@ -656,15 +661,14 @@ namespace NActors {
};
-#define STFUNC_SIG TAutoPtr< ::NActors::IEventHandle>&ev, const ::NActors::TActorContext &ctx
+#define STFUNC_SIG TAutoPtr<::NActors::IEventHandle>& ev
#define STATEFN_SIG TAutoPtr<::NActors::IEventHandle>& ev
-#define STFUNC(funcName) void funcName(TAutoPtr< ::NActors::IEventHandle>& ev, const ::NActors::TActorContext& ctx)
-#define STATEFN(funcName) void funcName(TAutoPtr< ::NActors::IEventHandle>& ev, const ::NActors::TActorContext& )
+#define STFUNC(funcName) void funcName(TAutoPtr<::NActors::IEventHandle>& ev)
+#define STATEFN(funcName) void funcName(TAutoPtr<::NActors::IEventHandle>& ev)
#define STFUNC_STRICT_UNHANDLED_MSG_HANDLER Y_VERIFY_DEBUG(false, "%s: unexpected message type 0x%08" PRIx32, __func__, etype);
#define STFUNC_BODY(HANDLERS, UNHANDLED_MSG_HANDLER) \
- Y_UNUSED(ctx); \
switch (const ui32 etype = ev->GetTypeRewrite()) { \
HANDLERS \
default: \
@@ -721,8 +725,9 @@ namespace NActors {
}
STFUNC(State) {
+ auto ctx(ActorContext());
if (DoBeforeReceiving(ev, ctx)) {
- Actor->Receive(ev, ctx);
+ Actor->Receive(ev);
DoAfterReceiving(ctx);
}
}
diff --git a/library/cpp/actors/core/actor_bootstrapped.h b/library/cpp/actors/core/actor_bootstrapped.h
index 9d89afcf709..8145baacff6 100644
--- a/library/cpp/actors/core/actor_bootstrapped.h
+++ b/library/cpp/actors/core/actor_bootstrapped.h
@@ -20,9 +20,9 @@ namespace NActors {
using T = decltype(&TDerived::Bootstrap);
TDerived& self = static_cast<TDerived&>(*this);
if constexpr (std::is_invocable_v<T, TDerived, const TActorContext&>) {
- self.Bootstrap(ctx);
+ self.Bootstrap(TActivationContext::ActorContextFor(TActor<TDerived>::SelfId()));
} else if constexpr (std::is_invocable_v<T, TDerived, const TActorId&, const TActorContext&>) {
- self.Bootstrap(ev->Sender, ctx);
+ self.Bootstrap(ev->Sender, TActivationContext::ActorContextFor(TActor<TDerived>::SelfId()));
} else if constexpr (std::is_invocable_v<T, TDerived>) {
self.Bootstrap();
} else if constexpr (std::is_invocable_v<T, TDerived, const TActorId&>) {
diff --git a/library/cpp/actors/core/actor_ut.cpp b/library/cpp/actors/core/actor_ut.cpp
index 157608fc88c..55dfb96513b 100644
--- a/library/cpp/actors/core/actor_ut.cpp
+++ b/library/cpp/actors/core/actor_ut.cpp
@@ -45,7 +45,6 @@ Y_UNIT_TEST_SUITE(ActorBenchmark) {
TDummyActor() : TActor<TDummyActor>(&TDummyActor::StateFunc) {}
STFUNC(StateFunc) {
(void)ev;
- (void)ctx;
}
};
@@ -113,6 +112,7 @@ Y_UNIT_TEST_SUITE(ActorBenchmark) {
if (CheckWorkIsDone())
return;
+ auto ctx(ActorContext());
if (AllocatesMemory) {
SpecialSend(new IEventHandle(ev->Sender, SelfId(), new TEvents::TEvPing()), ctx);
} else {
@@ -564,14 +564,14 @@ Y_UNIT_TEST_SUITE(TestDecorator) {
{
}
- bool DoBeforeReceiving(TAutoPtr<IEventHandle>& ev, const TActorContext& ctx) override {
+ bool DoBeforeReceiving(TAutoPtr<IEventHandle>& ev, const TActorContext&) override {
*Counter += 1;
if (ev->Type != TEvents::THelloWorld::Pong) {
TAutoPtr<IEventHandle> pingEv = new IEventHandle(SelfId(), SelfId(), new TEvents::TEvPing());
SavedEvent = ev;
- Actor->Receive(pingEv, ctx);
+ Actor->Receive(pingEv);
} else {
- Actor->Receive(SavedEvent, ctx);
+ Actor->Receive(SavedEvent);
}
return false;
}
diff --git a/library/cpp/actors/core/executor_pool_basic_ut.cpp b/library/cpp/actors/core/executor_pool_basic_ut.cpp
index f96f65931a0..a487582f324 100644
--- a/library/cpp/actors/core/executor_pool_basic_ut.cpp
+++ b/library/cpp/actors/core/executor_pool_basic_ut.cpp
@@ -63,7 +63,6 @@ public:
private:
STFUNC(Execute)
{
- Y_UNUSED(ctx);
switch (ev->GetTypeRewrite()) {
hFunc(TEvMsg, Handle);
}
diff --git a/library/cpp/actors/core/executor_pool_united_ut.cpp b/library/cpp/actors/core/executor_pool_united_ut.cpp
index a7c7399d73e..f066254ffed 100644
--- a/library/cpp/actors/core/executor_pool_united_ut.cpp
+++ b/library/cpp/actors/core/executor_pool_united_ut.cpp
@@ -69,7 +69,6 @@ public:
private:
STFUNC(Execute) {
- Y_UNUSED(ctx);
switch (ev->GetTypeRewrite()) {
hFunc(TEvMsg, Handle);
}
diff --git a/library/cpp/actors/core/executor_thread.cpp b/library/cpp/actors/core/executor_thread.cpp
index cd6e8c6d7be..10a35ff4227 100644
--- a/library/cpp/actors/core/executor_thread.cpp
+++ b/library/cpp/actors/core/executor_thread.cpp
@@ -192,7 +192,7 @@ namespace NActors {
NProfiling::TMemoryTagScope::Reset(ActorSystem->MemProfActivityBase + activityType);
}
- actor->Receive(ev, ctx);
+ actor->Receive(ev);
size_t dyingActorsCnt = DyingActors.size();
Ctx.UpdateActorsStats(dyingActorsCnt);
diff --git a/library/cpp/actors/core/hfunc.h b/library/cpp/actors/core/hfunc.h
index a8e439e9382..6d1aeeecc36 100644
--- a/library/cpp/actors/core/hfunc.h
+++ b/library/cpp/actors/core/hfunc.h
@@ -5,10 +5,17 @@
#include <util/system/defaults.h>
+#define HFuncCtx(TEvType, HandleFunc, Ctx) \
+ case TEvType::EventType: { \
+ typename TEvType::TPtr* x = reinterpret_cast<typename TEvType::TPtr*>(&ev); \
+ HandleFunc(*x, Ctx); \
+ break; \
+ }
+
#define HFunc(TEvType, HandleFunc) \
case TEvType::EventType: { \
typename TEvType::TPtr* x = reinterpret_cast<typename TEvType::TPtr*>(&ev); \
- HandleFunc(*x, ctx); \
+ HandleFunc(*x, this->ActorContext()); \
break; \
}
@@ -23,7 +30,7 @@
case TEvType::EventType: { \
TRACE_EVENT_TYPE(Y_STRINGIZE(TEvType)); \
TEvType::TPtr* x = reinterpret_cast<TEvType::TPtr*>(&ev); \
- HandleFunc(*x, ctx); \
+ HandleFunc(*x, this->ActorContext()); \
break; \
}
@@ -38,7 +45,7 @@
#define HTemplFunc(TEvType, HandleFunc) \
case TEvType::EventType: { \
typename TEvType::TPtr* x = reinterpret_cast<typename TEvType::TPtr*>(&ev); \
- HandleFunc(*x, ctx); \
+ HandleFunc(*x, this->ActorContext()); \
break; \
}
@@ -51,7 +58,7 @@
#define SFunc(TEvType, HandleFunc) \
case TEvType::EventType: \
- HandleFunc(ctx); \
+ HandleFunc(this->ActorContext()); \
break;
#define sFunc(TEvType, HandleFunc) \
@@ -61,7 +68,12 @@
#define CFunc(TEventType, HandleFunc) \
case TEventType: \
- HandleFunc(ctx); \
+ HandleFunc(this->ActorContext()); \
+ break;
+
+#define CFuncCtx(TEventType, HandleFunc, ctx) \
+ case TEventType: \
+ HandleFunc(ctx); \
break;
#define cFunc(TEventType, HandleFunc) \
@@ -71,7 +83,7 @@
#define FFunc(TEventType, HandleFunc) \
case TEventType: \
- HandleFunc(ev, ctx); \
+ HandleFunc(ev, this->ActorContext()); \
break;
#define fFunc(TEventType, HandleFunc) \
diff --git a/library/cpp/actors/core/log.h b/library/cpp/actors/core/log.h
index 7c569a2dad5..a57d7be1daf 100644
--- a/library/cpp/actors/core/log.h
+++ b/library/cpp/actors/core/log.h
@@ -84,6 +84,16 @@
#define LOG_DEBUG_S(actorCtxOrSystem, component, stream) LOG_LOG_S(actorCtxOrSystem, NActors::NLog::PRI_DEBUG, component, stream)
#define LOG_TRACE_S(actorCtxOrSystem, component, stream) LOG_LOG_S(actorCtxOrSystem, NActors::NLog::PRI_TRACE, component, stream)
+#define ALOG_EMERG(component, stream) LOG_LOG_S(*NActors::TlsActivationContext, NActors::NLog::PRI_EMERG, component, stream)
+#define ALOG_ALERT(component, stream) LOG_LOG_S(*NActors::TlsActivationContext, NActors::NLog::PRI_ALERT, component, stream)
+#define ALOG_CRIT(component, stream) LOG_LOG_S(*NActors::TlsActivationContext, NActors::NLog::PRI_CRIT, component, stream)
+#define ALOG_ERROR(component, stream) LOG_LOG_S(*NActors::TlsActivationContext, NActors::NLog::PRI_ERROR, component, stream)
+#define ALOG_WARN(component, stream) LOG_LOG_S(*NActors::TlsActivationContext, NActors::NLog::PRI_WARN, component, stream)
+#define ALOG_NOTICE(component, stream) LOG_LOG_S(*NActors::TlsActivationContext, NActors::NLog::PRI_NOTICE, component, stream)
+#define ALOG_INFO(component, stream) LOG_LOG_S(*NActors::TlsActivationContext, NActors::NLog::PRI_INFO, component, stream)
+#define ALOG_DEBUG(component, stream) LOG_LOG_S(*NActors::TlsActivationContext, NActors::NLog::PRI_DEBUG, component, stream)
+#define ALOG_TRACE(component, stream) LOG_LOG_S(*NActors::TlsActivationContext, NActors::NLog::PRI_TRACE, component, stream)
+
#define LOG_EMERG_SAMPLED_BY(actorCtxOrSystem, component, sampleBy, ...) LOG_LOG_SAMPLED_BY(actorCtxOrSystem, NActors::NLog::PRI_EMERG, component, sampleBy, __VA_ARGS__)
#define LOG_ALERT_SAMPLED_BY(actorCtxOrSystem, component, sampleBy, ...) LOG_LOG_SAMPLED_BY(actorCtxOrSystem, NActors::NLog::PRI_ALERT, component, sampleBy, __VA_ARGS__)
#define LOG_CRIT_SAMPLED_BY(actorCtxOrSystem, component, sampleBy, ...) LOG_LOG_SAMPLED_BY(actorCtxOrSystem, NActors::NLog::PRI_CRIT, component, sampleBy, __VA_ARGS__)
@@ -205,7 +215,7 @@ namespace NActors {
std::shared_ptr<NMonitoring::TMetricRegistry> metrics);
~TLoggerActor();
- void StateFunc(TAutoPtr<IEventHandle>& ev, const TActorContext& ctx) {
+ void StateFunc(TAutoPtr<IEventHandle>& ev) {
switch (ev->GetTypeRewrite()) {
HFunc(TFlushLogBuffer, FlushLogBufferMessageEvent);
HFunc(NLog::TEvLog, HandleLogEvent);
diff --git a/library/cpp/actors/examples/01_ping_pong/main.cpp b/library/cpp/actors/examples/01_ping_pong/main.cpp
index c98c5f7b883..c9223f78ef3 100644
--- a/library/cpp/actors/examples/01_ping_pong/main.cpp
+++ b/library/cpp/actors/examples/01_ping_pong/main.cpp
@@ -51,7 +51,6 @@ public:
{}
STFUNC(StateWait) {
- Y_UNUSED(ctx);
switch (ev->GetTypeRewrite()) {
hFunc(TEvents::TEvPing, Handle);
sFunc(TEvents::TEvWakeup, PrintStats);
@@ -61,7 +60,6 @@ public:
}
STFUNC(StatePing) {
- Y_UNUSED(ctx);
switch (ev->GetTypeRewrite()) {
hFunc(TEvents::TEvPong, Handle);
sFunc(TEvents::TEvWakeup, PrintStats);
diff --git a/library/cpp/actors/examples/02_discovery/endpoint.cpp b/library/cpp/actors/examples/02_discovery/endpoint.cpp
index 97780e8b4c7..38c068ca8f4 100644
--- a/library/cpp/actors/examples/02_discovery/endpoint.cpp
+++ b/library/cpp/actors/examples/02_discovery/endpoint.cpp
@@ -49,7 +49,6 @@ public:
{}
STFUNC(StateWork) {
- Y_UNUSED(ctx);
switch (ev->GetTypeRewrite()) {
hFunc(NHttp::TEvHttpProxy::TEvHttpIncomingRequest, Handle);
hFunc(TEvExample::TEvInfo, Handle);
@@ -104,7 +103,6 @@ public:
}
STFUNC(StateWork) {
- Y_UNUSED(ctx);
switch (ev->GetTypeRewrite()) {
hFunc(NHttp::TEvHttpProxy::TEvHttpIncomingRequest, Handle);
default:
diff --git a/library/cpp/actors/examples/02_discovery/lookup.cpp b/library/cpp/actors/examples/02_discovery/lookup.cpp
index d5bd30dd3e4..bcae477034b 100644
--- a/library/cpp/actors/examples/02_discovery/lookup.cpp
+++ b/library/cpp/actors/examples/02_discovery/lookup.cpp
@@ -49,7 +49,6 @@ public:
{}
STFUNC(StateWork) {
- Y_UNUSED(ctx);
switch (ev->GetTypeRewrite()) {
hFunc(TEvExample::TEvReplicaInfo, Handle);
sFunc(TEvents::TEvUndelivered, HandleUndelivered);
@@ -120,7 +119,6 @@ public:
}
STFUNC(StateWork) {
- Y_UNUSED(ctx);
switch (ev->GetTypeRewrite()) {
hFunc(TEvExample::TEvReplicaInfo, Handle);
default:
diff --git a/library/cpp/actors/examples/02_discovery/publish.cpp b/library/cpp/actors/examples/02_discovery/publish.cpp
index 5dfe5dd9590..d923283e6b5 100644
--- a/library/cpp/actors/examples/02_discovery/publish.cpp
+++ b/library/cpp/actors/examples/02_discovery/publish.cpp
@@ -45,7 +45,6 @@ public:
}
STFUNC(StatePublish) {
- Y_UNUSED(ctx);
switch (ev->GetTypeRewrite()) {
sFunc(TEvents::TEvPoison, PassAway);
sFunc(TEvents::TEvUndelivered, SomeSleep);
@@ -56,7 +55,6 @@ public:
}
STFUNC(StateSleep) {
- Y_UNUSED(ctx);
switch (ev->GetTypeRewrite()) {
sFunc(TEvents::TEvPoison, PassAway);
sFunc(TEvents::TEvWakeup, Bootstrap);
@@ -99,7 +97,6 @@ public:
}
STFUNC(StateWork) {
- Y_UNUSED(ctx);
switch (ev->GetTypeRewrite()) {
sFunc(TEvents::TEvPoison, PassAway);
default:
diff --git a/library/cpp/actors/examples/02_discovery/replica.cpp b/library/cpp/actors/examples/02_discovery/replica.cpp
index 74fdfc1910d..96a6f5f475a 100644
--- a/library/cpp/actors/examples/02_discovery/replica.cpp
+++ b/library/cpp/actors/examples/02_discovery/replica.cpp
@@ -156,7 +156,6 @@ public:
{}
STFUNC(StateWork) {
- Y_UNUSED(ctx);
switch (ev->GetTypeRewrite()) {
hFunc(TEvExample::TEvReplicaLookup, Handle);
hFunc(TEvExample::TEvReplicaPublish, Handle);
diff --git a/library/cpp/actors/interconnect/handshake_broker.h b/library/cpp/actors/interconnect/handshake_broker.h
index e2e714a2130..f53ab4edd29 100644
--- a/library/cpp/actors/interconnect/handshake_broker.h
+++ b/library/cpp/actors/interconnect/handshake_broker.h
@@ -131,7 +131,6 @@ namespace NActors {
static constexpr char ActorName[] = "HANDSHAKE_BROKER_ACTOR";
STFUNC(StateFunc) {
- Y_UNUSED(ctx);
switch (ev->GetTypeRewrite()) {
hFunc(TEvHandshakeBrokerTake, Handle);
hFunc(TEvHandshakeBrokerFree, Handle);
diff --git a/library/cpp/actors/interconnect/interconnect_nameserver_base.h b/library/cpp/actors/interconnect/interconnect_nameserver_base.h
index df614f6c2b1..f9ce456d1c4 100644
--- a/library/cpp/actors/interconnect/interconnect_nameserver_base.h
+++ b/library/cpp/actors/interconnect/interconnect_nameserver_base.h
@@ -13,10 +13,10 @@ namespace NActors {
protected:
const TMap<ui32, TTableNameserverSetup::TNodeInfo>& NodeTable;
- TInterconnectNameserverBase(void (TDerived::*func)(TAutoPtr<IEventHandle>& ev, const TActorContext& ctx)
+ TInterconnectNameserverBase(void (TDerived::*func)(TAutoPtr<IEventHandle>& ev)
, const TMap<ui32, TTableNameserverSetup::TNodeInfo>& nodeTable)
: TActor<TDerived>(func)
- , NodeTable(nodeTable)
+ , NodeTable(nodeTable)
{
}
public:
diff --git a/library/cpp/actors/interconnect/interconnect_proxy_wrapper.cpp b/library/cpp/actors/interconnect/interconnect_proxy_wrapper.cpp
index a450d168719..b68d4242b60 100644
--- a/library/cpp/actors/interconnect/interconnect_proxy_wrapper.cpp
+++ b/library/cpp/actors/interconnect/interconnect_proxy_wrapper.cpp
@@ -32,7 +32,7 @@ namespace NActors {
}
Y_VERIFY(Proxy);
}
- InvokeOtherActor(*Proxy, &IActor::Receive, ev, ctx);
+ InvokeOtherActor(*Proxy, &IActor::Receive, ev);
}
}
};
diff --git a/library/cpp/actors/interconnect/interconnect_tcp_proxy.cpp b/library/cpp/actors/interconnect/interconnect_tcp_proxy.cpp
index d70ea1aa735..7ca2453f6c5 100644
--- a/library/cpp/actors/interconnect/interconnect_tcp_proxy.cpp
+++ b/library/cpp/actors/interconnect/interconnect_tcp_proxy.cpp
@@ -608,7 +608,7 @@ namespace NActors {
Y_VERIFY(Session && SessionID);
ValidateEvent(ev, "ForwardSessionEventToSession");
- InvokeOtherActor(*Session, &TInterconnectSessionTCP::Receive, ev, TActivationContext::ActorContextFor(SessionID));
+ InvokeOtherActor(*Session, &TInterconnectSessionTCP::Receive, ev);
}
void TInterconnectProxyTCP::GenerateHttpInfo(NMon::TEvHttpInfo::TPtr& ev) {
diff --git a/library/cpp/actors/interconnect/interconnect_tcp_proxy.h b/library/cpp/actors/interconnect/interconnect_tcp_proxy.h
index 8b30dde0aea..352310e37cf 100644
--- a/library/cpp/actors/interconnect/interconnect_tcp_proxy.h
+++ b/library/cpp/actors/interconnect/interconnect_tcp_proxy.h
@@ -66,7 +66,7 @@ namespace NActors {
STFUNC(StateInit) {
Bootstrap();
if (ev->Type != TEvents::TSystem::Bootstrap) { // for dynamic nodes we do not receive Bootstrap event
- Receive(ev, ctx);
+ Receive(ev);
}
}
diff --git a/library/cpp/actors/interconnect/mock/ic_mock.cpp b/library/cpp/actors/interconnect/mock/ic_mock.cpp
index 0aadc7ae356..875f4ff5536 100644
--- a/library/cpp/actors/interconnect/mock/ic_mock.cpp
+++ b/library/cpp/actors/interconnect/mock/ic_mock.cpp
@@ -252,7 +252,7 @@ namespace NActors {
while (!WaitingConnections.empty()) {
TAutoPtr<IEventHandle> tmp(WaitingConnections.front().release());
WaitingConnections.pop_front();
- Receive(tmp, TActivationContext::AsActorContext());
+ Receive(tmp);
}
}
};
@@ -322,8 +322,7 @@ namespace NActors {
void HandleSessionEvent(TAutoPtr<IEventHandle> ev) {
auto *session = GetSession();
- InvokeOtherActor(*session, &TSessionMockActor::Receive, ev,
- TActivationContext::ActorContextFor(session->SelfId()));
+ InvokeOtherActor(*session, &TSessionMockActor::Receive, ev);
}
void Disconnect() {
diff --git a/library/cpp/actors/testlib/test_runtime.cpp b/library/cpp/actors/testlib/test_runtime.cpp
index 962cfe81d40..6fedca1cd22 100644
--- a/library/cpp/actors/testlib/test_runtime.cpp
+++ b/library/cpp/actors/testlib/test_runtime.cpp
@@ -95,7 +95,6 @@ namespace NActors {
}
STFUNC(StateFunc) {
- Y_UNUSED(ctx);
TGuard<TMutex> guard(Runtime->Mutex);
bool verbose = (Runtime->CurrentDispatchContext ? !Runtime->CurrentDispatchContext->Options->Quiet : true) && VERBOSE;
if (Runtime->BlockedOutput.find(ev->Sender) != Runtime->BlockedOutput.end()) {
@@ -397,7 +396,7 @@ namespace NActors {
TActorContext ctx(*mailbox, *node->ExecutorThread, GetCycleCountFast(), ev->GetRecipientRewrite());
TActivationContext *prevTlsActivationContext = TlsActivationContext;
TlsActivationContext = &ctx;
- recipientActor->Receive(ev, ctx);
+ recipientActor->Receive(ev);
TlsActivationContext = prevTlsActivationContext;
// we expect the logger to never die in tests
}
@@ -1627,7 +1626,7 @@ namespace NActors {
TCallstack::GetTlsCallstack() = ev->Callstack;
TCallstack::GetTlsCallstack().SetLinesToSkip();
#endif
- recipientActor->Receive(ev, ctx);
+ recipientActor->Receive(ev);
node->ExecutorThread->DropUnregistered();
}
CurrentRecipient = TActorId();
@@ -1853,7 +1852,7 @@ namespace NActors {
bool wasEmpty = !Context->Queue->Head();
Context->Queue->Push(ev.Release());
if (wasEmpty) {
- SendHead(ctx);
+ SendHead(ActorContext());
}
}
@@ -1865,6 +1864,7 @@ namespace NActors {
if (HasReply) {
delete Context->Queue->Pop();
}
+ auto ctx(ActorContext());
ctx.ExecutorThread.Send(IEventHandle::Forward(ev, originalSender));
if (!IsSync && Context->Queue->Head()) {
SendHead(ctx);
@@ -1916,7 +1916,7 @@ namespace NActors {
};
void TStrandingActorDecorator::TReplyActor::StateFunc(STFUNC_SIG) {
- Owner->Reply(ev, ctx);
+ Owner->Reply(ev);
}
class TStrandingDecoratorFactory : public IStrandingDecoratorFactory {