Skip to content

Fix compilation errors of SerializedResponse#2722

Merged
wwbmmm merged 1 commit into
apache:masterfrom
chenBright:fix_serialized_response
Aug 8, 2024
Merged

Fix compilation errors of SerializedResponse#2722
wwbmmm merged 1 commit into
apache:masterfrom
chenBright:fix_serialized_response

Conversation

@chenBright

@chenBright chenBright commented Aug 2, 2024

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: resolve #2721

Problem Summary:

What is changed and the side effects?

Changed:

Side effects:

  • Performance effects(性能影响):

  • Breaking backward compatibility(向后兼容性):


Check List:

  • Please make sure your changes are compilable(请确保你的更改可以通过编译).
  • When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
  • Please follow Contributor Covenant Code of Conduct.(请遵循贡献者准则).

@wasphin

wasphin commented Aug 6, 2024

Copy link
Copy Markdown
Member

Protobuf 升级 API 时不时就会不兼容,这个看有没有什么办法做隔离?

@chenBright

chenBright commented Aug 6, 2024

Copy link
Copy Markdown
Contributor Author

只能跟着Protobuf版本兼容了吧。

@chenBright

chenBright commented Aug 6, 2024

Copy link
Copy Markdown
Contributor Author

目前bRPC内部继承并实现google::protobuf::Message的原因:

  1. 序列化和打包的时候,通过Protobuf的反射机制来确定request和response具体类型,确保是具体协议要求的类型;
  2. CallMethod要求request和response是google::protobuf::Message类型。

针对这两个问题,或许我们可以通过以下方法来接触对Protobuf的依赖。以下是初步的想法(可能还有其他未关注到得细节):

  1. 实现内部的Message抽象类,并提供必要的反射机制;
  2. 增加CallMethod重载函数,支持内部Message类型;
  3. 协议注册机制支持内部Message类型。

@oathdruid

Copy link
Copy Markdown
Contributor

unreflectable_message.txt
内部我是尝试整了一个基类归拢了一下和pb的版本适配相关的东西,每次新版本来的,改改倒是也还能用

PS:最近pb的breaking change确实多

@wwbmmm wwbmmm merged commit c709c96 into apache:master Aug 8, 2024
@chenBright chenBright deleted the fix_serialized_response branch August 8, 2024 10:21
chenBright added a commit to chenBright/brpc that referenced this pull request Aug 10, 2024
@wasphin

wasphin commented Oct 8, 2024

Copy link
Copy Markdown
Member

unreflectable_message.txt 内部我是尝试整了一个基类归拢了一下和pb的版本适配相关的东西,每次新版本来的,改改倒是也还能用

@oathdruid 这个方便开源出来不?

wasphin added a commit that referenced this pull request Oct 13, 2024
See #2722 (comment)
inspired by unreflectable_message of oathdruid.
wasphin added a commit that referenced this pull request Oct 13, 2024
See #2722 (comment)
inspired by unreflectable_message of oathdruid.
wasphin added a commit that referenced this pull request Oct 13, 2024
See #2722 (comment)
inspired by unreflectable_message of @oathdruid.
wasphin added a commit to wasphin/brpc that referenced this pull request Oct 14, 2024
See apache#2722 (comment)
inspired by unreflectable_message of @oathdruid.
wasphin added a commit to wasphin/brpc that referenced this pull request Oct 14, 2024
wasphin added a commit to wasphin/brpc that referenced this pull request Oct 14, 2024
wasphin added a commit to wasphin/brpc that referenced this pull request Oct 16, 2024
chenBright pushed a commit that referenced this pull request Oct 30, 2024
* Add NonreflectableMessage and support Protobuf v5

See #2722 (comment)
inspired by unreflectable_message of @oathdruid.

* Remove unnecessary MessageHelper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

brpc build failed in x64-linux

4 participants