Skip to content

Commit fe54c49

Browse files
authored
doc: update volo and motore doc to adapt new version (#837)
1 parent b3fc20f commit fe54c49

File tree

13 files changed

+73
-264
lines changed

13 files changed

+73
-264
lines changed

content/en/docs/motore/overview/_index.md

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ description: >
66
77
---
88

9-
Motore is an async middleware abstraction powered by GAT and TAIT.
9+
Motore is an async middleware abstraction powered by AFIT and RPITIT.
1010

1111
Around Motore, we build modular and reusable components for building robust networking clients and servers.
1212

1313
Motore is greatly inspired by [`Tower`][Tower].
1414

1515
## Overview
1616

17-
Motore uses GAT and TAIT to reduce the mental burden of writing asynchronous code, especially to avoid the overhead of `Box` to make people less anxious.
17+
Motore uses AFIT and RPITIT to reduce the mental burden of writing asynchronous code, especially to avoid the overhead of `Box` to make people less anxious.
1818

1919
The core abstraciton of Motore is the `Service` trait:
2020

@@ -24,20 +24,14 @@ pub trait Service<Cx, Request> {
2424
type Response;
2525
/// Errors produced by the service.
2626
type Error;
27-
/// The future response value.
28-
type Future<'cx>: Future<Output = Result<Self::Response, Self::Error>> + Send + 'cx
29-
where
30-
Cx: 'cx,
31-
Self: 'cx;
27+
3228
/// Process the request and return the response asynchronously.
33-
fn call<'cx, 's>(&'s mut self, cx: &'cx mut Cx, req: Request) -> Self::Future<'cx>
34-
where
35-
's: 'cx;
29+
async fn call<'s, 'cx>(&'s mut self, cx: &'cx mut Cx, req: Request) -> Result<Self::Response, Self::Error>;
3630
}
3731
```
3832
## Getting Started
3933

40-
Combing GAT and `impl_trait_in_assoc_type` together, we can write asynchronous code in a very concise and readable way.
34+
Using AFIT, we can write asynchronous code in a very concise and readable way.
4135

4236
```rust
4337
pub struct Timeout<S> {
@@ -53,19 +47,14 @@ where
5347
{
5448
type Response = S::Response;
5549
type Error = BoxError;
56-
type Future<'cx> = impl Future<Output = Result<S::Response, Self::Error>> + 'cx;
57-
fn call<'cx, 's>(&'s mut self, cx: &'cx mut Cx, req: Req) -> Self::Future<'cx>
58-
where
59-
's: 'cx,
60-
{
61-
async move {
62-
let sleep = tokio::time::sleep(self.duration);
63-
tokio::select! {
64-
r = self.inner.call(cx, req) => {
65-
r.map_err(Into::into)
66-
},
67-
_ = sleep => Err(std::io::Error::new(std::io::ErrorKind::TimedOut, "service time out").into()),
68-
}
50+
51+
async fn call<'s, 'cx>(&'s mut self, cx: &'cx mut Cx, req: Req) -> Result<Self::Response, Self::Error> {
52+
let sleep = tokio::time::sleep(self.duration);
53+
tokio::select! {
54+
r = self.inner.call(cx, req) => {
55+
r.map_err(Into::into)
56+
},
57+
_ = sleep => Err(std::io::Error::new(std::io::ErrorKind::TimedOut, "service time out").into()),
6958
}
7059
}
7160
}

content/en/docs/volo/overview/_index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ description: >
1010

1111
Volo is a **high-performance** and **strong-extensibility** Rust RPC framework that helps developers build microservices.
1212

13-
Volo uses [Motore](https://github.com/cloudwego/motore) as its middleware abstraction, which is powered by GAT.
13+
Volo uses [Motore](https://github.com/cloudwego/motore) as its middleware abstraction, which is powered by AFIT and RPITIT.
1414

1515
## Architecture
1616

1717
![Volo](/img/docs/volo.png)
1818

1919
## Features
2020

21-
### Powered by GAT
21+
### Powered by AFIT and RPITIT
2222

23-
Volo uses Motore as its middleware abstraction, which is powered by GAT.
23+
Volo uses Motore as its middleware abstraction, which is powered by AFIT and RPITIT.
2424

25-
Through GAT, we can avoid many unnecessary Box memory allocations, improve ease of use,
25+
Through AFIT and RPITIT, we can avoid many unnecessary Box memory allocations, improve ease of use,
2626
and provide users with a more friendly programming interface and a more ergonomic programming paradigm.
2727

2828
### High Performance
@@ -55,5 +55,5 @@ We have also created an organization [Volo-rs](http://github.com/volo-rs), any c
5555

5656
1. [Volo-rs](http://github.com/volo-rs):The volo ecosystem which contains a lot of useful components.
5757
2. [Pilota](https://github.com/cloudwego/pilota):A thrift and protobuf implementation in pure rust with high performance and extensibility.
58-
3. [Motore](https://github.com/cloudwego/motore):Middleware abstraction layer powered by GAT.
58+
3. [Motore](https://github.com/cloudwego/motore):Middleware abstraction layer powered by AFIT and RPITIT.
5959
4. [Metainfo](https://github.com/cloudwego/metainfo):Transmissing metainfo across components.

content/en/docs/volo/volo-grpc/getting-started/part_2.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,8 @@ At this point, our entire directory structure looks like this:
104104
Then we open `src/lib.rs` and add the method implementation to the `impl` block. The resulting code should look like this:
105105

106106
```rust
107-
#![feature(impl_trait_in_assoc_type)]
108-
109107
pub struct S;
110108

111-
#[volo::async_trait]
112109
impl volo_gen::volo::example::ItemService for S {
113110
// This is the part of the code we need to add
114111
async fn get_item(

content/en/docs/volo/volo-thrift/getting-started/part_2.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,8 @@ At this point, our entire directory structure looks like this:
103103
Then we open `src/lib.rs` and add the method implementation to the `impl` block. The resulting code should look like this:
104104

105105
```rust
106-
#![feature(impl_trait_in_assoc_type)]
107-
108106
pub struct S;
109107

110-
#[volo::async_trait]
111108
impl volo_gen::volo::example::ItemService for S {
112109
// This is the part of the code we need to add
113110
async fn get_item(

content/zh/docs/motore/faq/q1_gat.md

Lines changed: 0 additions & 131 deletions
This file was deleted.
File renamed without changes.

content/zh/docs/motore/overview/_index.md

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ description: >
66
77
---
88

9-
Motore 是一个使用了 GATTAIT 特性的中间件抽象层。
9+
Motore 是一个使用了 AFITRPITIT 特性的中间件抽象层。
1010

1111
基于 Motore,我们编写了一些模块化并且可复用的,用来编写 client 和 server 的组件。
1212

1313
Motore 深受[`Tower`][Tower] 启发。
1414

15-
Motore 使用 GATTAIT 来减轻编写异步代码的精神负担,尤其是为了避免 `Box` 的开销而导致的负担,以减少使用者的焦虑。
15+
Motore 使用 AFITRPITIT 来减轻编写异步代码的精神负担,尤其是为了避免 `Box` 的开销而导致的负担,以减少使用者的焦虑。
1616

1717
Motore 最核心的抽象是 `Service` trait:
1818

@@ -22,20 +22,14 @@ pub trait Service<Cx, Request> {
2222
type Response;
2323
/// Errors produced by the service.
2424
type Error;
25-
/// The future response value.
26-
type Future<'cx>: Future<Output = Result<Self::Response, Self::Error>> + Send + 'cx
27-
where
28-
Cx: 'cx,
29-
Self: 'cx;
25+
3026
/// Process the request and return the response asynchronously.
31-
fn call<'cx, 's>(&'s mut self, cx: &'cx mut Cx, req: Request) -> Self::Future<'cx>
32-
where
33-
's: 'cx;
27+
async fn call<'s, 'cx>(&'s mut self, cx: &'cx mut Cx, req: Request) -> Result<Self::Response, Self::Error>;
3428
}
3529
```
3630
## 快速上手
3731

38-
通过将 GAT 和 TAIT 组合在一起,我们可以以非常简洁易读的方式编写异步代码:
32+
使用 AFIT,我们可以以非常简洁易读的方式编写异步代码:
3933

4034
```rust
4135
pub struct Timeout<S> {
@@ -51,19 +45,14 @@ where
5145
{
5246
type Response = S::Response;
5347
type Error = BoxError;
54-
type Future<'cx> = impl Future<Output = Result<S::Response, Self::Error>> + 'cx;
55-
fn call<'cx, 's>(&'s mut self, cx: &'cx mut Cx, req: Req) -> Self::Future<'cx>
56-
where
57-
's: 'cx,
58-
{
59-
async move {
60-
let sleep = tokio::time::sleep(self.duration);
61-
tokio::select! {
62-
r = self.inner.call(cx, req) => {
63-
r.map_err(Into::into)
64-
},
65-
_ = sleep => Err(std::io::Error::new(std::io::ErrorKind::TimedOut, "service time out").into()),
66-
}
48+
49+
async fn call<'s, 'cx>(&'s mut self, cx: &'cx mut Cx, req: Req) -> Result<Self::Response, Self::Error> {
50+
let sleep = tokio::time::sleep(self.duration);
51+
tokio::select! {
52+
r = self.inner.call(cx, req) => {
53+
r.map_err(Into::into)
54+
},
55+
_ = sleep => Err(std::io::Error::new(std::io::ErrorKind::TimedOut, "service time out").into()),
6756
}
6857
}
6958
}

0 commit comments

Comments
 (0)