Skip to content

Commit de4dd76

Browse files
authored
Little refactoring (#5710)
1 parent af2b31c commit de4dd76

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

ydb/core/tx/replication/service/json_change_record.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#include "json_change_record.h"
22

3-
#include <ydb/core/scheme/scheme_tablecell.h>
43
#include <ydb/core/io_formats/cell_maker/cell_maker.h>
5-
6-
#include <util/memory/pool.h>
4+
#include <ydb/core/protos/tx_datashard.pb.h>
75

86
namespace NKikimr::NReplication::NService {
97

@@ -71,10 +69,7 @@ static bool ParseValue(TVector<NTable::TTag>& tags, TVector<TCell>& cells,
7169
return true;
7270
}
7371

74-
void TChangeRecord::Serialize(
75-
NKikimrTxDataShard::TEvApplyReplicationChanges::TChange& record,
76-
TChangeRecordBuilderContextTrait<NReplication::NService::TChangeRecord>& ctx) const
77-
{
72+
void TChangeRecord::Serialize(NKikimrTxDataShard::TEvApplyReplicationChanges_TChange& record, TSerializationContext& ctx) const {
7873
auto& pool = ctx.MemoryPool;
7974
pool.Clear();
8075
record.SetSourceOffset(GetOrder());
@@ -112,8 +107,8 @@ void TChangeRecord::Serialize(
112107
}
113108
}
114109

115-
void TChangeRecord::Serialize(NKikimrTxDataShard::TEvApplyReplicationChanges::TChange& record) const {
116-
TChangeRecordBuilderContextTrait<NReplication::NService::TChangeRecord> ctx;
110+
void TChangeRecord::Serialize(NKikimrTxDataShard::TEvApplyReplicationChanges_TChange& record) const {
111+
TSerializationContext ctx;
117112
Serialize(record, ctx);
118113
}
119114

ydb/core/tx/replication/service/json_change_record.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,33 @@
55
#include <ydb/core/change_exchange/change_exchange.h>
66
#include <ydb/core/change_exchange/change_record.h>
77
#include <ydb/core/change_exchange/change_sender_resolver.h>
8-
#include <ydb/core/protos/tx_datashard.pb.h>
98
#include <ydb/core/scheme/scheme_tablecell.h>
109
#include <ydb/core/scheme_types/scheme_type_info.h>
1110
#include <ydb/core/tablet_flat/flat_row_eggs.h>
1211

1312
#include <library/cpp/json/json_reader.h>
1413

15-
#include <util/generic/hash.h>
1614
#include <util/generic/maybe.h>
1715
#include <util/generic/ptr.h>
1816
#include <util/generic/vector.h>
1917
#include <util/memory/pool.h>
2018
#include <util/string/join.h>
2119

20+
namespace NKikimrTxDataShard {
21+
class TEvApplyReplicationChanges_TChange;
22+
}
23+
2224
namespace NKikimr::NReplication::NService {
2325

2426
class TChangeRecordBuilder;
2527

2628
class TChangeRecord: public NChangeExchange::TChangeRecordBase {
2729
friend class TChangeRecordBuilder;
30+
using TSerializationContext = TChangeRecordBuilderContextTrait<TChangeRecord>;
2831

2932
public:
33+
using TPtr = TIntrusivePtr<TChangeRecord>;
34+
3035
const static NKikimrSchemeOp::ECdcStreamFormat StreamType = NKikimrSchemeOp::ECdcStreamFormatJson;
3136

3237
ui64 GetGroup() const override;
@@ -35,10 +40,8 @@ class TChangeRecord: public NChangeExchange::TChangeRecordBase {
3540
EKind GetKind() const override;
3641
TString GetSourceId() const;
3742

38-
void Serialize(
39-
NKikimrTxDataShard::TEvApplyReplicationChanges::TChange& record,
40-
TChangeRecordBuilderContextTrait<NReplication::NService::TChangeRecord>& ctx) const;
41-
void Serialize(NKikimrTxDataShard::TEvApplyReplicationChanges::TChange& record) const;
43+
void Serialize(NKikimrTxDataShard::TEvApplyReplicationChanges_TChange& record, TSerializationContext& ctx) const;
44+
void Serialize(NKikimrTxDataShard::TEvApplyReplicationChanges_TChange& record) const;
4245

4346
TConstArrayRef<TCell> GetKey(TMemoryPool& pool) const;
4447
TConstArrayRef<TCell> GetKey() const;
@@ -71,7 +74,6 @@ class TChangeRecord: public NChangeExchange::TChangeRecordBase {
7174
return it->ShardId;
7275
}
7376

74-
using TPtr = TIntrusivePtr<TChangeRecord>;
7577
private:
7678
TString SourceId;
7779
NJson::TJsonValue JsonBody;
@@ -118,7 +120,6 @@ struct TChangeRecordContainer<NReplication::NService::TChangeRecord>
118120
: Records(std::move(records))
119121
{}
120122

121-
122123
TVector<NReplication::NService::TChangeRecord::TPtr> Records;
123124

124125
TString Out() override {

0 commit comments

Comments
 (0)