diff options
author | ijon <ijon@yandex-team.com> | 2023-03-28 19:07:45 +0300 |
---|---|---|
committer | ijon <ijon@yandex-team.com> | 2023-03-28 19:07:45 +0300 |
commit | 27b064e59b1f6c46c6dae20922bdee1110a562c6 (patch) | |
tree | 7e7a9d2ea0f141c09ae1cc2b036b59f627af480d | |
parent | 9bfc77e035639f3ea19155b1e11410649932501b (diff) | |
download | ydb-27b064e59b1f6c46c6dae20922bdee1110a562c6.tar.gz |
schemeshard: refactor ISubOperationState::DebugReply() to template
-rw-r--r-- | ydb/core/tx/schemeshard/schemeshard__operation_part.cpp | 19 | ||||
-rw-r--r-- | ydb/core/tx/schemeshard/schemeshard__operation_part.h | 7 |
2 files changed, 15 insertions, 11 deletions
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_part.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_part.cpp index 7cd1ffc8e8..ed2dbfc130 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_part.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_part.cpp @@ -55,13 +55,20 @@ struct TDebugEvent<TEvPrivate::TEvUndoTenantUpdate> { } }; -#define DefaultDebugReply(TEvType, ...) \ - TString ISubOperationState::DebugReply(TEvType::TPtr& ev) { \ - return TDebugEvent<TEvType>::ToString(ev); \ - } - SCHEMESHARD_INCOMING_EVENTS(DefaultDebugReply) -#undef DefaultDebugReply +template <EventBasePtr TEvPtr> +TString ISubOperationState::DebugReply(const TEvPtr& ev) { + using TEvType = typename EventTypeFromTEvPtr<TEvPtr>::type; + return TDebugEvent<TEvType>::ToString(ev); +} + + +#define DefineDebugReply(TEvType, ...) \ + template TString ISubOperationState::DebugReply(const TEvType::TPtr& ev); + + SCHEMESHARD_INCOMING_EVENTS(DefineDebugReply) +#undef DefineDebugReply + static TString LogMessage(const TString& ev, TOperationContext& context, bool ignore) { return TStringBuilder() << (ignore ? "Unexpected" : "Ignore") << " message" diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_part.h b/ydb/core/tx/schemeshard/schemeshard__operation_part.h index 60c7e295cb..706a1fce24 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_part.h +++ b/ydb/core/tx/schemeshard/schemeshard__operation_part.h @@ -163,11 +163,8 @@ class ISubOperationState { public: virtual ~ISubOperationState() = default; -#define DefaultDebugReply(TEvType, TxType) \ - static TString DebugReply(TEvType::TPtr& ev); - - SCHEMESHARD_INCOMING_EVENTS(DefaultDebugReply) -#undef DefaultDebugReply + template <EventBasePtr TEvPtr> + static TString DebugReply(const TEvPtr& ev); #define DefaultHandleReply(TEvType, ...) \ virtual bool HandleReply(TEvType::TPtr& ev, TOperationContext& context); |