diff options
| author | kvk1920 <[email protected]> | 2024-04-19 13:52:12 +0300 |
|---|---|---|
| committer | kvk1920 <[email protected]> | 2024-04-19 14:04:07 +0300 |
| commit | 84ddb341fa531312c475e1238d898047149304c9 (patch) | |
| tree | e2a265e5bea13a807639af6476332958f2391ad0 | |
| parent | 70ce8be8bc397bd224bcfe438376bb0d47f4d3e1 (diff) | |
Cosmetic for Cypress tx mirroring
1d447641f9f45024e30a81903e439513a3a8847f
| -rw-r--r-- | yt/yt/core/misc/protobuf_helpers-inl.h | 4 | ||||
| -rw-r--r-- | yt/yt/core/misc/protobuf_helpers.h | 13 | ||||
| -rw-r--r-- | yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto | 2 |
3 files changed, 16 insertions, 3 deletions
diff --git a/yt/yt/core/misc/protobuf_helpers-inl.h b/yt/yt/core/misc/protobuf_helpers-inl.h index bb5894c723d..2dd1757eeaf 100644 --- a/yt/yt/core/misc/protobuf_helpers-inl.h +++ b/yt/yt/core/misc/protobuf_helpers-inl.h @@ -37,6 +37,10 @@ DEFINE_TRIVIAL_PROTO_CONVERSIONS(bool) //////////////////////////////////////////////////////////////////////////////// +#define YT_PROTO_OPTIONAL_CONVERT(...) __VA_OPT__(::NYT::FromProto<__VA_ARGS__>) + +//////////////////////////////////////////////////////////////////////////////// + // These conversions work in case if the patched protobuf that uses // TString is used. inline void ToProto(TString* serialized, TString original) diff --git a/yt/yt/core/misc/protobuf_helpers.h b/yt/yt/core/misc/protobuf_helpers.h index 55caf57468a..70e163c7a7f 100644 --- a/yt/yt/core/misc/protobuf_helpers.h +++ b/yt/yt/core/misc/protobuf_helpers.h @@ -378,8 +378,17 @@ google::protobuf::Timestamp GetProtoNow(); //////////////////////////////////////////////////////////////////////////////// -//! This macro may be used to extract std::optional<T> from protobuf message field of type T. -#define YT_PROTO_OPTIONAL(message, field) (((message).has_##field()) ? std::make_optional((message).field()) : std::nullopt) +//! This macro may be used to extract std::optional<T> from protobuf message +//! field. Macro accepts desired target type as optional third parameter. +//! Usage: +//! // Get as is. +//! int instantInt = YT_PROTO_OPTIONAL(message, instant); +//! // Get with conversion. +//! TInstant instant = YT_PROTO_OPTIONAL(message, instant, TInstant); +#define YT_PROTO_OPTIONAL(message, field, ...) \ + (((message).has_##field()) \ + ? std::optional(YT_PROTO_OPTIONAL_CONVERT(__VA_ARGS__)((message).field())) \ + : std::nullopt) //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto b/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto index 3795f80077b..5242e321cfb 100644 --- a/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto +++ b/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto @@ -368,7 +368,7 @@ message TReqStartTransaction { message TReplicateToMasterCellTags { - repeated int32 cell_tags = 1; + repeated uint32 cell_tags = 1; } required ETransactionType type = 1; |
