Skip to content

Commit

Permalink
docs: add note info for Acquire Kitex RPC Info (#1097)
Browse files Browse the repository at this point in the history
  • Loading branch information
YangruiEmma authored Jun 24, 2024
1 parent 679aace commit 73e5a37
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ description: ""

The default lifecycle of Kitex's RPCInfo is from the start of the request to the return of the request (performance considerations), and then it will be placed in sync.Pool to reuse. On the Server side, if it is asynchronously obtained and used in the business Handler, it may lead to read dirty data, nil panic.

**Note:** Some information needs to rely on the transport protocol (TTHeader or HTTP2) and corresponding MetaHandler. Please refer to [here](/docs/kitex/tutorials/basic-feature/protocol/transport_protocol/#thrift).

### 1.1 Synchronous usage

| **Information obtained** | **Kitex fetch method** |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func main() {

### 参数校验

具体校验语法可参考[校验语法](https://github.com/bytedance/go-tagexpr/tree/master/validator)
具体校验语法可参考 [校验语法](https://github.com/bytedance/go-tagexpr/tree/master/validator)

不通过 IDL 生成代码时直接在对应结构体字段打 tag,示例:

Expand All @@ -88,7 +88,7 @@ type InfoRequest struct {
}
```

通过 IDL 生成代码时需添加相应的注解,可参考[Field 注解](/zh/docs/hertz/tutorials/toolkit/annotation/#field-注解)
通过 IDL 生成代码时需添加相应的注解,可参考 [Field 注解](/zh/docs/hertz/tutorials/toolkit/annotation/#field-注解)

下面给出常见用法:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ func main() {
| 版本 | 本地 | 公共 |
| ---- | ---------------------------------------------------------- | ----------------------------- | --- |
| v1 | 使用“AES-256-CBC”加密并使用 HMAC-SHA-256 签名 | 使用 `RSA-SHA-256` 签名 |
| v2 | 使用“XSalsa20Poly-1305”加密并使用“HMAC-SHA-384”签名` | 使用 `EdDSA``Ed25519`)签名 | |
| v2 | 使用“XSalsa20Poly-1305”加密并使用“HMAC-SHA-384”签名`| 使用`EdDSA``Ed25519`)签名 | |
| v3 | 使用“XChaCha20Poly1305”加密并使用“HMAC-SHA-384”签名` | 使用 `EdDSA``Ed25519`)签名 | |
| v4 | 使用“XChaCha20Poly1305”加密,并使用“HMAC-SHA-512-256”签名` | 使用 `EdDSA``Ed448`)签名 | |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ description: ""

Kitex 的 RPCInfo 的生命周期默认是从请求开始到请求返回(性能考虑),随后会被放到 sync.Pool 中复用。在 Server 端,如果在业务 Handler 中异步获取使用,可能会读到脏数据 / 空指针而 panic。

**注意:** 部分信息需要依赖传输协议(TTHeader 或 HTTP2)和对应的 Metahandler,如果是 Thrift 配置方式见 [这里](/zh/docs/kitex/tutorials/basic-feature/protocol/transport_protocol/#thrift)

### 1.1 同步使用方式

同步的使用方式是指用户没有在新起的 Goroutine 里获取 RPCInfo。
Expand Down

0 comments on commit 73e5a37

Please sign in to comment.