Skip to content

Commit

Permalink
格式check改动-恢复
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jun 28, 2024
1 parent 1537b68 commit d0694f6
Show file tree
Hide file tree
Showing 34 changed files with 203 additions and 206 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/docusaurus-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
Expand Down
2 changes: 0 additions & 2 deletions docs/blog/code/layotto-rpc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -936,9 +936,7 @@ func (p *parser) recvMsg(maxReceiveMessageSize int) (pf payloadFormat, msg []byt
最终收到返回数据:
```json

{"jsonrpc":"2.0","id":9527,"result":{"id":"113","name":"Moorse","age":30,"time":703394193,"sex":"MAN"}}

```
## 总结
Expand Down
5 changes: 3 additions & 2 deletions docs/docs/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Layotto (L8): To be the next layer of OSI layer 7
<img src="https://gw.alipayobjects.com/zos/bmw-prod/65518bfc-8ba5-4234-a5c5-2bc065e3a5f0.svg" height="120px"/>

[![Layotto Env Pipeline 🌊](https://github.com/mosn/layotto/actions/workflows/quickstart-checker.yml/badge.svg)](https://github.com/mosn/layotto/actions/workflows/quickstart-checker.yml)
[//]: # ([![Layotto Env Pipeline 🌊]&#40;https://github.com/mosn/layotto/actions/workflows/quickstart-checker.yml/badge.svg&#41;]&#40;https://github.com/mosn/layotto/actions/workflows/quickstart-checker.yml&#41;)
[![Layotto Env Pipeline 🌊](https://github.com/mosn/layotto/actions/workflows/proto-checker.yml/badge.svg)](https://github.com/mosn/layotto/actions/workflows/proto-checker.yml)
[![Layotto Dev Pipeline 🌊](https://github.com/mosn/layotto/actions/workflows/layotto-ci.yml/badge.svg)](https://github.com/mosn/layotto/actions/workflows/layotto-ci.yml)

[![GoDoc](https://godoc.org/mosn.io/layotto?status.svg)](https://godoc.org/mosn.io/layotto)
Expand Down Expand Up @@ -178,6 +179,6 @@ Layotto enriches the <a href="https://landscape.cncf.io/serverless">CNCF CLOUD N

## FAQ

## 跟 dapr 有什么差异?
### 跟 dapr 有什么差异?

dapr 是一款优秀的 Runtime 产品,但它本身缺失了 Service Mesh 的能力,而这部分能力对于实际在生产环境落地是至关重要的,因此我们希望把 Runtime 跟 Service Mesh 两种能力结合在一起,满足更复杂的生产落地需求。
2 changes: 1 addition & 1 deletion docs/docs/component_specs/configuration/apollo.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 配置项说明
示例:configs/config_apollo.json
![img.png]((/img/configuration/apollo/img.png)
![img.png](/img/configuration/apollo/img.png)

| 字段 | 必填 | 说明 |
| --- | --- | --- |
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/component_specs/configuration/nacos.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

不过不是添加在 nacos configstore 组件的配置里,添加在而外的配置项中,方便其他需要使用 `app_id` 的组件复用。

![img.png]((/img/configuration/nacos/img.png)
![img.png](/img/configuration/nacos/img.png)

## 怎么启动 Nacos

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/component_specs/file/tencentcloud_oss.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

访问 https://console.cloud.tencent.com/cos/bucket 创建存储桶

![]((/img/file/create_tencent_oss_bucket.png)
![](/img/file/create_tencent_oss_bucket.png)

3.创建 AK 和 SK

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/configuration/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Layotto 启动时需要读取一个 json 格式的配置文件。示例配置文

目前,Layotto使用一个MOSN 4层filter与MOSN集成、跑在MOSN上,**所以Layotto用到的配置文件其实就是MOSN配置文件。**

![img.png]((/img/configuration/layotto/img.png)
![img.png](/img/configuration/layotto/img.png)

如上图示例,大部分配置是MOSN的配置项,参考[MOSN的配置说明](https://mosn.io/docs/configuration/) ;

Expand Down
6 changes: 3 additions & 3 deletions docs/docs/design/faas/faas-poc-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

整套FaaS的方案中,主要解决了以下两个问题:
1. 编译产生的 wasm 文件跟镜像之间的关系是什么?
1. 目标 wasm 文件最终被构建到一个普通镜像中,推送到 Dockerhub 里,拉取镜像的过程也跟原生的镜像保持一致,只不过实际运行时会把目标 wasm 文件从镜像中提取出来单独加载。
1. 目标 wasm 文件最终被构建到一个普通镜像中,推送到 Dockerhub 里,拉取镜像的过程也跟原生的镜像保持一致,只不过实际运行时会把目标 wasm 文件从镜像中提取出来单独加载。
2. 如何让k8s管理部署 wasm 文件?
1. 基于k8s的生命周期管理及调度策略,结合Containerd的v2接口定义,自定义了Containerd-shim-layotto-v2插件,把容器运行时改造为Layotto Runtime,比如k8s创建容器的动作变成了加载 wasm 形态的函数并运行。
2. 得益于 WebAssembly 优秀的沙箱隔离环境,Layotto 作为基座可以加载运行多个 wasm 形态的函数,它们虽然都跑在一个进程里但互不影响,这种 nanoprocess 的思路相比于 docker 可以进一步充分利用资源。
1. 基于k8s的生命周期管理及调度策略,结合Containerd的v2接口定义,自定义了Containerd-shim-layotto-v2插件,把容器运行时改造为Layotto Runtime,比如k8s创建容器的动作变成了加载 wasm 形态的函数并运行。
2. 得益于 WebAssembly 优秀的沙箱隔离环境,Layotto 作为基座可以加载运行多个 wasm 形态的函数,它们虽然都跑在一个进程里但互不影响,这种 nanoprocess 的思路相比于 docker 可以进一步充分利用资源。

### 二、核心组件

Expand Down
20 changes: 10 additions & 10 deletions docs/docs/development/component_ref/component_ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
### 相关设计

目前只支持最需要被应用的两个组件类型:ConfigStore和SecretStore,即配置组件和秘钥组件。
Ref接口设计,组件需实现此接口才能实现注入。
Ref接口设计,组件需实现此接口才能实现注入。

```go
type SetComponent interface {
SetConfigStore(cs configstores.Store) (err error)
SetSecretStore(ss secretstores.SecretStore) (err error)
SetConfigStore(cs configstores.Store) (err error)
SetSecretStore(ss secretstores.SecretStore) (err error)
}
```

Expand All @@ -39,13 +39,13 @@ return nil
}
//fetch secret/config when component init
func (hw *HelloWorld) Init(config *hello.HelloConfig) error {
hw.secretStore.GetSecret(secretstores.GetSecretRequest{
Name: "dbPassword",
})
hw.config.Get(context.Background(),&configstores.GetRequest{
Keys: []string{"dbAddress"},
})
return nil
hw.secretStore.GetSecret(secretstores.GetSecretRequest{
Name: "dbPassword",
})
hw.config.Get(context.Background(),&configstores.GetRequest{
Keys: []string{"dbAddress"},
})
return nil
}
```

Expand Down
14 changes: 7 additions & 7 deletions docs/docs/development/contributing-doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

文档统一放在docs/目录下,其中docs/en存放英文文档,docs/zh存放中文文档。

![img_2.png]((/img/development/doc/img_2.png)
![img_2.png](/img/development/doc/img_2.png)

## 2. 文档站点说明
docs/目录下的文件,会被自动部署到github pages,通过[docsify](https://docsify.js.org/#/) 渲染。
Expand Down Expand Up @@ -39,7 +39,7 @@ step 3. 打开 http://localhost:3000/ 查看文档站点。
### step 1. 新建 markdown 文档
当需要新增文档时,可以按目录结构新建文件夹、新建.md文件。比如想写分布式锁API的设计文档,就新建目录:

![img_1.png]((/img/development/doc/img_1.png)
![img_1.png](/img/development/doc/img_1.png)

### step 2. 把文档加入侧边栏
新增文档、写完内容后,记得更新一下侧边栏哦。
Expand All @@ -60,22 +60,22 @@ step 3. 打开 http://localhost:3000/ 查看文档站点。

这里说的超链接是那种点了后会跳转到其他文档的链接,比如下面这种:

![img_4.png]((/img/development/doc/img_4.png)
![img_4.png](/img/development/doc/img_4.png)

### 4.1. 错误的写法
如果你尝试用相对路径写超链接url,会发现在站点里点击他就会404:

![img_6.png]((/img/development/doc/img_6.png)
![img_6.png](/img/development/doc/img_6.png)

![img_7.png]((/img/development/doc/img_7.png)
![img_7.png](/img/development/doc/img_7.png)

### 4.2. 正确的写法

有两种正确的方式使用超链接:

a. 用相对于docs/目录的相对路径。例如:

![img_5.png]((/img/development/doc/img_5.png)
![img_5.png](/img/development/doc/img_5.png)

b. 用完整的Url。例如:

Expand All @@ -86,7 +86,7 @@ see [runtime_config.json](https://github.com/mosn/layotto/blob/main/configs/runt
## 5. 图片目录与图片链接
图片放在docs/img/ 目录下。放这里是为了能让docsify站点能访问到:

![img.png]((/img/development/doc/img.png)
![img.png](/img/development/doc/img.png)

文档中引用图片建议就用完整路径,免得遇到一堆乱七八糟的路径问题。

Expand Down
28 changes: 14 additions & 14 deletions docs/docs/development/developing-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ A: **本规范只限制“新增Layotto API的pr需要有哪些东西”(比

- 需求分析
- 为什么要做这个API
- 定义需求的边界,哪些feature支持,哪些不支持
- 市面上产品调研
- 定义需求的边界,哪些feature支持,哪些不支持
- 市面上产品调研
- grpc/http API设计
- 组件API设计
- 组件API设计
- 解释你的设计

一个优秀的提案示例:https://github.com/dapr/dapr/issues/2988
Expand Down Expand Up @@ -87,27 +87,27 @@ A: **本规范只限制“新增Layotto API的pr需要有哪些东西”(比
文档路径在"用户手册--接口文档"下,例如 State API的见 https://mosn.io/layotto/#/zh/api_reference/state/reference

>调研发现Dapr的使用文档较多,比如光State API就有:
>
>
> https://docs.dapr.io/developing-applications/building-blocks/state-management/
> https://docs.dapr.io/reference/api/state_api/
>
> https://docs.dapr.io/reference/api/state_api/
>
> https://docs.dapr.io/operations/components/setup-state-store/
>
>
> https://docs.dapr.io/reference/components-reference/supported-state-stores/
>
>
> 我们处于项目早期,可以轻一些
需要有:
##### what.这个API是啥,解决啥问题
##### when.什么场景适合用这个API
##### how.怎么用这个API
- 接口列表。例如:

![img_4.png]((/img/development/api/img_4.png)

列出来有哪些接口,一方面省的用户自己去翻proto、不知道哪些是相关API,一方面避免用户产生"这项目连接口文档都没有?!"的反感
- 关于接口的出入参:拿proto注释当接口文档
考虑到接口文档用中英文写要写两份、时间长了还有可能和代码不一致,因此建议不写接口文档,直接把proto注释写的足够详细、当接口文档。例如:
考虑到接口文档用中英文写要写两份、时间长了还有可能和代码不一致,因此建议不写接口文档,直接把proto注释写的足够详细、当接口文档。例如:

```protobuf
// GetStateRequest is the message to get key-value states from specific state store.
Expand All @@ -124,7 +124,7 @@ message GetStateRequest {
// (optional) The metadata which will be sent to state store components.
map<string, string> metadata = 4;
}
// StateOptions configures concurrency and consistency for state operations
message StateOptions {
// Enum describing the supported concurrency for state.
Expand Down Expand Up @@ -162,7 +162,7 @@ message StateOptions {
这就要求proto注释里写清楚:
- 是必传参数还是可选参数;
- 解释这个字段啥含义;光解释字面意思是不够的,要解释背后的使用机制,比如上面的consistency和concurrency要解释用户传了某个选项后,服务器能提供什么样的保证

(consistency和concurrency上面的注释其实是我把Dapr文档上的描述精简后粘过来的,省了写双语文档)
- 注释讲不清楚的,在文档上解释

Expand Down Expand Up @@ -202,7 +202,7 @@ message StateOptions {

```protobuf
//StopSubscribe stop subs
StopSubscribe()
StopSubscribe()
```

## 三、提交pull request
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/development/developing-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

1. git clone下载代码到您喜欢的目录
2. 使用Docker启动您需要的环境。比如您想用zookeeper开发分布式锁API,就需要本地用Docker启动一个zookeeper容器,用于本地测试。

如果您本地没有Docker也不用害怕,可以参照 [Docker Desktop教程](https://www.runoob.com/docker/windows-docker-install.html) 装一个Docker Desktop,Mac和Windows都可以,用起来特别简单。

## 二、开发组件和单元测试
Expand All @@ -29,7 +29,7 @@
- 其他:Layotto的pkg/common目录下有一些工具类,以及mosn.io/pkg下也有很多工具类

### 2.2. 复制粘贴别的组件

简单起见,可以直接复制粘贴别的组件过来,修改开发。比如想用zookeeper实现分布式锁API的话,可以把redis组件复制粘贴过来改

### 2.3. 记得编写单元测试哦!
Expand All @@ -43,7 +43,7 @@

一般是把所有网络调用的代码封装成一个interface,然后在ut中mock掉这个interface。以apollo配置中心的单元测试为例,见components/configstores/apollo/configstore.go 和 components/configstores/apollo/configstore_test.go :

首先,在configstore.go里,把所有调sdk、发起网络调用调apollo的地方给封装成一个interface
首先,在configstore.go里,把所有调sdk、发起网络调用调apollo的地方给封装成一个interface

![mock.png]((/img/development/component/mock.png)
![img_8.png]((/img/development/component/img_8.png)
Expand Down Expand Up @@ -129,7 +129,7 @@

![img_2.png]((/img/development/component/img_2.png)

启动demo、调用Layotto,看看有没有报错。如果是通用客户端,可以在命令行命令里带上-s storeName传入storeName
启动demo、调用Layotto,看看有没有报错。如果是通用客户端,可以在命令行命令里带上-s storeName传入storeName

![img_5.png]((/img/development/component/img_5.png)

Expand Down
6 changes: 3 additions & 3 deletions docs/docs/development/github-workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Layotto Env Pipeline 流水线任务触发方式:
## Layotto Dev Pipeline 🌊 (Before Merged)
![release.png]((/img/development/workflow/workflow-dev.png)
![release.png](/img/development/workflow/workflow-dev.png)
### Job 任务内容
Expand Down Expand Up @@ -118,7 +118,7 @@ Layotto Dev Pipeline (Before Merged) 流水线主要负责 Layotto 提交 PR 后
## Layotto Dev Pipeline 🌊 (After Merged)
![release.png]((/img/development/workflow/workflow-merge.png)
![release.png](/img/development/workflow/workflow-merge.png)
### Job 任务内容
Expand Down Expand Up @@ -157,7 +157,7 @@ Layotto Dev Pipeline (After Merged) 流水线主要负责 Layotto 代码合并
## Layotto Release Pipeline 🌊
![release.png]((/img/development/workflow/work(/img/lease.png)
![release.png](/img/development/workflow/work(/img/lease.png)
### Job 任务内容
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/development/release-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ Layotto 发布周期暂定为每季度发布一次。
+ AMD64/X86 架构的镜像:`layotto/layotto:{tag}`
+ ARM64 架构的镜像:`layotto/layotto.arm64:{tag}`

![release.png]((/img/development/workflow/release.png)
![release.png](/img/development/workflow/release.png)

### Step3: Draft a new release 并编写发布报告

> 发布报告可以先用 github 的功能自动生成,再基于生成的内容做修改。
> 可以参考以前的 [发版报告](https://github.com/mosn/layotto/releases)
![img_1.png]((/img/development/release/img_1.png)
![img_1.png](/img/development/release/img_1.png)

### Step4: 上传多平台架构的 Binaries
> 2022/05/04更新:这一步可以忽略。打 tag 发布后,Layotto 的 Release Pipeline 会自动上传二进制文件,无需手动上传。PR 见 https://github.com/mosn/layotto/pull/566
> 如果没有自动上传,可以手动将 `步骤 2` 中构建的多平台 Artifacts 下载、上传
![img.png]((/img/development/release/img.png)
![img.png](/img/development/release/img.png)

### Step5: 确认发布

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/start/faas/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Layotto支持加载并运行以 wasm 为载体的 Function,并支持Function
按照官网操作即可。

3. [virtualbox](https://www.oracle.com/virtualization/technologies/vm/virtualbox.html)

直接官网下载安装包安装即可,mac下也可以使用 [homebrew](https://brew.sh/) 进行安装。安装完以后如果启动失败,请参考[The host-only adapter we just created is not visible](https://github.com/kubernetes/minikube/issues/3614)


Expand Down Expand Up @@ -160,7 +160,7 @@ There are 100 inventories for book1.

2.启动Layotto时,redis连接失败,打印 "occurs an error: redis store: error connecting to redis at":

检查redis的配置,看是否redis配置错误造成的。
检查redis的配置,看是否redis配置错误造成的。



Expand Down
Loading

0 comments on commit d0694f6

Please sign in to comment.