-
Notifications
You must be signed in to change notification settings - Fork 735
(refactoring) Split TEvChangeExchange into two parts: common & DS KIKIMR-20673 #1152
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
CyberROFL
merged 1 commit into
ydb-platform:main
from
CyberROFL:KIKIMR-20673/split-change-exchange
Jan 19, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| #include "change_exchange.h" | ||
|
|
||
| #include <util/string/builder.h> | ||
| #include <util/string/join.h> | ||
|
|
||
| namespace NKikimr::NChangeExchange { | ||
|
|
||
| /// TEvEnqueueRecords | ||
| TEvChangeExchange::TEvEnqueueRecords::TEvEnqueueRecords(const TVector<TRecordInfo>& records) | ||
| : Records(records) | ||
| { | ||
| } | ||
|
|
||
| TEvChangeExchange::TEvEnqueueRecords::TEvEnqueueRecords(TVector<TRecordInfo>&& records) | ||
| : Records(std::move(records)) | ||
| { | ||
| } | ||
|
|
||
| TString TEvChangeExchange::TEvEnqueueRecords::ToString() const { | ||
| return TStringBuilder() << ToStringHeader() << " {" | ||
| << " Records [" << JoinSeq(",", Records) << "]" | ||
| << " }"; | ||
| } | ||
|
|
||
| TEvChangeExchange::TEvEnqueueRecords::TRecordInfo::TRecordInfo(ui64 order, const TPathId& pathId, ui64 bodySize) | ||
| : Order(order) | ||
| , PathId(pathId) | ||
| , BodySize(bodySize) | ||
| { | ||
| } | ||
|
|
||
| void TEvChangeExchange::TEvEnqueueRecords::TRecordInfo::Out(IOutputStream& out) const { | ||
| out << "{" | ||
| << " Order: " << Order | ||
| << " PathId: " << PathId | ||
| << " BodySize: " << BodySize | ||
| << " }"; | ||
| } | ||
|
|
||
| /// TEvRequestRecords | ||
| TEvChangeExchange::TEvRequestRecords::TEvRequestRecords(const TVector<TRecordInfo>& records) | ||
| : Records(records) | ||
| { | ||
| } | ||
|
|
||
| TEvChangeExchange::TEvRequestRecords::TEvRequestRecords(TVector<TRecordInfo>&& records) | ||
| : Records(std::move(records)) | ||
| { | ||
| } | ||
|
|
||
| TString TEvChangeExchange::TEvRequestRecords::ToString() const { | ||
| return TStringBuilder() << ToStringHeader() << " {" | ||
| << " Records [" << JoinSeq(",", Records) << "]" | ||
| << " }"; | ||
| } | ||
|
|
||
| TEvChangeExchange::TEvRequestRecords::TRecordInfo::TRecordInfo(ui64 order, ui64 bodySize) | ||
| : Order(order) | ||
| , BodySize(bodySize) | ||
| { | ||
| } | ||
|
|
||
| bool TEvChangeExchange::TEvRequestRecords::TRecordInfo::operator<(const TRecordInfo& rhs) const { | ||
| return Order < rhs.Order; | ||
| } | ||
|
|
||
| void TEvChangeExchange::TEvRequestRecords::TRecordInfo::Out(IOutputStream& out) const { | ||
| out << "{" | ||
| << " Order: " << Order | ||
| << " BodySize: " << BodySize | ||
| << " }"; | ||
| } | ||
|
|
||
| /// TEvRemoveRecords | ||
| TEvChangeExchange::TEvRemoveRecords::TEvRemoveRecords(const TVector<ui64>& records) | ||
| : Records(records) | ||
| { | ||
| } | ||
|
|
||
| TEvChangeExchange::TEvRemoveRecords::TEvRemoveRecords(TVector<ui64>&& records) | ||
| : Records(std::move(records)) | ||
| { | ||
| } | ||
|
|
||
| TString TEvChangeExchange::TEvRemoveRecords::ToString() const { | ||
| return TStringBuilder() << ToStringHeader() << " {" | ||
| << " Records [" << JoinSeq(",", Records) << "]" | ||
| << " }"; | ||
| } | ||
|
|
||
| /// TEvRecords | ||
| TEvChangeExchange::TEvRecords::TEvRecords(const TVector<IChangeRecord::TPtr>& records) | ||
| : Records(records) | ||
| { | ||
| } | ||
|
|
||
| TEvChangeExchange::TEvRecords::TEvRecords(TVector<IChangeRecord::TPtr>&& records) | ||
| : Records(std::move(records)) | ||
| { | ||
| } | ||
|
|
||
| TString TEvChangeExchange::TEvRecords::ToString() const { | ||
| return TStringBuilder() << ToStringHeader() << " {" | ||
| << " Records [" << JoinSeq(",", Records) << "]" | ||
| << " }"; | ||
| } | ||
|
|
||
| /// TEvForgetRecords | ||
| TEvChangeExchange::TEvForgetRecords::TEvForgetRecords(const TVector<ui64>& records) | ||
| : Records(records) | ||
| { | ||
| } | ||
|
|
||
| TEvChangeExchange::TEvForgetRecords::TEvForgetRecords(TVector<ui64>&& records) | ||
| : Records(std::move(records)) | ||
| { | ||
| } | ||
|
|
||
| TString TEvChangeExchange::TEvForgetRecords::ToString() const { | ||
| return TStringBuilder() << ToStringHeader() << " {" | ||
| << " Records [" << JoinSeq(",", Records) << "]" | ||
| << " }"; | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| #pragma once | ||
|
|
||
| #include "change_record.h" | ||
|
|
||
| #include <ydb/core/base/defs.h> | ||
| #include <ydb/core/base/events.h> | ||
| #include <ydb/core/scheme/scheme_pathid.h> | ||
|
|
||
| #include <util/generic/vector.h> | ||
|
|
||
| namespace NKikimr::NChangeExchange { | ||
|
|
||
| struct TEvChangeExchange { | ||
| enum EEv { | ||
| // Enqueue for sending | ||
| EvEnqueueRecords = EventSpaceBegin(TKikimrEvents::ES_CHANGE_EXCHANGE), | ||
| // Request change record(s) by id | ||
| EvRequestRecords, | ||
| // Change record(s) | ||
| EvRecords, | ||
| // Remove change record(s) from local database | ||
| EvRemoveRecords, | ||
| // Already removed records that the sender should forget about | ||
| EvForgetRecods, | ||
|
|
||
| EvEnd, | ||
| }; | ||
|
|
||
| static_assert(EvEnd < EventSpaceEnd(TKikimrEvents::ES_CHANGE_EXCHANGE)); | ||
|
|
||
| struct TEvEnqueueRecords: public TEventLocal<TEvEnqueueRecords, EvEnqueueRecords> { | ||
| struct TRecordInfo { | ||
| ui64 Order; | ||
| TPathId PathId; | ||
| ui64 BodySize; | ||
|
|
||
| TRecordInfo(ui64 order, const TPathId& pathId, ui64 bodySize); | ||
|
|
||
| void Out(IOutputStream& out) const; | ||
| }; | ||
|
|
||
| TVector<TRecordInfo> Records; | ||
|
|
||
| explicit TEvEnqueueRecords(const TVector<TRecordInfo>& records); | ||
| explicit TEvEnqueueRecords(TVector<TRecordInfo>&& records); | ||
| TString ToString() const override; | ||
| }; | ||
|
|
||
| struct TEvRequestRecords: public TEventLocal<TEvRequestRecords, EvRequestRecords> { | ||
| struct TRecordInfo { | ||
| ui64 Order; | ||
| ui64 BodySize; | ||
|
|
||
| TRecordInfo(ui64 order, ui64 bodySize = 0); | ||
|
|
||
| bool operator<(const TRecordInfo& rhs) const; | ||
| void Out(IOutputStream& out) const; | ||
| }; | ||
|
|
||
| TVector<TRecordInfo> Records; | ||
|
|
||
| explicit TEvRequestRecords(const TVector<TRecordInfo>& records); | ||
| explicit TEvRequestRecords(TVector<TRecordInfo>&& records); | ||
| TString ToString() const override; | ||
| }; | ||
|
|
||
| struct TEvRemoveRecords: public TEventLocal<TEvRemoveRecords, EvRemoveRecords> { | ||
| TVector<ui64> Records; | ||
|
|
||
| explicit TEvRemoveRecords(const TVector<ui64>& records); | ||
| explicit TEvRemoveRecords(TVector<ui64>&& records); | ||
| TString ToString() const override; | ||
| }; | ||
|
|
||
| struct TEvRecords: public TEventLocal<TEvRecords, EvRecords> { | ||
| TVector<IChangeRecord::TPtr> Records; | ||
|
|
||
| explicit TEvRecords(const TVector<IChangeRecord::TPtr>& records); | ||
| explicit TEvRecords(TVector<IChangeRecord::TPtr>&& records); | ||
| TString ToString() const override; | ||
| }; | ||
|
|
||
| struct TEvForgetRecords: public TEventLocal<TEvForgetRecords, EvForgetRecods> { | ||
| TVector<ui64> Records; | ||
|
|
||
| explicit TEvForgetRecords(const TVector<ui64>& records); | ||
| explicit TEvForgetRecords(TVector<ui64>&& records); | ||
| TString ToString() const override; | ||
| }; | ||
|
|
||
| }; // TEvChangeExchange | ||
|
|
||
| } | ||
|
|
||
| Y_DECLARE_OUT_SPEC(inline, NKikimr::NChangeExchange::TEvChangeExchange::TEvEnqueueRecords::TRecordInfo, o, x) { | ||
| return x.Out(o); | ||
| } | ||
|
|
||
| Y_DECLARE_OUT_SPEC(inline, NKikimr::NChangeExchange::TEvChangeExchange::TEvRequestRecords::TRecordInfo, o, x) { | ||
| return x.Out(o); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,17 @@ | ||
| LIBRARY() | ||
|
|
||
| SRCS( | ||
| change_exchange.cpp | ||
| change_record.cpp | ||
| ) | ||
|
|
||
| GENERATE_ENUM_SERIALIZATION(change_record.h) | ||
|
|
||
| PEERDIR( | ||
| ydb/core/base | ||
| ydb/core/scheme | ||
| ) | ||
|
|
||
| YQL_LAST_ABI_VERSION() | ||
|
|
||
| END() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.