Browse Source

Fix as comments

wangxuefeng 6 years ago
parent
commit
8f8f0bf145
4 changed files with 25 additions and 16 deletions
  1. 3 2
      README.md
  2. 2 1
      README_cn.md
  3. 9 5
      docs/cn/thrift.md
  4. 11 8
      docs/en/thrift.md

+ 3 - 2
README.md

@@ -9,11 +9,12 @@ A industrial-grade RPC framework used throughout [Baidu](http://ir.baidu.com/pho
 You can use it to:
 * Build a server that can talk in multiple protocols (**on same port**), or access all sorts of services
   * restful http/https, h2/h2c (compatible with [grpc](https://github.com/grpc/grpc), will be opensourced). using http in brpc is much more friendly than [libcurl](https://curl.haxx.se/libcurl/).
-  * [redis](docs/en/redis_client.md) and [memcached](docs/en/memcache_client.md), thread-safe, more friendly and performant than the official clients
+  * [redis](docs/en/redis_client.md) and [memcached](docs/en/memcache_client.md), thread-safe, more friendly and performant than the official clients.
   * [rtmp](https://github.com/brpc/brpc/blob/master/src/brpc/rtmp.h)/[flv](https://en.wikipedia.org/wiki/Flash_Video)/[hls](https://en.wikipedia.org/wiki/HTTP_Live_Streaming), for building [live-streaming services](docs/cn/live_streaming.md).
   * hadoop_rpc (may be opensourced)
   * [rdma](https://en.wikipedia.org/wiki/Remote_direct_memory_access) support (will be opensourced)
-  * all sorts of protocols used in Baidu: [baidu_std](docs/cn/baidu_std.md), [streaming_rpc](docs/en/streaming_rpc.md), hulu_pbrpc, [sofa_pbrpc](https://github.com/baidu/sofa-pbrpc), nova_pbrpc, public_pbrpc, ubrpc, [thrift](docs/en/thrift.md) and nshead-based ones.
+  * [thrift](docs/en/thrift.md) support,  thread-safe, more friendly and performant than the official clients.
+  * all sorts of protocols used in Baidu: [baidu_std](docs/cn/baidu_std.md), [streaming_rpc](docs/en/streaming_rpc.md), hulu_pbrpc, [sofa_pbrpc](https://github.com/baidu/sofa-pbrpc), nova_pbrpc, public_pbrpc, ubrpc and nshead-based ones.
   * Access protobuf-based protocols with HTTP+json, probably from another language.
   * Build [HA](https://en.wikipedia.org/wiki/High_availability) distributed services using an industrial-grade implementation of [RAFT consensus algorithm](https://raft.github.io) which is opensourced at [braft](https://github.com/brpc/braft)
 * Servers can handle requests [synchronously](docs/en/server.md) or [asynchronously](docs/en/server.md#asynchronous-service).

+ 2 - 1
README_cn.md

@@ -14,7 +14,8 @@
   * [rtmp](https://github.com/brpc/brpc/blob/master/src/brpc/rtmp.h)/[flv](https://en.wikipedia.org/wiki/Flash_Video)/[hls](https://en.wikipedia.org/wiki/HTTP_Live_Streaming), 可用于搭建[直播服务](docs/cn/live_streaming.md).
   * hadoop_rpc(可能开源)
   * 支持[rdma](https://en.wikipedia.org/wiki/Remote_direct_memory_access)(即将开源)
-  * 各种百度内使用的协议: [baidu_std](docs/cn/baidu_std.md), [streaming_rpc](docs/cn/streaming_rpc.md), hulu_pbrpc, [sofa_pbrpc](https://github.com/baidu/sofa-pbrpc), nova_pbrpc, public_pbrpc, ubrpc, [thrift](docs/cn/thrift.md)和使用nshead的各种协议.
+  * 支持[thrift](docs/cn/thrift.md) , 线程安全,比官方client更方便
+  * 各种百度内使用的协议: [baidu_std](docs/cn/baidu_std.md), [streaming_rpc](docs/cn/streaming_rpc.md), hulu_pbrpc, [sofa_pbrpc](https://github.com/baidu/sofa-pbrpc), nova_pbrpc, public_pbrpc, ubrpc和使用nshead的各种协议.
   * 从其他语言通过HTTP+json访问基于protobuf的协议.
   * 基于工业级的[RAFT算法](https://raft.github.io)实现搭建[高可用](https://en.wikipedia.org/wiki/High_availability)分布式系统,已在[braft](https://github.com/brpc/braft)开源。
 * Server能[同步](docs/cn/server.md)或[异步](docs/cn/server.md#异步service)处理请求。

+ 9 - 5
docs/cn/thrift.md

@@ -5,15 +5,16 @@
 
 相比使用官方原生的优势有:
 
-- 线程安全。用户不需要为每个线程建立独立的client
-- 支持同步、异步、批量同步、批量异步等访问方式,能使用ParallelChannel等组合访问方式
-- 支持多种连接方式(连接池, 短连接), 支持超时、backup request、取消、tracing、内置服务等一系列RPC基本福利
+- 线程安全。用户不需要为每个线程建立独立的client.
+- 支持同步、异步、批量同步、批量异步等访问方式,能使用ParallelChannel等组合访问方式.
+- 支持多种连接方式(连接池, 短连接), 支持超时、backup request、取消、tracing、内置服务等一系列RPC基本福利.
 
 # 编译依赖及运行
-默认brpc编译是不启用thrift协议支持的, 目的是在用户不需要thrift协议支持的情况下可以不安装thrift依赖. 如果用户启用thrift协议的话, 在配置brpc环境的时候加上--with-thrift参数(实际上是在Makefile里面启用ENABLE_THRIFT_FRAMED_PROTOCOL宏)
+默认brpc编译是不启用thrift协议支持的, 目的是在用户不需要thrift协议支持的情况下可以不安装thrift依赖. 如果用户启用thrift协议的话, 在配置brpc环境的时候加上--with-thrift参数.
 
 安装thrift依赖, ubuntu环境下
 ```bash
+从[官网](https://thrift.apache.org/download)下载thrift源代码
 wget http://www.us.apache.org/dist/thrift/0.11.0/thrift-0.11.0.tar.gz
 tar -xf thrift-0.11.0.tar.gz
 cd thrift-0.11.0/
@@ -21,11 +22,14 @@ cd thrift-0.11.0/
 make CPPFLAGS=-DFORCE_BOOST_SMART_PTR -j 3 -s
 sudo make install
 ```
+Debian请参考[官方wiki]](https://thrift.apache.org/docs/install/debian)
+
 配置brpc支持thrift协议
 ```bash
 sh config_brpc.sh --headers=/usr/include --libs=/usr/lib --nodebugsymbols --with-thrift
 ```
-编译完成后会生成libbrpc.a 和libbrpc_thrift.a, thrift扩展协议以静态库的方式提供给用户, 用户在需要启用thrift协议的时候链接即可
+编译完成后会生成libbrpc.a, thrift扩展协议以静态库的方式提供给用户, 用户在需要启用thrift协议的时候链接即可.
+
 
 # Thrift 原生消息定义, echo.thrift:
 ```c++

+ 11 - 8
docs/en/thrift.md

@@ -1,18 +1,19 @@
 [中文版](../cn/thrift.md)
 
-[thrift](https://thrift.apache.org/)is a RPC framework used widely in production area which was developed by Facebook, In order to access thrift servers more conveniently and make full use of bthread's capability of concurrency, brpc directly supports the thrift protocol.
+[thrift](https://thrift.apache.org/)is a RPC framework used widely in production environment which was developed by Facebook. In order to access thrift servers more conveniently and make full use of concurrency ability of bthread, brpc directly supports the thrift protocol.
 Check [example/thrift_extension_c++](https://github.com/brpc/brpc/tree/master/example/thrift_extension_c++/) for an example.
 
 Advantages compared to the official thrift client:
 - Thread safety. No need to set up separate clients for each thread.
-- Support synchronous, asynchronous, semi-synchronous accesses etc. Support [ParallelChannel etc](combo_channel.md) to define access patterns declaratively.
+- Supports synchronous, asynchronous, batch synchronous, batch asynchronous, and other access methods. Combination channels such as ParallelChannel are also supported.
 - Support various connection types(short, connection pool). Support timeout, backup request, cancellation, tracing, built-in services, and other benefits offered by brpc.
 
 # Compile and Run
-In order to not depend on and compile with thrift library for most of the users, the thrift protocol wasn't supported in brpc by default. configure brpc with --with-thrift if you want to enable thrift protocol in brpc(actually it works with a Macro ENABLE_THRIFT_FRAMED_PROTOCOL)
+In order to not depend on and compile with thrift library for most users, the thrift protocol wasn't supported in brpc by default. Configure brpc with --with-thrift if you want to enable thrift protocol in brpc.
 
 Install Thrift in Ubuntu
 ```bash
+Download thrift source code from offical [web site](https://thrift.apache.org/download)
 wget http://www.us.apache.org/dist/thrift/0.11.0/thrift-0.11.0.tar.gz
 tar -xf thrift-0.11.0.tar.gz
 cd thrift-0.11.0/
@@ -20,11 +21,13 @@ cd thrift-0.11.0/
 make CPPFLAGS=-DFORCE_BOOST_SMART_PTR -j 3 -s
 sudo make install
 ```
+Debian please refer [offical wiki]](https://thrift.apache.org/docs/install/debian)
+
 Configure with thrift support
 ```bash
 sh config_brpc.sh --headers=/usr/include --libs=/usr/lib --nodebugsymbols --with-thrift
 ```
-Link with libbrpc_thrift.a if the user want to enable thrift protocol
+Thrift extension was supported via static library, libbrpc.a was generated after compile, link with it if users want to enable thrift protocol.
 
 # Thrift message definition, echo.thrift:
 ```c++
@@ -68,7 +71,7 @@ if (thrift_channel.Init(Flags_server.c_str(), FLAGS_load_balancer.c_str(), &opti
 }
 ...
 ```
-construct thrift request and send to server, ThriftMessage is a template class, the native thrift message was delegated by and can be accessed directly by raw() method.
+Construct a thrift request and send it to server, ThriftMessage is a template class that hosts thrift navtive messages, raw() methods can directly manipulate native thrift messages.
 
 ```c++
  // wrapper thrift raw request into ThriftMessage
@@ -88,9 +91,9 @@ construct thrift request and send to server, ThriftMessage is a template class,
  } 
 ```
 
-# Server process with thrift message
-User need to implement it's own thrift handler which was inherited from brpc::ThriftService
-Only the method name can obtained in server side due to the limit of thrift protocol itself, the service name wasn't passed to server actually, it means that only one thrift service can be set in one brpc server
+# Server side processing upstream thrift requests
+Users need to implement their own thrift handler which was inherited from brpc::ThriftService.
+Due to the limitation of thrift protocol itself, only the method name can be obtained on the server (via the controller.thrift_method_name() method), and the service name cannot be obtained. This is consistent with the native thrift implementation, which means that there can only be one thrift service in one brpc server.
 ```c++
 // Implement User Thrift Service handler
 class MyThriftProtocolPbManner : public brpc::ThriftService {