Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

refactor: rename flowy-document to flowy-block

appflowy2e6dd39780b9
diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock
index 9b8dbfc3bc..2ec1b6e3bd 100755
--- a/frontend/rust-lib/Cargo.lock
+++ b/frontend/rust-lib/Cargo.lock
@@ -847,6 +847,51 @@ dependencies = [
"syn",
]
+[[package]]
+name = "flowy-block"
+version = "0.1.0"
+dependencies = [
+ "async-stream",
+ "async-trait",
+ "bytecount",
+ "byteorder",
+ "bytes",
+ "chrono",
+ "color-eyre",
+ "criterion",
+ "dart-notify",
+ "dashmap",
+ "derive_more",
+ "diesel",
+ "diesel_derives",
+ "flowy-block",
+ "flowy-collaboration",
+ "flowy-database",
+ "flowy-derive",
+ "flowy-error",
+ "flowy-sync",
+ "flowy-test",
+ "futures",
+ "futures-util",
+ "lib-dispatch",
+ "lib-infra",
+ "lib-ot",
+ "lib-ws",
+ "log",
+ "parking_lot",
+ "pin-project",
+ "protobuf",
+ "rand 0.7.3",
+ "serde",
+ "serde_json",
+ "strum",
+ "strum_macros",
+ "tokio",
+ "tracing",
+ "unicode-segmentation",
+ "url",
+]
+
[[package]]
name = "flowy-collaboration"
version = "0.1.0"
@@ -901,51 +946,6 @@ dependencies = [
"walkdir",
]
-[[package]]
-name = "flowy-document"
-version = "0.1.0"
-dependencies = [
- "async-stream",
- "async-trait",
- "bytecount",
- "byteorder",
- "bytes",
- "chrono",
- "color-eyre",
- "criterion",
- "dart-notify",
- "dashmap",
- "derive_more",
- "diesel",
- "diesel_derives",
- "flowy-collaboration",
- "flowy-database",
- "flowy-derive",
- "flowy-document",
- "flowy-error",
- "flowy-sync",
- "flowy-test",
- "futures",
- "futures-util",
- "lib-dispatch",
- "lib-infra",
- "lib-ot",
- "lib-ws",
- "log",
- "parking_lot",
- "pin-project",
- "protobuf",
- "rand 0.7.3",
- "serde",
- "serde_json",
- "strum",
- "strum_macros",
- "tokio",
- "tracing",
- "unicode-segmentation",
- "url",
-]
-
[[package]]
name = "flowy-error"
version = "0.1.0"
@@ -988,10 +988,10 @@ dependencies = [
"derive_more",
"diesel",
"diesel_derives",
+ "flowy-block",
"flowy-collaboration",
"flowy-database",
"flowy-derive",
- "flowy-document",
"flowy-error",
"flowy-folder",
"flowy-folder-data-model",
@@ -1047,9 +1047,9 @@ dependencies = [
"bytes",
"config",
"dashmap",
+ "flowy-block",
"flowy-collaboration",
"flowy-derive",
- "flowy-document",
"flowy-error",
"flowy-folder",
"flowy-folder-data-model",
@@ -1083,9 +1083,9 @@ dependencies = [
"bytes",
"claim 0.5.0",
"color-eyre",
+ "flowy-block",
"flowy-collaboration",
"flowy-database",
- "flowy-document",
"flowy-folder",
"flowy-net",
"flowy-sync",
diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.toml
index b4033cb352..ea37363bcc 100644
--- a/frontend/rust-lib/Cargo.toml
+++ b/frontend/rust-lib/Cargo.toml
@@ -11,7 +11,7 @@ members = [
"flowy-database",
"flowy-folder",
"dart-notify",
- "flowy-document",
+ "flowy-block",
"flowy-error",
"flowy-sync",
]
diff --git a/frontend/rust-lib/flowy-document/Cargo.toml b/frontend/rust-lib/flowy-block/Cargo.toml
similarity index 93%
rename from frontend/rust-lib/flowy-document/Cargo.toml
rename to frontend/rust-lib/flowy-block/Cargo.toml
index 7ad988cbaa..330e70a61a 100644
--- a/frontend/rust-lib/flowy-document/Cargo.toml
+++ b/frontend/rust-lib/flowy-block/Cargo.toml
@@ -1,6 +1,6 @@
[package]
-name = "flowy-document"
+name = "flowy-block"
version = "0.1.0"
edition = "2018"
@@ -46,7 +46,7 @@ pin-project = "1.0.0"
[dev-dependencies]
flowy-test = { path = "../flowy-test" }
-flowy-document = { path = "../flowy-document", features = ["flowy_unit_test"]}
+flowy-block = { path = "../flowy-block", features = ["flowy_unit_test"]}
color-eyre = { version = "0.5", default-features = false }
criterion = "0.3"
diff --git a/frontend/rust-lib/flowy-document/src/block_editor.rs b/frontend/rust-lib/flowy-block/src/block_editor.rs
similarity index 100%
rename from frontend/rust-lib/flowy-document/src/block_editor.rs
rename to frontend/rust-lib/flowy-block/src/block_editor.rs
diff --git a/frontend/rust-lib/flowy-document/src/lib.rs b/frontend/rust-lib/flowy-block/src/lib.rs
similarity index 100%
rename from frontend/rust-lib/flowy-document/src/lib.rs
rename to frontend/rust-lib/flowy-block/src/lib.rs
diff --git a/frontend/rust-lib/flowy-document/src/manager.rs b/frontend/rust-lib/flowy-block/src/manager.rs
similarity index 100%
rename from frontend/rust-lib/flowy-document/src/manager.rs
rename to frontend/rust-lib/flowy-block/src/manager.rs
diff --git a/frontend/rust-lib/flowy-document/src/queue.rs b/frontend/rust-lib/flowy-block/src/queue.rs
similarity index 100%
rename from frontend/rust-lib/flowy-document/src/queue.rs
rename to frontend/rust-lib/flowy-block/src/queue.rs
diff --git a/frontend/rust-lib/flowy-document/src/web_socket.rs b/frontend/rust-lib/flowy-block/src/web_socket.rs
similarity index 100%
rename from frontend/rust-lib/flowy-document/src/web_socket.rs
rename to frontend/rust-lib/flowy-block/src/web_socket.rs
diff --git a/frontend/rust-lib/flowy-document/tests/document/document_test.rs b/frontend/rust-lib/flowy-block/tests/document/document_test.rs
similarity index 100%
rename from frontend/rust-lib/flowy-document/tests/document/document_test.rs
rename to frontend/rust-lib/flowy-block/tests/document/document_test.rs
diff --git a/frontend/rust-lib/flowy-document/tests/document/edit_script.rs b/frontend/rust-lib/flowy-block/tests/document/edit_script.rs
similarity index 96%
rename from frontend/rust-lib/flowy-document/tests/document/edit_script.rs
rename to frontend/rust-lib/flowy-block/tests/document/edit_script.rs
index 289fe20626..441b4cd104 100644
--- a/frontend/rust-lib/flowy-document/tests/document/edit_script.rs
+++ b/frontend/rust-lib/flowy-block/tests/document/edit_script.rs
@@ -1,6 +1,6 @@
+use flowy_block::block_editor::ClientBlockEditor;
+use flowy_block::DOCUMENT_SYNC_INTERVAL_IN_MILLIS;
use flowy_collaboration::entities::revision::RevisionState;
-use flowy_document::block_editor::ClientBlockEditor;
-use flowy_document::DOCUMENT_SYNC_INTERVAL_IN_MILLIS;
use flowy_test::{helper::ViewTest, FlowySDKTest};
use lib_ot::{core::Interval, rich_text::RichTextDelta};
use std::sync::Arc;
diff --git a/frontend/rust-lib/flowy-document/tests/document/mod.rs b/frontend/rust-lib/flowy-block/tests/document/mod.rs
similarity index 100%
rename from frontend/rust-lib/flowy-document/tests/document/mod.rs
rename to frontend/rust-lib/flowy-block/tests/document/mod.rs
diff --git a/frontend/rust-lib/flowy-document/tests/editor/attribute_test.rs b/frontend/rust-lib/flowy-block/tests/editor/attribute_test.rs
similarity index 100%
rename from frontend/rust-lib/flowy-document/tests/editor/attribute_test.rs
rename to frontend/rust-lib/flowy-block/tests/editor/attribute_test.rs
diff --git a/frontend/rust-lib/flowy-document/tests/editor/mod.rs b/frontend/rust-lib/flowy-block/tests/editor/mod.rs
similarity index 100%
rename from frontend/rust-lib/flowy-document/tests/editor/mod.rs
rename to frontend/rust-lib/flowy-block/tests/editor/mod.rs
diff --git a/frontend/rust-lib/flowy-document/tests/editor/op_test.rs b/frontend/rust-lib/flowy-block/tests/editor/op_test.rs
similarity index 100%
rename from frontend/rust-lib/flowy-document/tests/editor/op_test.rs
rename to frontend/rust-lib/flowy-block/tests/editor/op_test.rs
diff --git a/frontend/rust-lib/flowy-document/tests/editor/serde_test.rs b/frontend/rust-lib/flowy-block/tests/editor/serde_test.rs
similarity index 100%
rename from frontend/rust-lib/flowy-document/tests/editor/serde_test.rs
rename to frontend/rust-lib/flowy-block/tests/editor/serde_test.rs
diff --git a/frontend/rust-lib/flowy-document/tests/editor/undo_redo_test.rs b/frontend/rust-lib/flowy-block/tests/editor/undo_redo_test.rs
similarity index 100%
rename from frontend/rust-lib/flowy-document/tests/editor/undo_redo_test.rs
rename to frontend/rust-lib/flowy-block/tests/editor/undo_redo_test.rs
diff --git a/frontend/rust-lib/flowy-document/tests/main.rs b/frontend/rust-lib/flowy-block/tests/main.rs
similarity index 100%
rename from frontend/rust-lib/flowy-document/tests/main.rs
rename to frontend/rust-lib/flowy-block/tests/main.rs
diff --git a/frontend/rust-lib/flowy-folder/Cargo.toml b/frontend/rust-lib/flowy-folder/Cargo.toml
index 1fc78f4197..45f7ffb3e7 100644
--- a/frontend/rust-lib/flowy-folder/Cargo.toml
+++ b/frontend/rust-lib/flowy-folder/Cargo.toml
@@ -12,7 +12,7 @@ flowy-derive = { path = "../../../shared-lib/flowy-derive" }
lib-ot = { path = "../../../shared-lib/lib-ot" }
lib-infra = { path = "../../../shared-lib/lib-infra" }
-flowy-document = { path = "../flowy-document" }
+flowy-block = { path = "../flowy-block" }
flowy-database = { path = "../flowy-database" }
flowy-error = { path = "../flowy-error", features = ["db", "http_server"]}
dart-notify = { path = "../dart-notify" }
diff --git a/frontend/rust-lib/flowy-folder/src/controller.rs b/frontend/rust-lib/flowy-folder/src/controller.rs
index 8ec6bc91b8..a01a26b7d5 100644
--- a/frontend/rust-lib/flowy-folder/src/controller.rs
+++ b/frontend/rust-lib/flowy-folder/src/controller.rs
@@ -5,8 +5,8 @@ use flowy_folder_data_model::user_default;
use flowy_sync::RevisionWebSocket;
use lazy_static::lazy_static;
+use flowy_block::BlockManager;
use flowy_collaboration::{client_folder::FolderPad, entities::ws_data::ServerRevisionWSData};
-use flowy_document::BlockManager;
use flowy_collaboration::entities::revision::{RepeatedRevision, Revision};
use std::{collections::HashMap, convert::TryInto, fmt::Formatter, sync::Arc};
diff --git a/frontend/rust-lib/flowy-folder/src/services/view/controller.rs b/frontend/rust-lib/flowy-folder/src/services/view/controller.rs
index 2e23f544f7..72e29c1b60 100644
--- a/frontend/rust-lib/flowy-folder/src/services/view/controller.rs
+++ b/frontend/rust-lib/flowy-folder/src/services/view/controller.rs
@@ -21,8 +21,8 @@ use crate::{
TrashController, TrashEvent,
},
};
+use flowy_block::BlockManager;
use flowy_database::kv::KV;
-use flowy_document::BlockManager;
use flowy_folder_data_model::entities::share::{ExportData, ExportParams};
use lib_infra::uuid_string;
diff --git a/frontend/rust-lib/flowy-net/Cargo.toml b/frontend/rust-lib/flowy-net/Cargo.toml
index 34e4942b38..e494f6f5d1 100644
--- a/frontend/rust-lib/flowy-net/Cargo.toml
+++ b/frontend/rust-lib/flowy-net/Cargo.toml
@@ -14,7 +14,7 @@ flowy-folder-data-model = { path = "../../../shared-lib/flowy-folder-data-model"
flowy-user-data-model = { path = "../../../shared-lib/flowy-user-data-model"}
flowy-folder = { path = "../flowy-folder" }
flowy-user = { path = "../flowy-user" }
-flowy-document = { path = "../flowy-document" }
+flowy-block = { path = "../flowy-block" }
lazy_static = "1.4.0"
lib-infra = { path = "../../../shared-lib/lib-infra" }
protobuf = {version = "2.18.0"}
diff --git a/frontend/rust-lib/flowy-net/src/http_server/document.rs b/frontend/rust-lib/flowy-net/src/http_server/document.rs
index 3e2f4af69a..bbc5aa2824 100644
--- a/frontend/rust-lib/flowy-net/src/http_server/document.rs
+++ b/frontend/rust-lib/flowy-net/src/http_server/document.rs
@@ -2,8 +2,8 @@ use crate::{
configuration::*,
request::{HttpRequestBuilder, ResponseMiddleware},
};
+use flowy_block::BlockCloudService;
use flowy_collaboration::entities::document_info::{BlockId, BlockInfo, CreateBlockParams, ResetDocumentParams};
-use flowy_document::BlockCloudService;
use flowy_error::FlowyError;
use http_flowy::response::FlowyResponse;
use lazy_static::lazy_static;
diff --git a/frontend/rust-lib/flowy-net/src/local_server/server.rs b/frontend/rust-lib/flowy-net/src/local_server/server.rs
index e8dcd1ed93..e81e08b80d 100644
--- a/frontend/rust-lib/flowy-net/src/local_server/server.rs
+++ b/frontend/rust-lib/flowy-net/src/local_server/server.rs
@@ -248,7 +248,7 @@ impl RevisionUser for LocalRevisionUser {
}
}
-use flowy_document::BlockCloudService;
+use flowy_block::BlockCloudService;
use flowy_folder_data_model::entities::{
app::{App, AppId, CreateAppParams, RepeatedApp, UpdateAppParams},
trash::{RepeatedTrash, RepeatedTrashId},
diff --git a/frontend/rust-lib/flowy-sdk/Cargo.toml b/frontend/rust-lib/flowy-sdk/Cargo.toml
index b303f89b30..d7dcd58789 100644
--- a/frontend/rust-lib/flowy-sdk/Cargo.toml
+++ b/frontend/rust-lib/flowy-sdk/Cargo.toml
@@ -12,7 +12,7 @@ flowy-user = { path = "../flowy-user" }
flowy-net = { path = "../flowy-net" }
flowy-folder = { path = "../flowy-folder", default-features = false }
flowy-database = { path = "../flowy-database" }
-flowy-document = { path = "../flowy-document" }
+flowy-block = { path = "../flowy-block" }
flowy-sync = { path = "../flowy-sync" }
tracing = { version = "0.1" }
@@ -37,6 +37,6 @@ tokio = { version = "1", features = ["full"]}
futures-util = "0.3.15"
[features]
-http_server = ["flowy-user/http_server", "flowy-folder/http_server", "flowy-document/http_server"]
+http_server = ["flowy-user/http_server", "flowy-folder/http_server", "flowy-block/http_server"]
use_bunyan = ["lib-log/use_bunyan"]
dart = ["flowy-user/dart", "flowy-net/dart", "flowy-folder/dart", "flowy-collaboration/dart"]
diff --git a/frontend/rust-lib/flowy-sdk/src/deps_resolve/document_deps.rs b/frontend/rust-lib/flowy-sdk/src/deps_resolve/block_deps.rs
similarity index 97%
rename from frontend/rust-lib/flowy-sdk/src/deps_resolve/document_deps.rs
rename to frontend/rust-lib/flowy-sdk/src/deps_resolve/block_deps.rs
index 1c1c8f7d4a..c7e77e252c 100644
--- a/frontend/rust-lib/flowy-sdk/src/deps_resolve/document_deps.rs
+++ b/frontend/rust-lib/flowy-sdk/src/deps_resolve/block_deps.rs
@@ -1,10 +1,10 @@
use bytes::Bytes;
-use flowy_collaboration::entities::ws_data::ClientRevisionWSData;
-use flowy_database::ConnectionPool;
-use flowy_document::{
+use flowy_block::{
errors::{internal_error, FlowyError},
BlockCloudService, BlockManager, BlockUser,
};
+use flowy_collaboration::entities::ws_data::ClientRevisionWSData;
+use flowy_database::ConnectionPool;
use flowy_net::ClientServerConfiguration;
use flowy_net::{
http_server::document::BlockHttpCloudService, local_server::LocalServer, ws::connection::FlowyWebSocketConnect,
@@ -16,8 +16,8 @@ use lib_infra::future::BoxResultFuture;
use lib_ws::{WSChannel, WSMessageReceiver, WebSocketRawMessage};
use std::{convert::TryInto, path::Path, sync::Arc};
-pub struct DocumentDepsResolver();
-impl DocumentDepsResolver {
+pub struct BlockDepsResolver();
+impl BlockDepsResolver {
pub fn resolve(
local_server: Option<Arc<LocalServer>>,
ws_conn: Arc<FlowyWebSocketConnect>,
diff --git a/frontend/rust-lib/flowy-sdk/src/deps_resolve/folder_deps.rs b/frontend/rust-lib/flowy-sdk/src/deps_resolve/folder_deps.rs
index cfa0f88fb5..3a791888ff 100644
--- a/frontend/rust-lib/flowy-sdk/src/deps_resolve/folder_deps.rs
+++ b/frontend/rust-lib/flowy-sdk/src/deps_resolve/folder_deps.rs
@@ -1,7 +1,7 @@
use bytes::Bytes;
+use flowy_block::BlockManager;
use flowy_collaboration::entities::ws_data::ClientRevisionWSData;
use flowy_database::ConnectionPool;
-use flowy_document::BlockManager;
use flowy_folder::{
controller::FolderManager,
errors::{internal_error, FlowyError},
diff --git a/frontend/rust-lib/flowy-sdk/src/deps_resolve/mod.rs b/frontend/rust-lib/flowy-sdk/src/deps_resolve/mod.rs
index e46a3b263c..569c32b8de 100644
--- a/frontend/rust-lib/flowy-sdk/src/deps_resolve/mod.rs
+++ b/frontend/rust-lib/flowy-sdk/src/deps_resolve/mod.rs
@@ -1,7 +1,7 @@
-mod document_deps;
+mod block_deps;
mod folder_deps;
mod user_deps;
-pub use document_deps::*;
+pub use block_deps::*;
pub use folder_deps::*;
pub use user_deps::*;
diff --git a/frontend/rust-lib/flowy-sdk/src/lib.rs b/frontend/rust-lib/flowy-sdk/src/lib.rs
index ad3480745b..16e3c37def 100644
--- a/frontend/rust-lib/flowy-sdk/src/lib.rs
+++ b/frontend/rust-lib/flowy-sdk/src/lib.rs
@@ -3,7 +3,7 @@ pub mod module;
pub use flowy_net::get_client_server_configuration;
use crate::deps_resolve::*;
-use flowy_document::BlockManager;
+use flowy_block::BlockManager;
use flowy_folder::{controller::FolderManager, errors::FlowyError};
use flowy_net::ClientServerConfiguration;
use flowy_net::{
@@ -101,7 +101,7 @@ impl FlowySDK {
let (local_server, ws_conn) = mk_local_server(&config.server_config);
let (user_session, document_manager, folder_manager, local_server) = runtime.block_on(async {
let user_session = mk_user_session(&config, &local_server, &config.server_config);
- let document_manager = DocumentDepsResolver::resolve(
+ let document_manager = BlockDepsResolver::resolve(
local_server.clone(),
ws_conn.clone(),
user_session.clone(),