Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] fix link #352

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/struct_pb/protoc-plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ if (Protobuf_FOUND)
)
else ()
message(WARNING "struct_pb is skipped. To build struct_pb protoc plugin, you must install libprotoc first!!!\n"
"see https://alibaba.github.io/yalantinglibs/guide/struct-pb-generating-your-struct.html"
"see https://alibaba.github.io/yalantinglibs/en/struct_pb/struct_pb_generating_your_struct.html"
)
endif ()
4 changes: 2 additions & 2 deletions website/docs/en/coro_rpc/coro_rpc_introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ As demonstrated above, it is also very convenient to build a client. There's not

The server/client implementation shows the usability and core features of coro_rpc. Also, it shows us the core concept of RPC: that users can invoke remote methods in a way with local functions, and users will focus their efforts on RPC functions.

Another usability of coro_rpc is that: there are barely any constraints on the RPC function itself. One could define an RPC function with any number of parameters. The parameters' type should be legal for struct_pack. (See [struct pack type system](https://alibaba.github.io/yalantinglibs/guide/struct-pack-type-system.html)). The serialization/deserialization procedures are transparent to users and the RPC framework will take care of them automatically.
Another usability of coro_rpc is that: there are barely any constraints on the RPC function itself. One could define an RPC function with any number of parameters. The parameters' type should be legal for struct_pack. (See [struct pack type system](https://alibaba.github.io/yalantinglibs/zh/struct_pack/struct_pack_type_system.html)). The serialization/deserialization procedures are transparent to users and the RPC framework will take care of them automatically.

## RPC with any parameters

Expand Down Expand Up @@ -127,7 +127,7 @@ int main() {
syncAwait(test_client());
}
```
The input parameter and return type of `get_person` is a `struct`. The serialization/deserialization are automatically done by library [struct_pack](https://alibaba.github.io/yalantinglibs/guide/struct-pack-intro.html) with compile-time reflection. Users are not required to take efforts on such procedures.
The input parameter and return type of `get_person` is a `struct`. The serialization/deserialization are automatically done by library [struct_pack](https://alibaba.github.io/yalantinglibs/en/struct_pack/struct_pack_intro.html) with compile-time reflection. Users are not required to take efforts on such procedures.

# Compare with grpc/brpc

Expand Down
6 changes: 3 additions & 3 deletions website/docs/en/struct_pack/struct_pack_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ auto buffer1 = serialize(map1);
auto buffer2 = serialize(map2);
```

