Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	docs/docs/development/developing-api.md
#	docs/i18n/en-US/docusaurus-plugin-content-blog/code/webassembly/index.md
  • Loading branch information
[email protected] committed Jun 28, 2024
2 parents d0694f6 + 7de8c7a commit 586a953
Show file tree
Hide file tree
Showing 18 changed files with 49 additions and 57 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ None of these is essential for a pull request, but they will all help.
9. Make sure checks have been correctly passed, you can simply run `make check`
10. Contribute a Pull Request as the rule of Github Workflow, and you should follow the pull request's rules.

> Layotto provides many useful commands to help you contribute easier, please check it [here](docs/en/development/commands.md)
> Layotto provides many useful commands to help you contribute easier, please check it [here](docs/i18n/en-US/docusaurus-plugin-content-docs/current/development/commands.md)
## Version naming convention

Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ Layotto enriches the <a href="https://landscape.cncf.io/serverless">CNCF CLOUD N
As a programming enthusiast , have you ever felt that you want to participate in the development of an open source project, but don't know where to start?
In order to help everyone better participate in open source projects, our community will regularly publish community tasks to help everyone learn by doing!

[Document Contribution Guide](docs/en/development/contributing-doc.md)
[Document Contribution Guide](docs/i18n/en-US/docusaurus-plugin-content-docs/current/development/contributing-doc.md)

[Component Development Guide](docs/en/development/developing-component.md)
[Component Development Guide](docs/i18n/en-US/docusaurus-plugin-content-docs/current/development/developing-component.md)

[Layotto Github Workflows](docs/en/development/github-workflows.md)
[Layotto Github Workflows](docs/i18n/en-US/docusaurus-plugin-content-docs/current/development/github-workflows.md)

[Layotto Commands Guide](docs/en/development/commands.md)
[Layotto Commands Guide](docs/i18n/en-US/docusaurus-plugin-content-docs/current/development/commands.md)

[Layotto Contributor Guide](docs/en/development/CONTRIBUTING.md)
[Layotto Contributor Guide](docs/i18n/en-US/docusaurus-plugin-content-docs/current/development/CONTRIBUTING.md)

## Contributors

Expand All @@ -157,17 +157,17 @@ Thank y'all!

## Design Documents

[Actuator Design Doc](docs/en/design/actuator/actuator-design-doc.md)
[Actuator Design Doc](docs/i18n/en-US/docusaurus-plugin-content-docs/current/design/actuator/actuator-design-doc.md)

[Configuration API with Apollo](docs/en/design/configuration/configuration-api-with-apollo.md)
[Configuration API with Apollo](docs/i18n/en-US/docusaurus-plugin-content-docs/current/design/configuration/configuration-api-with-apollo.md)

[Pubsub API and Compability with Dapr Component](docs/en/design/pubsub/pubsub-api-and-compability-with-dapr-component.md)
[Pubsub API and Compability with Dapr Component](docs/i18n/en-US/docusaurus-plugin-content-docs/current/design/pubsub/pubsub-api-and-compability-with-dapr-component.md)

[RPC Design Doc](docs/en/design/rpc/rpc-design-doc.md)
[RPC Design Doc](docs/i18n/en-US/docusaurus-plugin-content-docs/current/design/rpc/rpc-design-doc.md)

[Distributed Lock API Design](docs/en/design/lock/lock-api-design.md)
[Distributed Lock API Design](docs/i18n/en-US/docusaurus-plugin-content-docs/current/design/lock/lock-api-design.md)

[FaaS Design](docs/en/design/faas/faas-poc-design.md)
[FaaS Design](docs/i18n/en-US/docusaurus-plugin-content-docs/current/design/faas/faas-poc-design.md)

## FAQ

Expand Down
2 changes: 0 additions & 2 deletions docs/docs/design/faas/faas-poc-design.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# FaaS设计文档

## FaaS设计

### 一、架构设计

Check failure on line 3 in docs/docs/design/faas/faas-poc-design.md

View workflow job for this annotation

GitHub Actions / Markdown Validation

Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]

