update some doc

This commit is contained in:
appflowy 2021-07-09 08:42:52 +08:00
parent 53a041b6cd
commit 685643be36
11 changed files with 127 additions and 65 deletions

View File

@ -8,13 +8,13 @@
## Documentation
* [**Getting Started**](doc/getting_started.md)
* [**Roadmap**](doc/roadmap.md)
* [**Deep Dive AppFlowy**](doc/architecture.md)
* [**Getting Started**](doc/GETTING_STARTED.md)
* [**Roadmap**](doc/ROADMAP.md)
* [**Deep Dive AppFlowy**](doc/APPFLOWY_SYSTEM_DESIGN.md)
## Contributing
Read the [Contributing Doc](doc/contribute.md) before you want to contribute.
Read the [Contributing Doc](doc/CONTRIBUTING.md) before you want to contribute.
## Social Media
* Slack (to be determined)

View File

@ -0,0 +1,30 @@
import 'package:flowy_logger/flowy_logger.dart';
import 'package:flowy_sdk/dispatch/flowy_error.dart';
import 'package:flowy_sdk/protobuf/ffi_request.pb.dart';
import 'package:flowy_sdk/protobuf/ffi_response.pb.dart';
class StackTraceError {
Object error;
StackTrace trace;
StackTraceError(
this.error,
this.trace,
);
FlowyError toFlowyError() {
Log.error('${error.runtimeType}\n');
Log.error('Stack trace \n $trace');
return FlowyError.fromError('${error.runtimeType}. Stack trace: $trace');
}
String toString() {
return '${error.runtimeType}. Stack trace: $trace';
}
}
FFIResponse error_response(FFIRequest request, StackTraceError error) {
var response = FFIResponse();
response.code = FFIStatusCode.Err;
response.error = error.toString();
return response;
}

View File

@ -0,0 +1,71 @@
# 🥳 AppFlowy - Event Driven System
* Goals of the System
* Some Design Considerations
* High Level Design
* Component Design
## 🎯 Goals of the System
The AppFlowy project is an attempt to build a high performance application. Here are the top-level requirements for out system.
1. **High Performance.**
2. **Cross-platform.**
3. **Reliability**
4. **Safety**
## 🤔 Some Design Considerations
## 📜 High Level Design
## 📚 Component Design
### 📙 Event Dispatch
```
Frontend FLowySDK
│ ┌─────────┐
│ ┌7─▶│Handler A│
│ │ └─────────┘
│ ┌─────────┐ │ ┌─────────┐
┌──────┐ ┌────┐ ┌──────────────┐ │ ┌───▶│Module A │──┼──▶│Handler B│
│Widget│─1─▶│Bloc│─2─▶│ Repository A │─3─┐ │ │ └─────────┘ │ └─────────┘
└──────┘ └────┘ └──────────────┘ │ │ │ │ ┌─────────┐
┌──────────────┐ │ ┌───────┐ ┌─┴──┐ ┌───────────┐ │ ┌─────────┐ └──▶│Handler C│
│ Repository B │───┼───▶│ Event │─4─▶│FFI │─5──▶│Dispatcher │─6─┼───▶│Module B │ └─────────┘
└──────────────┘ │ └───────┘ └─┬──┘ └───────────┘ │ └─────────┘
┌──────────────┐ │ │ │
│ Repository C │───┘ │ │ ┌─────────┐
└──────────────┘ │ └───▶│Module C │
│ └─────────┘
```
Here are the event flow:
1. User click on the `Widget`(The user interface) that invokes the `Bloc` actions
2. `Bloc` calls the repositories to perform additional operations to handle the actions.
3. `Repository` offers the functionalities by combining the event, defined in the `FlowySDK`.
4. `Events` will be passed in the `FlowySDK` through the [FFI](https://en.wikipedia.org/wiki/Foreign_function_interface) interface.
5. `Dispatcher` parses the event and generates the specific action scheduled in the `FlowySDK` runtime.
6. `Dispatcher` find the event handler declared by the modules.
7. `Handler` consumes the event and generates the response. The response will be returned to the widget through the `FFI`.
The event flow will be discussed in two parts: the frontend implemented in flutter and the FlowySDK implemented in Rust.
#### Frontend
The Frontend follows the DDD design pattern, you can recap from [**here**](DOMAIN_DRIVEN_DESIGN.md).
```
┌──────┐ ┌────┐ ┌──────────────┐
│Widget│──1────▶│Bloc│──2────▶│ Repository A │─3──┐
└──────┘ └────┘ └──────────────┘ │
┌──────────────┐ │ ┌───────┐
│ Repository B │────┼────▶│ Event │
└──────────────┘ │ └───────┘
┌──────────────┐ │
│ Repository C │────┘
└──────────────┘
```
#### FlowySDK

View File

@ -18,7 +18,6 @@ Consult the Table of Contents below, and jump to the desired section.
- [Code of Conduct](#code-of-conduct)
## Sign the CLA Agreement
TODO

View File

@ -1,47 +0,0 @@
# 🥳 AppFlowy System Design
* Goals of the System
* Some Design Considerations
* High Level Design
* Component Design
## 🎯 Goals of the System
## 🤔 Some Design Considerations
## 📜 High Level Design
## 📚 Component Design
### 📕 Component 1
### 📗 Component 2
### 📘 Flutter Event Flow
### 📙 Rust Event Flow
```
┌─────────┐
┌─▶│Service A│
│ └─────────┘
┌─────────┐ ┌───────────┐ ┌─────────────┐ │ ┌─────────┐
┌─▶│Module A │─▶│ Services │─▶│Deps Resolved│─┼─▶│Service B│
│ └─────────┘ └───────────┘ └─────────────┘ │ └─────────┘
│ │ ┌─────────┐
┌───────┐ ┌────────┐ │ ┌─────────┐ └─▶│Service C│
│ Event │──▶│Runtime │──┼─▶│Module B │ └─────────┘
└───────┘ └────────┘ │ └─────────┘
│ ┌─────────┐
└─▶│Module C │
└─────────┘
```
* sync will cause typing lag

View File

@ -1,12 +0,0 @@
[WIP]
* Contributing
* First steps
* Opening issues
* Participating in discussions
* Finding something to work on
* Open your PR
* Review Process
* Getting more involved
* Organization membership
* Contributor
* Maintainer

View File

@ -1 +0,0 @@
[WIP]

7
scripts/install_rust.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
echo 'install rust'
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y
echo 'export PATH="$$HOME/.cargo/bin:$$PATH"' >> ~/.bash_profile
source ~/.bash_profile

15
scripts/install_tool.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
#targets
rustup target add x86_64-apple-darwin
#tools
echo 'install tools'
rustup component add rustfmt
cargo install cargo-expand
cargo install cargo-watch
cargo install cargo-cache
#protobuf code gen env
brew install protobuf@3.13
cargo install --version 2.20.0 protobuf-codegen