|
@@ -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
|
|
|
|
+
|
|
|
|
+
|