![img.png](../(/img/faas/faas-design.jpg)
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/design/rpc/rpc_design_document.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RPC 设计文档
## RPC 设计

### API 设计

Check failure on line 3 in docs/docs/design/rpc/rpc_design_document.md

View workflow job for this annotation

GitHub Actions / Markdown Validation

Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]
[layotto rpc API](https://github.com/mosn/layotto/blob/f70cdc619693ad762cf809daf0579403c341def1/spec/proto/runtime/v1/runtime.proto#L19https://github.com/mosn/layotto/blob/f70cdc619693ad762cf809daf0579403c341def1/spec/proto/runtime/v1/runtime.proto#L19) 与Dapr保持一致.

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/development/component_ref/component_ref.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# layotto组件引用

## 背景
### 背景

Check failure on line 3 in docs/docs/development/component_ref/component_ref.md

View workflow job for this annotation

GitHub Actions / Markdown Validation

Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]

组件初始化的时候,需要引用其他组件的能力,比如sequencer组件初始化的时候需要从config组件读取相关的配置,以此实现组件之间的引用。

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

A: 目前缺少使用文档,用户不好用,例如:

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

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

代码缺少注释,感兴趣的贡献者看不懂,例如 https://github.com/mosn/layotto/issues/112

Expand Down Expand Up @@ -45,8 +45,8 @@ A: **本规范只限制“新增Layotto API的pr需要有哪些东西”(比
提案需要包含以下内容:

- 需求分析
- 为什么要做这个API
- 定义需求的边界,哪些feature支持,哪些不支持
- 为什么要做这个API
- 定义需求的边界,哪些feature支持,哪些不支持
- 市面上产品调研
- grpc/http API设计
- 组件API设计
Expand Down Expand Up @@ -79,7 +79,7 @@ A: **本规范只限制“新增Layotto API的pr需要有哪些东西”(比

正例:[Dapr pub-sub quickstart](https://github.com/dapr/quickstarts/tree/v1.0.0/pub-sub) 在操作之前贴图解释下要做什么事情

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

反例:文档只写了操作步骤1234,用户看不懂操作这些想干啥

Expand All @@ -103,7 +103,7 @@ A: **本规范只限制“新增Layotto API的pr需要有哪些东西”(比
##### how.怎么用这个API
- 接口列表。例如:

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

列出来有哪些接口,一方面省的用户自己去翻proto、不知道哪些是相关API,一方面避免用户产生"这项目连接口文档都没有?!"的反感
- 关于接口的出入参:拿proto注释当接口文档
Expand Down Expand Up @@ -202,7 +202,7 @@ message StateOptions {

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

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

文件夹名用组件名就行,比如redis的组件如下图

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

开发过程中可能用到的工具类(不是强制一定要用哈,列在这只是供参考,希望能简化开发):

Expand All @@ -45,22 +45,22 @@

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

![mock.png]((/img/development/component/mock.png)
![img_8.png]((/img/development/component/img_8.png)
![mock.png](/img/development/component/mock.png)
![img_8.png](/img/development/component/img_8.png)

然后,把你代码中调sdk、做网络调用的代码封装成一个struct、实现刚才的interface:

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

做了这一步重构后,你的代码就有可测性了(这也是"测试驱动开发"思想的一种体现,为了让代码可测性好,把代码重构成可以依赖注入的形式)

接下来,写ut的时候,可以mock刚才的interface:

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

把mock后的东西注入到要测的struct里就行,然后测那个struct就行

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

注:一般“集成测试”的时候,会真正做网络调用、调一个正常的zookeeper或者redis;而单测注重测局部逻辑,不会调真实环境

Expand All @@ -72,10 +72,10 @@

需要在cmd/layotto/main.go里集成进新的组件,包括:
### 3.1. 在main.go里import你的组件
![img_1.png]((/img/development/component/img_1.png)
![img_1.png](/img/development/component/img_1.png)

### 3.2. 在main.go的NewRuntimeGrpcServer函数中注册你的组件
![img_4.png]((/img/development/component/img_4.png)
![img_4.png](/img/development/component/img_4.png)

之后,用户如果在Layotto配置文件中配置了"我要用zookeeper",那么Layotto就会初始化zookeeper组件

Expand All @@ -93,7 +93,7 @@

之后编辑修改一下图中的配置:

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



Expand All @@ -103,12 +103,12 @@
#### a. 如果该组件有通用客户端,就不用开发啦
如果demo目录下有common文件夹,代表这是个通用demo、能给不同的组件用,可以通过命令行传参传storeName,有这个就不用再开发demo啦

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

#### b. 如果该组件没有通用客户端,或者需要定制一些metadata传参,那就复制粘贴改一改
比如zookeeper实现分布式锁,有一些定制配置,所以想自己新写个demo,那就复制粘贴redis的demo、改一改

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

注:demo的代码里如果出现不该有的错误,可以直接panic。后续我们会直接用demo跑集成测试,如果panic了代表集成测试没有通过。
例如demo/lock/redis/client.go 里:
Expand All @@ -127,11 +127,11 @@

注:下面这个Error没事,无视就好

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

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

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

没有报错的话说明测试通过!

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/start/faas/start.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# FaaS 快速开始

## 一、功能介绍
### 一、功能介绍

Check failure on line 3 in docs/docs/start/faas/start.md

View workflow job for this annotation

GitHub Actions / Markdown Validation

Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]

Layotto支持加载并运行以 wasm 为载体的 Function,并支持Function之间互相调用以及访问基础设施,如Redis。

Expand Down
3 changes: 0 additions & 3 deletions docs/docs/start/wasm/start.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# 将业务逻辑通过WASM下沉进sidecar

## sidecar

### 功能介绍

Check failure on line 2 in docs/docs/start/wasm/start.md

View workflow job for this annotation

GitHub Actions / Markdown Validation

Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]
service mesh 和 multi-runtime 的 sidecar 是全公司通用的基础设施,但实践中,业务系统也会有自己的sdk,也会有推动用户升级难、版本碎片的问题.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
> Writing: 4 May 2022
- [Overview](#Overview)
- [源码分析](#source analysis)
- [1.cmd分析](#1.cmd analysis)
- [2.回调函数NewRuntimeGrpcServer分析](#2.callback function NewRuntimeGrpcServer analysis)
- [3.runtime分析](#3.runtime analyse)
- [总结](#summary)
- [source analysis](#source analysis)
- [1.cmd analysis](#1.cmd analysis)
- [2.Callback functionNewRuntimeGrpcServer分析](#2.callback function NewRuntimeGrpcServer analysis)
- [3.runtimeanalyze](#3.runtime analyse)
- [summary](#summary)

## Overview

Expand Down Expand Up @@ -94,7 +94,7 @@ func NewRuntimeGrpcServer(data json.RawMessage, opts ...grpc.ServerOption) (mgrp

### runtime analysis

Look at the structure of runtime, the composition of the `runtime' at the aggregate level of the`:'
Look at the structure of runtime, the composition of the `runtime' at the aggregate level of the `:'

```
type MosnRuntime struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
- [overview](#overview)
- [source analysis](#source analysis)
- [Frame INIT](#Frame INIT)
- [workflow](#workflow)
- [FaaSmode](#FaaS mode)
- [Frame INIT](#Frame INIT)
- [workflow](#workflow)
- [FaaSmode](#FaaS mode)
- [summary](#summary)

## General description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func NewRuntimeGrpcServer(data json.RawMessage, opts ...grpc.ServerOption) (mgrp

### runtime analysis

Look at the structure of runtime, the composition of the `runtime' at the aggregate level of the`:'
Look at the structure of runtime, the composition of the `runtime' at the aggregate level of the `:'

```
type MosnRuntime struct {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# FaaS Design Document

# FaaS Design
### Structure design

![img.png](../(/img/faas/faas-design.jpg)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RPC DESIGN
## RPC DESIGN

### API
runtime rpc API is same with Dapr.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# RPC Design Document

## RPC Design

### API Design

[layotto rpc API](https://github.com/mosn/layotto/blob/f70cdc6196963ad762cf809daf0579403c341def1/spec/proto/runtime/v1/runtime.proto#L19 https://github.com/mosn/layotto/blob/f70cdc619693ad762cf809daf0579403c341def1/spec/proto/runtime/v1/runtime.proto#L19) is consistent with Dapr.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# layotto component reference
## layotto component

### Background

When a component starts, it may need to use another component's skill. For example, when the `sequencer` component `A` starts, it needs to read its settings from the `config` component `B`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# FaaS QuickStart
## FaaS QuickStart

### 1. Features

Layotto supports loading and running functions in the form of wasm, and supports calling each other between functions and accessing infrastructure, such as Redis.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Run business logic in Layotto using WASM
## Run business logic in Layotto using WASM

### What is WASM on Layotto?
The sidecar of service mesh and multi-runtime is a common infrastructure for the whole company, but in practice, the business system will also have its own SDK, and it will also have the difficulty of pushing users to upgrade the SDK and the problem of version fragmentation.

Expand Down

0 comments on commit 586a953

Please sign in to comment.