summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlnaz Nizametdinov <[email protected]>2023-12-26 20:15:07 +0300
committerGitHub <[email protected]>2023-12-26 20:15:07 +0300
commitbb2a2c66c888487182a0b8a6375e57e66a3c8a1d (patch)
tree0155e3d4c663450ec14c3799d05f5b81d11190f9
parent80fb4e960259aa1b62bf20d6d10aada3c5fd8a65 (diff)
(refactoring) Inline TChangeRecordBuilder's methods (#734)
-rw-r--r--ydb/core/tx/datashard/change_record.cpp77
-rw-r--r--ydb/core/tx/datashard/change_record.h87
2 files changed, 71 insertions, 93 deletions
diff --git a/ydb/core/tx/datashard/change_record.cpp b/ydb/core/tx/datashard/change_record.cpp
index d87038bd66f..d087d3688db 100644
--- a/ydb/core/tx/datashard/change_record.cpp
+++ b/ydb/core/tx/datashard/change_record.cpp
@@ -103,81 +103,4 @@ void TChangeRecord::Out(IOutputStream& out) const {
<< " }";
}
-TChangeRecordBuilder::TChangeRecordBuilder(EKind kind) {
- Record.Kind = kind;
-}
-
-TChangeRecordBuilder::TChangeRecordBuilder(TChangeRecord&& record) {
- Record = std::move(record);
-}
-
-TChangeRecordBuilder& TChangeRecordBuilder::WithLockId(ui64 lockId) {
- Record.LockId = lockId;
- return *this;
-}
-
-TChangeRecordBuilder& TChangeRecordBuilder::WithLockOffset(ui64 lockOffset) {
- Record.LockOffset = lockOffset;
- return *this;
-}
-
-TChangeRecordBuilder& TChangeRecordBuilder::WithOrder(ui64 order) {
- Record.Order = order;
- return *this;
-}
-
-TChangeRecordBuilder& TChangeRecordBuilder::WithGroup(ui64 group) {
- Record.Group = group;
- return *this;
-}
-
-TChangeRecordBuilder& TChangeRecordBuilder::WithStep(ui64 step) {
- Record.Step = step;
- return *this;
-}
-
-TChangeRecordBuilder& TChangeRecordBuilder::WithTxId(ui64 txId) {
- Record.TxId = txId;
- return *this;
-}
-
-TChangeRecordBuilder& TChangeRecordBuilder::WithPathId(const TPathId& pathId) {
- Record.PathId = pathId;
- return *this;
-}
-
-TChangeRecordBuilder& TChangeRecordBuilder::WithTableId(const TPathId& tableId) {
- Record.TableId = tableId;
- return *this;
-}
-
-TChangeRecordBuilder& TChangeRecordBuilder::WithSchemaVersion(ui64 version) {
- Record.SchemaVersion = version;
- return *this;
-}
-
-TChangeRecordBuilder& TChangeRecordBuilder::WithSchema(TUserTable::TCPtr schema) {
- Record.Schema = schema;
- return *this;
-}
-
-TChangeRecordBuilder& TChangeRecordBuilder::WithBody(const TString& body) {
- Record.Body = body;
- return *this;
-}
-
-TChangeRecordBuilder& TChangeRecordBuilder::WithBody(TString&& body) {
- Record.Body = std::move(body);
- return *this;
-}
-
-TChangeRecordBuilder& TChangeRecordBuilder::WithSource(ESource source) {
- Record.Source = source;
- return *this;
-}
-
-TChangeRecord&& TChangeRecordBuilder::Build() {
- return std::move(Record);
-}
-
}
diff --git a/ydb/core/tx/datashard/change_record.h b/ydb/core/tx/datashard/change_record.h
index 9d32fe1efa7..4dec245559f 100644
--- a/ydb/core/tx/datashard/change_record.h
+++ b/ydb/core/tx/datashard/change_record.h
@@ -84,28 +84,83 @@ class TChangeRecordBuilder {
using ESource = TChangeRecord::ESource;
public:
- explicit TChangeRecordBuilder(EKind kind);
- explicit TChangeRecordBuilder(TChangeRecord&& record);
+ explicit TChangeRecordBuilder(EKind kind) {
+ Record.Kind = kind;
+ }
- TChangeRecordBuilder& WithLockId(ui64 lockId);
- TChangeRecordBuilder& WithLockOffset(ui64 lockOffset);
+ explicit TChangeRecordBuilder(TChangeRecord&& record)
+ : Record(std::move(record))
+ {
+ }
- TChangeRecordBuilder& WithOrder(ui64 order);
- TChangeRecordBuilder& WithGroup(ui64 group);
- TChangeRecordBuilder& WithStep(ui64 step);
- TChangeRecordBuilder& WithTxId(ui64 txId);
- TChangeRecordBuilder& WithPathId(const TPathId& pathId);
+ TChangeRecordBuilder& WithLockId(ui64 lockId) {
+ Record.LockId = lockId;
+ return *this;
+ }
- TChangeRecordBuilder& WithTableId(const TPathId& tableId);
- TChangeRecordBuilder& WithSchemaVersion(ui64 version);
- TChangeRecordBuilder& WithSchema(TUserTable::TCPtr schema);
+ TChangeRecordBuilder& WithLockOffset(ui64 lockOffset) {
+ Record.LockOffset = lockOffset;
+ return *this;
+ }
- TChangeRecordBuilder& WithBody(const TString& body);
- TChangeRecordBuilder& WithBody(TString&& body);
+ TChangeRecordBuilder& WithOrder(ui64 order) {
+ Record.Order = order;
+ return *this;
+ }
- TChangeRecordBuilder& WithSource(ESource source);
+ TChangeRecordBuilder& WithGroup(ui64 group) {
+ Record.Group = group;
+ return *this;
+ }
- TChangeRecord&& Build();
+ TChangeRecordBuilder& WithStep(ui64 step) {
+ Record.Step = step;
+ return *this;
+ }
+
+ TChangeRecordBuilder& WithTxId(ui64 txId) {
+ Record.TxId = txId;
+ return *this;
+ }
+
+ TChangeRecordBuilder& WithPathId(const TPathId& pathId) {
+ Record.PathId = pathId;
+ return *this;
+ }
+
+ TChangeRecordBuilder& WithTableId(const TPathId& tableId) {
+ Record.TableId = tableId;
+ return *this;
+ }
+
+ TChangeRecordBuilder& WithSchemaVersion(ui64 version) {
+ Record.SchemaVersion = version;
+ return *this;
+ }
+
+ TChangeRecordBuilder& WithSchema(TUserTable::TCPtr schema) {
+ Record.Schema = schema;
+ return *this;
+ }
+
+ TChangeRecordBuilder& WithBody(const TString& body) {
+ Record.Body = body;
+ return *this;
+ }
+
+ TChangeRecordBuilder& WithBody(TString&& body) {
+ Record.Body = std::move(body);
+ return *this;
+ }
+
+ TChangeRecordBuilder& WithSource(ESource source) {
+ Record.Source = source;
+ return *this;
+ }
+
+ TChangeRecord&& Build() {
+ return std::move(Record);
+ }
private:
TChangeRecord Record;