For more detail, See [struct_pack type system](https://alibaba.github.io/yalantinglibs/guide/struct-pack-type-system.html)
For more detail, See [struct_pack type system](https://alibaba.github.io/yalantinglibs/en/struct_pack/struct_pack_type_system.html)

### custom output stream

Expand Down Expand Up @@ -388,11 +388,11 @@ Remember,if the version number is not incremental, struct_pack can't achieve t

### struct_pack type system

[struct_pack type system](https://alibaba.github.io/yalantinglibs/guide/struct-pack-type-system.html)
[struct_pack type system](https://alibaba.github.io/yalantinglibs/en/struct_pack/struct_pack_type_system.html)

### struct_pack layout

[struct_pack layout](https://alibaba.github.io/yalantinglibs/guide/struct-pack-layout.html)
[struct_pack layout](https://alibaba.github.io/yalantinglibs/en/struct_pack/struct_pack_layout.html)


### Test code
Expand Down
2 changes: 1 addition & 1 deletion website/docs/en/struct_pack/struct_pack_layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ of this field is used to get the `type hash` higher 31 bits.

The length of this field could be determined at compile time if it passed validation. However, it's length could only be determined by the position of char `'\0'` when validation failed.

The encoding rules for this field and its mapping to the struct_pack type tree can be found in[struct_pack type system](https://alibaba.github.io/yalantinglibs/guide/struct-pack-type-system.html)
The encoding rules for this field and its mapping to the struct_pack type tree can be found in[struct_pack type system](https://alibaba.github.io/yalantinglibs/en/struct_pack/struct_pack_type_system.html)


Take the following type as an example:
Expand Down
6 changes: 2 additions & 4 deletions website/docs/en/struct_pack/struct_pack_tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ This document introcude some tips about struct_pack
## macro
| macro | description |
| ----------- | ------------------ |
| STRUCT_PACK_OPTIMIZE |
Allow more extremed loop unrolling to get better performance, but it cost more compile time. | |
STRUCT_PACK_ENABLE_UNPORTABLE_TYPE |
enable serialize unportable type, such as wchar_t and wstring. Deserialize them in other platform is ubdefined bevaior. |
| STRUCT_PACK_OPTIMIZE | Allow more extremed loop unrolling to get better performance, but it cost more compile time. |
| STRUCT_PACK_ENABLE_UNPORTABLE_TYPE | Enable serialize unportable type, such as wchar_t and wstring. Deserialize them in other platform is ubdefined bevaior. |
## How to speed up serialization/deserialization
1. use string_view instead of string, use span instead of vector/array.
2. move trivial field to a standlone struct, so that struct_pack could copy it faster.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/en/struct_pb/struct_pb_quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ To do this, you need to run the protocol buffer compiler `protoc` with `struct_p
```shell
protoc -I=$SRC_DIR --plugin=$PATH_TO_protoc-gen-struct_pb --struct_pb_out=$DST_DIR $SRC_DIR/addressbook.proto
```
see [Generating source code](https://alibaba.github.io/yalantinglibs/guide/struct-pb-generating-your-struct.html) for details.
see [Generating source code](https://alibaba.github.io/yalantinglibs/en/struct_pb/struct_pb_generating_your_struct.html) for details.

This generates the following files in your specified destination directory:

Expand Down
4 changes: 2 additions & 2 deletions website/docs/zh/coro_rpc/coro_rpc_introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ client调用rpc函数也同样简单,5,6行代码就可以实现rpc调用了

相信上面的这个简单的例子已经充分展示了coro_rpc的易用性和特点了,也体现了rpc的本质,即用户可以像调用本地函数那样调用远程函数,用户只需要关注rpc函数的业务逻辑即可。

coro_rpc的接口易用性还体现在rpc函数几乎没有任何限制,rpc函数可以拥有任意多个参数,参数的序列化和反序列化由rpc库自动完成,用户无需关心。rpc库支持的参数类型相当广泛详见:[struct_pack的类型系统](https://alibaba.github.io/yalantinglibs/zh/guide/struct-pack-type-system.html)
coro_rpc的接口易用性还体现在rpc函数几乎没有任何限制,rpc函数可以拥有任意多个参数,参数的序列化和反序列化由rpc库自动完成,用户无需关心。rpc库支持的参数类型相当广泛详见:[struct_pack的类型系统](https://alibaba.github.io/yalantinglibs/zh/struct_pack/struct_pack_type_system.html)

## rpc函数支持任意参数

Expand Down Expand Up @@ -141,7 +141,7 @@ int main() {
}
```

这里面get_person函数的参数和返回值都是结构体,通过编译期反射的序列化库[struct_pack](https://alibaba.github.io/yalantinglibs/zh/guide/struct-pack-intro.html)实现自动的序列化和反序列化,用户无感知,省心省力。
这里面get_person函数的参数和返回值都是结构体,通过编译期反射的序列化库[struct_pack](https://alibaba.github.io/yalantinglibs/zh/struct_pack/struct_pack_intro.html)实现自动的序列化和反序列化,用户无感知,省心省力。

# 和grpc、brpc比较易用性

Expand Down
6 changes: 3 additions & 3 deletions website/docs/zh/struct_pack/struct_pack_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ auto buffer2 = serialize(map2);

关于自定义类型的更多细节,请见:

[struct_pack的类型系统](https://alibaba.github.io/yalantinglibs/zh/guide/struct-pack-type-system.html)
[struct_pack的类型系统](https://alibaba.github.io/yalantinglibs/zh/struct_pack/struct_pack_type_system.html)

### 序列化到自定义的输出流

Expand Down Expand Up @@ -405,11 +405,11 @@ struct_pack保证上述的这四个类型之间,可以通过序列化和反序

### 关于struct_pack类型系统

[struct_pack的类型系统](https://alibaba.github.io/yalantinglibs/zh/guide/struct-pack-type-system.html)
[struct_pack的类型系统](https://alibaba.github.io/yalantinglibs/zh/struct_pack/struct_pack_type_system.html)

### 关于struct_pack的编码与布局

[struct_pack的编码与布局](https://alibaba.github.io/yalantinglibs/zh/guide/struct-pack-layout.html)
[struct_pack的编码与布局](https://alibaba.github.io/yalantinglibs/zh/struct_pack/struct_pack_layout.html)

### 测试代码

Expand Down
2 changes: 1 addition & 1 deletion website/docs/zh/struct_pack/struct_pack_layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

当类型校验通过时,该字段的长度可在编译期确定。当校验失败时,该字段的长度需要根据`'\0'`字符的位置确定。

该字段的编码规则以及它和struct_pack类型树的映射关系请见[struct_pack的类型系统](https://alibaba.github.io/yalantinglibs/zh/guide/struct-pack-type-system.html)。
该字段的编码规则以及它和struct_pack类型树的映射关系请见[struct_pack的类型系统](https://alibaba.github.io/yalantinglibs/zh/struct_pack/struct_pack_type_system.html)。

例如,对于类型:
```cpp
Expand Down
6 changes: 2 additions & 4 deletions website/docs/zh/struct_pack/struct_pack_tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
## 宏
| 宏 | 作用 |
| ----------- | ------------------ |
| STRUCT_PACK_OPTIMIZE |
增加模板实例化的数量,通过牺牲编译时间和二进制体积来换取更好的性能 | |
STRUCT_PACK_ENABLE_UNPORTABLE_TYPE |
允许序列化unportable的类型,如wchar_t和wstring,请注意,这些类型序列化出的二进制数据可能无法正常的在其他平台下反序列化|
| STRUCT_PACK_OPTIMIZE |增加模板实例化的数量,通过牺牲编译时间和二进制体积来换取更好的性能 |
|STRUCT_PACK_ENABLE_UNPORTABLE_TYPE |允许序列化unportable的类型,如wchar_t和wstring,请注意,这些类型序列化出的二进制数据可能无法正常的在其他平台下反序列化|
## 如何让序列化or反序列化更加高效
1. 考虑使用string_view代替string, 使用span代替vector/array;
2. 把平凡字段封装到一个单独的结构体中,优化拷贝速度;
Expand Down
2 changes: 1 addition & 1 deletion website/docs/zh/struct_pb/struct_pb_quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ To do this, you need to run the protocol buffer compiler `protoc` with `struct_p
```shell
protoc -I=$SRC_DIR --plugin=$PATH_TO_protoc-gen-struct_pb --struct_pb_out=$DST_DIR $SRC_DIR/addressbook.proto
```
see [Generating source code](https://alibaba.github.io/yalantinglibs/guide/struct-pb-generating-your-struct.html) for details.
see [Generating source code](https://alibaba.github.io/yalantinglibs/en/struct_pb/struct_pb_generating_your_struct.html) for details.

This generates the following files in your specified destination directory:

Expand Down