chenBright commented on code in PR #3558:
URL: https://github.com/apache/brpc/pull/3558#discussion_r4154092709


##########
docs/cn/flatbuffers.md:
##########
@@ -0,0 +1,114 @@
+# FlatBuffers 消息
+
+[English version](../en/flatbuffers.md)
+
+bRPC 提供可选的、基于 IOBuf 的 FlatBuffers 消息、构造器和服务描述符。
+消息构造方案基于 [apache/brpc#3196](https://github.com/apache/brpc/pull/3196)。
+
+该组件不会注册 `fb_rpc` 传输协议,也不会向 `brpc::Channel` 和 `brpc::Server`
+增加 FlatBuffers 集成。服务代码生成和进程内分派测试不是网络 RPC,也不是性能 benchmark。
+
+## 构建
+
+FlatBuffers 支持默认关闭。消息运行库只需要 FlatBuffers 头文件,不链接
+FlatBuffers 库。测试需要与头文件版本匹配的 `flatc`。请保留上游生成代码中的
+版本断言;版本不一致时应重新生成头文件,而不是削弱断言。
+
+例如,GoogleTest 源码安装在 `/usr/src/googletest` 时:
+
+```sh
+cmake -S . -B build -DWITH_FLATBUFFERS=ON -DBUILD_UNIT_TESTS=ON \
+  -DBUILD_BRPC_TOOLS=OFF -DDOWNLOAD_GTEST=OFF \
+  -DBRPC_SYSTEM_GTEST_SOURCE_DIR=/usr/src/googletest
+cmake --build build --target brpc_flatbuffers_unittest -j6
+ctest --test-dir build -R '^brpc_flatbuffers_unittest$' --output-on-failure
+```
+
+其他安装方式可按需设置 `FLATBUFFERS_INCLUDE_DIR`、
+`FLATBUFFERS_FLATC_EXECUTABLE` 和 `BRPC_SYSTEM_GTEST_SOURCE_DIR`。
+项目原有测试依赖仍然适用。
+
+Make 可在 `config_brpc.sh` 中传入 `--with-flatbuffers`;测试可通过
+`FLATC=/path/to/flatc` 指定官方生成器。Bazel 可传入
+`--define=BRPC_WITH_FLATBUFFERS=true`,并使用匹配的 FlatBuffers 25.2.10
+运行时和编译器依赖。当前 bRPC FlatBuffers 运行库只支持这个精确版本;由于实现依赖
+FlatBuffers builder 内部结构,其他版本会在编译期被拒绝。Bzlmod 导入与 WORKSPACE
+相同的 checksum 固定归档:
+`runtime_cc` 和 `flatc` 不需要 FlatBuffers 的外部 gRPC 模块,否则即使该功能关闭,
+也可能与 bRPC 固定的 BoringSSL 版本冲突。
+
+公共头文件位于 `brpc/flatbuffers/`,命名空间为 `brpc::flatbuffers`。
+构造消息包含 `message.h`,使用服务描述符和接口包含 `service.h`。
+`butil/config.h` 中的 `BRPC_WITH_FLATBUFFERS` 始终为 0 或 1;应用应使用
+`#if` 判断,而不是 `#ifdef`。

Review Comment:
   The AI ​​is being too wordy. Could it be more concise?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to