Skip to content

Commit

Permalink
[Doc] fix document
Browse files Browse the repository at this point in the history
  • Loading branch information
poor-circle committed Jul 26, 2023
1 parent 405c81f commit f6ff804
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion website/docs/en/guide/what_is_yalantinglibs.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ More examples [here](https://github.com/alibaba/yalantinglibs/tree/main/src/coro

Based on compile-time reflection, very easy to use, high performance serialization library, struct_pack is a header only library, it is used by coro_rpc now.

Only one line code to finish serialization and deserialization, 10-50x faster than protobuf.
Only one line code to finish serialization and deserialization, 2-50x faster than protobuf.

[English Introduction](https://alibaba.github.io/yalantinglibs/en/struct_pack/struct_pack_intro.html)

Expand Down
2 changes: 1 addition & 1 deletion website/docs/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ hero:

features:
- title: struct_pack
details: Only one line code to finish serialization and deserialization, 10-50x faster than protobuf.
details: Only one line code to finish serialization and deserialization, 2-50x faster than protobuf.
- title: coro_rpc
details: Very easy-to-use, coroutine-based, high performance rpc framework with C++20, more than 2000w qps in echo scene.
- title: struct_json
Expand Down
6 changes: 3 additions & 3 deletions website/docs/en/struct_pack/struct_pack_tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This document introcude some tips about struct_pack
struct_pack will generate a name for the serialized type during compilation, and get a 32-bit MD5 based on the string, then take its upper 31 bits for type check. When deserializing, it will check whether the hash code stored is the same as the type to be deserialized.
In order to alleviate possible hash collisions, in debug mode, struct_pack will store the complete type name instead of hash code. Therefore, the binary size in debug mode is slightly larger than release.
## Type requires
1. The user defined struct type should be aggregated. (`std::is_aggregate_v<T> == true`)。
2. The type to serialize should be legal struct_pack type.。See document:[struct_pack type system](https://alibaba.github.io/yalantinglibs/en/struct_pack/struct_pack_type_system.html)
3. struct_pack support update protocol by add struct_pack::compatible field, which is forward backward compatibility. User should make sure the version number is increment for each update. It's not allow to delete/modify exist field. See : [document](https://alibaba.github.io/yalantinglibs/en/struct_pack/struct_pack_type_system.html#%E5%85%BC%E5%AE%B9%E7%B1%BB%E5%9E%8B)

1. The type to serialize should be legal struct_pack type.。See document:[struct_pack type system](https://alibaba.github.io/yalantinglibs/en/struct_pack/struct_pack_type_system.html)
2. struct_pack support update protocol by add struct_pack::compatible field, which is forward backward compatibility. User should make sure the version number is increment for each update. It's not allow to delete/modify exist field. See : [document](https://alibaba.github.io/yalantinglibs/en/struct_pack/struct_pack_type_system.html#%E5%85%BC%E5%AE%B9%E7%B1%BB%E5%9E%8B)

2 changes: 1 addition & 1 deletion website/docs/zh/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ hero:

features:
- title: struct_pack
details: 只需要一行代码完成序列化和反序列化, 比 protobuf 快 10-50 倍.
details: 只需要一行代码完成序列化和反序列化, 比 protobuf 快 2-50 倍.
- title: coro_rpc
details: Very easy-to-use, coroutine-based, high performance rpc framework with C++20, more than 2000w qps in echo scene.
- title: struct_json
Expand Down
6 changes: 3 additions & 3 deletions website/docs/zh/struct_pack/struct_pack_tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
struct_pack在编译期会根据被序列化的对象的类型生成类型字符串,并根据该字符串生成一个32位的MD5并取其高31位作为类型校验码。反序列化时会检查校验码是否和待反序列化的类型相同。
为了缓解可能出现的哈希冲突,在debug模式下,struct_pack会存储完整的类型字符串。因此debug模式下生成的二进制体积比release略大。
## 类型约束
1. struct_pack目前要求,用户自定义的结构体类型必须是聚合类(`std::is_aggregate_v<T> == true`)。
2. 序列化的类型必须是struct_pack类型系统中的合法类型。详见:struct_pack的类型系统。See document:[struct_pack 类型系统](https://alibaba.github.io/yalantinglibs/zh/struct_pack/struct_pack_type_system.html)
3. struct_pack允许新增struct_pack::compatible字段,并保证其前向/后向的兼容性,只要每次协议变更时填入的版本号大于上一次的版本号即可。如果删除/修改了已有字段,则无法保证兼容性。详见[文档](https://alibaba.github.io/yalantinglibs/zh/struct_pack/struct_pack_type_system.html#%E5%85%BC%E5%AE%B9%E7%B1%BB%E5%9E%8B)

1. 序列化的类型必须是struct_pack类型系统中的合法类型。详见:struct_pack的类型系统。See document:[struct_pack 类型系统](https://alibaba.github.io/yalantinglibs/zh/struct_pack/struct_pack_type_system.html)
2. struct_pack允许新增struct_pack::compatible字段,并保证其前向/后向的兼容性,只要每次协议变更时填入的版本号大于上一次的版本号即可。如果删除/修改了已有字段,则无法保证兼容性。详见[文档](https://alibaba.github.io/yalantinglibs/zh/struct_pack/struct_pack_type_system.html#%E5%85%BC%E5%AE%B9%E7%B1%BB%E5%9E%8B)

0 comments on commit f6ff804

Please sign in to comment.