diff --git a/ydb/core/tablet/bootstrapper.h b/ydb/core/tablet/bootstrapper.h index 2e246ea2b07a..06aaa51bf304 100644 --- a/ydb/core/tablet/bootstrapper.h +++ b/ydb/core/tablet/bootstrapper.h @@ -3,6 +3,7 @@ #include #include #include +#include namespace NKikimr { @@ -19,12 +20,10 @@ struct TEvBootstrapper { static_assert(EvEnd < EventSpaceEnd(TKikimrEvents::ES_BOOTSTRAPPER), "event space overrun"); - struct TEvActivate : public TEventBase { - DEFINE_SIMPLE_NONLOCAL_EVENT(TEvActivate, "TEvBootstrapper::Activate"); + struct TEvActivate : public TEventSimpleNonLocal { }; - struct TEvStandBy : public TEventBase { - DEFINE_SIMPLE_NONLOCAL_EVENT(TEvStandBy, "TEvBootstrapper::StandBy"); + struct TEvStandBy : public TEventSimpleNonLocal { }; struct TEvWatch; diff --git a/ydb/library/actors/core/event.h b/ydb/library/actors/core/event.h index fb6fb9a93ab8..53c57dfa8069 100644 --- a/ydb/library/actors/core/event.h +++ b/ydb/library/actors/core/event.h @@ -373,18 +373,4 @@ namespace NActors { typedef TEventHandle THandle; typedef TAutoPtr TPtr; }; - -#define DEFINE_SIMPLE_NONLOCAL_EVENT(eventType, header) \ - TString ToStringHeader() const override { \ - return TString(header); \ - } \ - bool SerializeToArcadiaStream(NActors::TChunkSerializer*) const override { \ - return true; \ - } \ - static IEventBase* Load(NActors::TEventSerializedData*) { \ - return new eventType(); \ - } \ - bool IsSerializable() const override { \ - return true; \ - } } diff --git a/ydb/library/actors/core/event_simple_non_local.h b/ydb/library/actors/core/event_simple_non_local.h new file mode 100644 index 000000000000..90f32ab9cfd8 --- /dev/null +++ b/ydb/library/actors/core/event_simple_non_local.h @@ -0,0 +1,28 @@ +#pragma once + +#include "event.h" +#include "event_load.h" +#include + +namespace NActors { + // Non-local event with empty serialization + template + class TEventSimpleNonLocal: public TEventBase { + public: + TString ToStringHeader() const override { + return TypeName(); + } + + bool SerializeToArcadiaStream(TChunkSerializer* /*serializer*/) const override { + return true; + } + + bool IsSerializable() const override { + return true; + } + + static IEventBase* Load(TEventSerializedData*) { + return new TEv(); + } + }; +} diff --git a/ydb/library/actors/core/events.h b/ydb/library/actors/core/events.h index 1caa93e604c1..115b09424f2d 100644 --- a/ydb/library/actors/core/events.h +++ b/ydb/library/actors/core/events.h @@ -1,6 +1,7 @@ #pragma once #include "event_local.h" +#include "event_simple_non_local.h" #include "event_pb.h" #include @@ -48,12 +49,10 @@ namespace NActors { static_assert(End < EventSpaceEnd(ES_HELLOWORLD), "expect End < EventSpaceEnd(ES_HELLOWORLD)"); }; - struct TEvPing: public TEventBase { - DEFINE_SIMPLE_NONLOCAL_EVENT(TEvPing, "HelloWorld: Ping"); + struct TEvPing: public TEventSimpleNonLocal { }; - struct TEvPong: public TEventBase { - DEFINE_SIMPLE_NONLOCAL_EVENT(TEvPong, "HelloWorld: Pong"); + struct TEvPong: public TEventSimpleNonLocal { }; struct TEvBlob: public TEventBase { @@ -116,8 +115,7 @@ namespace NActors { struct TEvBootstrap: public TEventLocal { }; - struct TEvPoison : public TEventBase { - DEFINE_SIMPLE_NONLOCAL_EVENT(TEvPoison, "System: TEvPoison") + struct TEvPoison : public TEventSimpleNonLocal { }; struct TEvWakeup: public TEventLocal { diff --git a/ydb/library/actors/core/ut/ask_ut.cpp b/ydb/library/actors/core/ut/ask_ut.cpp index 66691aac4fbd..c9f714412cab 100644 --- a/ydb/library/actors/core/ut/ask_ut.cpp +++ b/ydb/library/actors/core/ut/ask_ut.cpp @@ -92,7 +92,7 @@ Y_UNIT_TEST_SUITE(AskActor) { UNIT_ASSERT_EXCEPTION_CONTAINS( fut.ExtractValueSync(), yexception, - "received unexpected response HelloWorld: Pong"); + "received unexpected response NActors::TEvents::TEvPong"); } } diff --git a/ydb/library/yql/providers/dq/actors/events.h b/ydb/library/yql/providers/dq/actors/events.h index 245568d6c0ae..48114c7b1283 100644 --- a/ydb/library/yql/providers/dq/actors/events.h +++ b/ydb/library/yql/providers/dq/actors/events.h @@ -10,6 +10,7 @@ #include #include +#include #include namespace NYql::NDqs { @@ -50,8 +51,7 @@ namespace NYql::NDqs { explicit TEvReadyState(NDqProto::TReadyState&& proto); }; - struct TEvPullResult : NActors::TEventBase { - DEFINE_SIMPLE_NONLOCAL_EVENT(TEvPullResult, ""); + struct TEvPullResult : NActors::TEventSimpleNonLocal { }; struct TEvGraphExecutionEvent @@ -99,8 +99,7 @@ namespace NYql::NDqs { explicit TEvFullResultWriterStatusResponse(NDqProto::TFullResultWriterStatusResponse& data); }; - struct TEvGraphFinished : NActors::TEventBase { - DEFINE_SIMPLE_NONLOCAL_EVENT(TEvGraphFinished, ""); + struct TEvGraphFinished : NActors::TEventSimpleNonLocal { }; struct TEvFullResultWriterWriteRequest