Skip to content

Commit e2fecfd

Browse files
authored
Remove DEFINE_SIMPLE_NONLOCAL_EVENT, add TEventSimpleNonLocal (#8562)
1 parent 2091af7 commit e2fecfd

File tree

6 files changed

+39
-29
lines changed

6 files changed

+39
-29
lines changed

ydb/core/tablet/bootstrapper.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <ydb/core/tablet/tablet_setup.h>
44
#include <ydb/core/base/tablet.h>
55
#include <ydb/core/base/blobstorage.h>
6+
#include <ydb/library/actors/core/event_simple_non_local.h>
67

78
namespace NKikimr {
89

@@ -19,12 +20,10 @@ struct TEvBootstrapper {
1920

2021
static_assert(EvEnd < EventSpaceEnd(TKikimrEvents::ES_BOOTSTRAPPER), "event space overrun");
2122

22-
struct TEvActivate : public TEventBase<TEvActivate, EvActivate> {
23-
DEFINE_SIMPLE_NONLOCAL_EVENT(TEvActivate, "TEvBootstrapper::Activate");
23+
struct TEvActivate : public TEventSimpleNonLocal<TEvActivate, EvActivate> {
2424
};
2525

26-
struct TEvStandBy : public TEventBase<TEvStandBy, EvStandBy> {
27-
DEFINE_SIMPLE_NONLOCAL_EVENT(TEvStandBy, "TEvBootstrapper::StandBy");
26+
struct TEvStandBy : public TEventSimpleNonLocal<TEvStandBy, EvStandBy> {
2827
};
2928

3029
struct TEvWatch;

ydb/library/actors/core/event.h

-14
Original file line numberDiff line numberDiff line change
@@ -373,18 +373,4 @@ namespace NActors {
373373
typedef TEventHandle<TEventType> THandle;
374374
typedef TAutoPtr<THandle> TPtr;
375375
};
376-
377-
#define DEFINE_SIMPLE_NONLOCAL_EVENT(eventType, header) \
378-
TString ToStringHeader() const override { \
379-
return TString(header); \
380-
} \
381-
bool SerializeToArcadiaStream(NActors::TChunkSerializer*) const override { \
382-
return true; \
383-
} \
384-
static IEventBase* Load(NActors::TEventSerializedData*) { \
385-
return new eventType(); \
386-
} \
387-
bool IsSerializable() const override { \
388-
return true; \
389-
}
390376
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#pragma once
2+
3+
#include "event.h"
4+
#include "event_load.h"
5+
#include <util/system/type_name.h>
6+
7+
namespace NActors {
8+
// Non-local event with empty serialization
9+
template <typename TEv, ui32 TEventType>
10+
class TEventSimpleNonLocal: public TEventBase<TEv, TEventType> {
11+
public:
12+
TString ToStringHeader() const override {
13+
return TypeName<TEv>();
14+
}
15+
16+
bool SerializeToArcadiaStream(TChunkSerializer* /*serializer*/) const override {
17+
return true;
18+
}
19+
20+
bool IsSerializable() const override {
21+
return true;
22+
}
23+
24+
static IEventBase* Load(TEventSerializedData*) {
25+
return new TEv();
26+
}
27+
};
28+
}

ydb/library/actors/core/events.h

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include "event_local.h"
4+
#include "event_simple_non_local.h"
45
#include "event_pb.h"
56

67
#include <util/system/unaligned_mem.h>
@@ -48,12 +49,10 @@ namespace NActors {
4849
static_assert(End < EventSpaceEnd(ES_HELLOWORLD), "expect End < EventSpaceEnd(ES_HELLOWORLD)");
4950
};
5051

51-
struct TEvPing: public TEventBase<TEvPing, THelloWorld::Ping> {
52-
DEFINE_SIMPLE_NONLOCAL_EVENT(TEvPing, "HelloWorld: Ping");
52+
struct TEvPing: public TEventSimpleNonLocal<TEvPing, THelloWorld::Ping> {
5353
};
5454

55-
struct TEvPong: public TEventBase<TEvPong, THelloWorld::Pong> {
56-
DEFINE_SIMPLE_NONLOCAL_EVENT(TEvPong, "HelloWorld: Pong");
55+
struct TEvPong: public TEventSimpleNonLocal<TEvPong, THelloWorld::Pong> {
5756
};
5857

5958
struct TEvBlob: public TEventBase<TEvBlob, THelloWorld::Blob> {
@@ -116,8 +115,7 @@ namespace NActors {
116115
struct TEvBootstrap: public TEventLocal<TEvBootstrap, TSystem::Bootstrap> {
117116
};
118117

119-
struct TEvPoison : public TEventBase<TEvPoison, TSystem::Poison> {
120-
DEFINE_SIMPLE_NONLOCAL_EVENT(TEvPoison, "System: TEvPoison")
118+
struct TEvPoison : public TEventSimpleNonLocal<TEvPoison, TSystem::Poison> {
121119
};
122120

123121
struct TEvWakeup: public TEventLocal<TEvWakeup, TSystem::Wakeup> {

ydb/library/actors/core/ut/ask_ut.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Y_UNIT_TEST_SUITE(AskActor) {
9292
UNIT_ASSERT_EXCEPTION_CONTAINS(
9393
fut.ExtractValueSync(),
9494
yexception,
95-
"received unexpected response HelloWorld: Pong");
95+
"received unexpected response NActors::TEvents::TEvPong");
9696
}
9797
}
9898

ydb/library/yql/providers/dq/actors/events.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include <ydb/library/actors/core/event_local.h>
1212
#include <ydb/library/actors/core/event_pb.h>
13+
#include <ydb/library/actors/core/event_simple_non_local.h>
1314
#include <ydb/library/actors/core/events.h>
1415

1516
namespace NYql::NDqs {
@@ -50,8 +51,7 @@ namespace NYql::NDqs {
5051
explicit TEvReadyState(NDqProto::TReadyState&& proto);
5152
};
5253

53-
struct TEvPullResult : NActors::TEventBase<TEvPullResult, TDqExecuterEvents::ES_PULL_RESULT> {
54-
DEFINE_SIMPLE_NONLOCAL_EVENT(TEvPullResult, "");
54+
struct TEvPullResult : NActors::TEventSimpleNonLocal<TEvPullResult, TDqExecuterEvents::ES_PULL_RESULT> {
5555
};
5656

5757
struct TEvGraphExecutionEvent
@@ -99,8 +99,7 @@ namespace NYql::NDqs {
9999
explicit TEvFullResultWriterStatusResponse(NDqProto::TFullResultWriterStatusResponse& data);
100100
};
101101

102-
struct TEvGraphFinished : NActors::TEventBase<TEvGraphFinished, TDqExecuterEvents::ES_GRAPH_FINISHED> {
103-
DEFINE_SIMPLE_NONLOCAL_EVENT(TEvGraphFinished, "");
102+
struct TEvGraphFinished : NActors::TEventSimpleNonLocal<TEvGraphFinished, TDqExecuterEvents::ES_GRAPH_FINISHED> {
104103
};
105104

106105
struct TEvFullResultWriterWriteRequest

0 commit comments

Comments
 (0)