Skip to content

Remove DEFINE_SIMPLE_NONLOCAL_EVENT, add TEventSimpleNonLocal #8562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions ydb/core/tablet/bootstrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <ydb/core/tablet/tablet_setup.h>
#include <ydb/core/base/tablet.h>
#include <ydb/core/base/blobstorage.h>
#include <ydb/library/actors/core/event_simple_non_local.h>

namespace NKikimr {

Expand All @@ -19,12 +20,10 @@ struct TEvBootstrapper {

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

struct TEvActivate : public TEventBase<TEvActivate, EvActivate> {
DEFINE_SIMPLE_NONLOCAL_EVENT(TEvActivate, "TEvBootstrapper::Activate");
struct TEvActivate : public TEventSimpleNonLocal<TEvActivate, EvActivate> {
};

struct TEvStandBy : public TEventBase<TEvStandBy, EvStandBy> {
DEFINE_SIMPLE_NONLOCAL_EVENT(TEvStandBy, "TEvBootstrapper::StandBy");
struct TEvStandBy : public TEventSimpleNonLocal<TEvStandBy, EvStandBy> {
};

struct TEvWatch;
Expand Down
14 changes: 0 additions & 14 deletions ydb/library/actors/core/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,18 +373,4 @@ namespace NActors {
typedef TEventHandle<TEventType> THandle;
typedef TAutoPtr<THandle> 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; \
}
}
28 changes: 28 additions & 0 deletions ydb/library/actors/core/event_simple_non_local.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#pragma once

#include "event.h"
#include "event_load.h"
#include <util/system/type_name.h>

namespace NActors {
// Non-local event with empty serialization
template <typename TEv, ui32 TEventType>
class TEventSimpleNonLocal: public TEventBase<TEv, TEventType> {
public:
TString ToStringHeader() const override {
return TypeName<TEv>();
}

bool SerializeToArcadiaStream(TChunkSerializer* /*serializer*/) const override {
return true;
}

bool IsSerializable() const override {
return true;
}

static IEventBase* Load(TEventSerializedData*) {
return new TEv();
}
};
}
10 changes: 4 additions & 6 deletions ydb/library/actors/core/events.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "event_local.h"
#include "event_simple_non_local.h"
#include "event_pb.h"

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

struct TEvPing: public TEventBase<TEvPing, THelloWorld::Ping> {
DEFINE_SIMPLE_NONLOCAL_EVENT(TEvPing, "HelloWorld: Ping");
struct TEvPing: public TEventSimpleNonLocal<TEvPing, THelloWorld::Ping> {
};

struct TEvPong: public TEventBase<TEvPong, THelloWorld::Pong> {
DEFINE_SIMPLE_NONLOCAL_EVENT(TEvPong, "HelloWorld: Pong");
struct TEvPong: public TEventSimpleNonLocal<TEvPong, THelloWorld::Pong> {
};

struct TEvBlob: public TEventBase<TEvBlob, THelloWorld::Blob> {
Expand Down Expand Up @@ -116,8 +115,7 @@ namespace NActors {
struct TEvBootstrap: public TEventLocal<TEvBootstrap, TSystem::Bootstrap> {
};

struct TEvPoison : public TEventBase<TEvPoison, TSystem::Poison> {
DEFINE_SIMPLE_NONLOCAL_EVENT(TEvPoison, "System: TEvPoison")
struct TEvPoison : public TEventSimpleNonLocal<TEvPoison, TSystem::Poison> {
};

struct TEvWakeup: public TEventLocal<TEvWakeup, TSystem::Wakeup> {
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/actors/core/ut/ask_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}

Expand Down
7 changes: 3 additions & 4 deletions ydb/library/yql/providers/dq/actors/events.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <ydb/library/actors/core/event_local.h>
#include <ydb/library/actors/core/event_pb.h>
#include <ydb/library/actors/core/event_simple_non_local.h>
#include <ydb/library/actors/core/events.h>

namespace NYql::NDqs {
Expand Down Expand Up @@ -50,8 +51,7 @@ namespace NYql::NDqs {
explicit TEvReadyState(NDqProto::TReadyState&& proto);
};

struct TEvPullResult : NActors::TEventBase<TEvPullResult, TDqExecuterEvents::ES_PULL_RESULT> {
DEFINE_SIMPLE_NONLOCAL_EVENT(TEvPullResult, "");
struct TEvPullResult : NActors::TEventSimpleNonLocal<TEvPullResult, TDqExecuterEvents::ES_PULL_RESULT> {
};

struct TEvGraphExecutionEvent
Expand Down Expand Up @@ -99,8 +99,7 @@ namespace NYql::NDqs {
explicit TEvFullResultWriterStatusResponse(NDqProto::TFullResultWriterStatusResponse& data);
};

struct TEvGraphFinished : NActors::TEventBase<TEvGraphFinished, TDqExecuterEvents::ES_GRAPH_FINISHED> {
DEFINE_SIMPLE_NONLOCAL_EVENT(TEvGraphFinished, "");
struct TEvGraphFinished : NActors::TEventSimpleNonLocal<TEvGraphFinished, TDqExecuterEvents::ES_GRAPH_FINISHED> {
};

struct TEvFullResultWriterWriteRequest
Expand Down
Loading