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.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
chore: check collab before saving collab to disk (#6261)
Nathan.fooo055af0332086
diff --git a/frontend/appflowy_flutter/macos/Podfile.lock b/frontend/appflowy_flutter/macos/Podfile.lockindex 0fc6b09590..525eb1e347 100644--- a/frontend/appflowy_flutter/macos/Podfile.lock+++ b/frontend/appflowy_flutter/macos/Podfile.lock@@ -149,7 +149,7 @@ SPEC CHECKSUMS:screen_retriever: 59634572a57080243dd1bf715e55b6c54f241a38Sentry: 1fe34e9c2cbba1e347623610d26db121dcb569f1sentry_flutter: a39c2a2d67d5e5b9cb0b94a4985c76dd5b3fc737- share_plus: 76dd39142738f7a68dd57b05093b5e8193f220f7+ share_plus: 36537c04ce0c3e3f5bd297ce4318b6d5ee5fd6cfshared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eecsuper_native_extensions: 85efee3a7495b46b04befcfc86ed12069264ebf3diff --git a/frontend/appflowy_flutter/pubspec.lock b/frontend/appflowy_flutter/pubspec.lockindex 7c27e51401..477bf5e2cd 100644--- a/frontend/appflowy_flutter/pubspec.lock+++ b/frontend/appflowy_flutter/pubspec.lock@@ -1559,10 +1559,10 @@ packages:dependency: transitivedescription:name: platform- sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65"+ sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"url: "https://pub.dev"source: hosted- version: "3.1.5"+ version: "3.1.4"plugin_platform_interface:dependency: "direct dev"description:@@ -1997,10 +1997,10 @@ packages:dependency: transitivedescription:name: string_scanner- sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"+ sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"url: "https://pub.dev"source: hosted- version: "1.3.0"+ version: "1.2.0"string_validator:dependency: "direct main"description:@@ -2319,10 +2319,10 @@ packages:dependency: transitivedescription:name: vm_service- sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"+ sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"url: "https://pub.dev"source: hosted- version: "14.2.5"+ version: "14.2.1"watcher:dependency: transitivedescription:diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.lock b/frontend/appflowy_tauri/src-tauri/Cargo.lockindex 47eced7291..10c6396aa0 100644--- a/frontend/appflowy_tauri/src-tauri/Cargo.lock+++ b/frontend/appflowy_tauri/src-tauri/Cargo.lock@@ -975,7 +975,7 @@ dependencies = [[[package]]name = "collab"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c3622d7c45cc9707971c5db8120d94a12c089fe#5c3622d7c45cc9707971c5db8120d94a12c089fe"dependencies = ["anyhow","arc-swap",@@ -1000,7 +1000,7 @@ dependencies = [[[package]]name = "collab-database"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c3622d7c45cc9707971c5db8120d94a12c089fe#5c3622d7c45cc9707971c5db8120d94a12c089fe"dependencies = ["anyhow","async-trait",@@ -1030,7 +1030,7 @@ dependencies = [[[package]]name = "collab-document"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c3622d7c45cc9707971c5db8120d94a12c089fe#5c3622d7c45cc9707971c5db8120d94a12c089fe"dependencies = ["anyhow","arc-swap",@@ -1050,7 +1050,7 @@ dependencies = [[[package]]name = "collab-entity"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c3622d7c45cc9707971c5db8120d94a12c089fe#5c3622d7c45cc9707971c5db8120d94a12c089fe"dependencies = ["anyhow","bytes",@@ -1069,7 +1069,7 @@ dependencies = [[[package]]name = "collab-folder"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c3622d7c45cc9707971c5db8120d94a12c089fe#5c3622d7c45cc9707971c5db8120d94a12c089fe"dependencies = ["anyhow","arc-swap",@@ -1112,7 +1112,7 @@ dependencies = [[[package]]name = "collab-plugins"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c3622d7c45cc9707971c5db8120d94a12c089fe#5c3622d7c45cc9707971c5db8120d94a12c089fe"dependencies = ["anyhow","async-stream",@@ -1192,7 +1192,7 @@ dependencies = [[[package]]name = "collab-user"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c3622d7c45cc9707971c5db8120d94a12c089fe#5c3622d7c45cc9707971c5db8120d94a12c089fe"dependencies = ["anyhow","collab",@@ -2478,6 +2478,7 @@ dependencies = ["collab-entity","collab-folder","collab-plugins",+ "collab-user","dashmap 6.0.1","flowy-ai-pub","flowy-database-pub",diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.toml b/frontend/appflowy_tauri/src-tauri/Cargo.tomlindex b5530d1226..8dfe9bc308 100644--- a/frontend/appflowy_tauri/src-tauri/Cargo.toml+++ b/frontend/appflowy_tauri/src-tauri/Cargo.toml@@ -119,13 +119,13 @@ custom-protocol = ["tauri/custom-protocol"]# To switch to the local path, run:# scripts/tool/update_collab_source.sh# ⚠️⚠️⚠️️-collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }-collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }-collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }-collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }-collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }-collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }-collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }+collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "28c439274c222bbc298dc6753200ee492d7e8509" }+collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "28c439274c222bbc298dc6753200ee492d7e8509" }+collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "28c439274c222bbc298dc6753200ee492d7e8509" }+collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "28c439274c222bbc298dc6753200ee492d7e8509" }+collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "28c439274c222bbc298dc6753200ee492d7e8509" }+collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "28c439274c222bbc298dc6753200ee492d7e8509" }+collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "28c439274c222bbc298dc6753200ee492d7e8509" }# Working directory: frontend# To update the commit ID, run:diff --git a/frontend/appflowy_web_app/src-tauri/Cargo.lock b/frontend/appflowy_web_app/src-tauri/Cargo.lockindex f278698844..7cf725ded0 100644--- a/frontend/appflowy_web_app/src-tauri/Cargo.lock+++ b/frontend/appflowy_web_app/src-tauri/Cargo.lock@@ -958,7 +958,7 @@ dependencies = [[[package]]name = "collab"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c3622d7c45cc9707971c5db8120d94a12c089fe#5c3622d7c45cc9707971c5db8120d94a12c089fe"dependencies = ["anyhow","arc-swap",@@ -983,7 +983,7 @@ dependencies = [[[package]]name = "collab-database"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c3622d7c45cc9707971c5db8120d94a12c089fe#5c3622d7c45cc9707971c5db8120d94a12c089fe"dependencies = ["anyhow","async-trait",@@ -1013,7 +1013,7 @@ dependencies = [[[package]]name = "collab-document"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c3622d7c45cc9707971c5db8120d94a12c089fe#5c3622d7c45cc9707971c5db8120d94a12c089fe"dependencies = ["anyhow","arc-swap",@@ -1033,7 +1033,7 @@ dependencies = [[[package]]name = "collab-entity"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c3622d7c45cc9707971c5db8120d94a12c089fe#5c3622d7c45cc9707971c5db8120d94a12c089fe"dependencies = ["anyhow","bytes",@@ -1052,7 +1052,7 @@ dependencies = [[[package]]name = "collab-folder"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c3622d7c45cc9707971c5db8120d94a12c089fe#5c3622d7c45cc9707971c5db8120d94a12c089fe"dependencies = ["anyhow","arc-swap",@@ -1095,7 +1095,7 @@ dependencies = [[[package]]name = "collab-plugins"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c3622d7c45cc9707971c5db8120d94a12c089fe#5c3622d7c45cc9707971c5db8120d94a12c089fe"dependencies = ["anyhow","async-stream",@@ -1175,7 +1175,7 @@ dependencies = [[[package]]name = "collab-user"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c3622d7c45cc9707971c5db8120d94a12c089fe#5c3622d7c45cc9707971c5db8120d94a12c089fe"dependencies = ["anyhow","collab",@@ -2508,6 +2508,7 @@ dependencies = ["collab-entity","collab-folder","collab-plugins",+ "collab-user","dashmap 6.0.1","flowy-ai-pub","flowy-database-pub",diff --git a/frontend/appflowy_web_app/src-tauri/Cargo.toml b/frontend/appflowy_web_app/src-tauri/Cargo.tomlindex d6b4421908..8dff7fa2a3 100644--- a/frontend/appflowy_web_app/src-tauri/Cargo.toml+++ b/frontend/appflowy_web_app/src-tauri/Cargo.toml@@ -117,13 +117,13 @@ custom-protocol = ["tauri/custom-protocol"]# To switch to the local path, run:# scripts/tool/update_collab_source.sh# ⚠️⚠️⚠️️-collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }-collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }-collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }-collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }-collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }-collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }-collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }+collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c3622d7c45cc9707971c5db8120d94a12c089fe" }+collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c3622d7c45cc9707971c5db8120d94a12c089fe" }+collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c3622d7c45cc9707971c5db8120d94a12c089fe" }+collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c3622d7c45cc9707971c5db8120d94a12c089fe" }+collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c3622d7c45cc9707971c5db8120d94a12c089fe" }+collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c3622d7c45cc9707971c5db8120d94a12c089fe" }+collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c3622d7c45cc9707971c5db8120d94a12c089fe" }# Working directory: frontend# To update the commit ID, run:diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lockindex eb19aa47f8..3660a17a93 100644--- a/frontend/rust-lib/Cargo.lock+++ b/frontend/rust-lib/Cargo.lock@@ -836,7 +836,7 @@ dependencies = [[[package]]name = "collab"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=28c439274c222bbc298dc6753200ee492d7e8509#28c439274c222bbc298dc6753200ee492d7e8509"dependencies = ["anyhow","arc-swap",@@ -861,7 +861,7 @@ dependencies = [[[package]]name = "collab-database"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=28c439274c222bbc298dc6753200ee492d7e8509#28c439274c222bbc298dc6753200ee492d7e8509"dependencies = ["anyhow","async-trait",@@ -891,7 +891,7 @@ dependencies = [[[package]]name = "collab-document"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=28c439274c222bbc298dc6753200ee492d7e8509#28c439274c222bbc298dc6753200ee492d7e8509"dependencies = ["anyhow","arc-swap",@@ -911,7 +911,7 @@ dependencies = [[[package]]name = "collab-entity"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=28c439274c222bbc298dc6753200ee492d7e8509#28c439274c222bbc298dc6753200ee492d7e8509"dependencies = ["anyhow","bytes",@@ -930,7 +930,7 @@ dependencies = [[[package]]name = "collab-folder"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=28c439274c222bbc298dc6753200ee492d7e8509#28c439274c222bbc298dc6753200ee492d7e8509"dependencies = ["anyhow","arc-swap",@@ -973,7 +973,7 @@ dependencies = [[[package]]name = "collab-plugins"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=28c439274c222bbc298dc6753200ee492d7e8509#28c439274c222bbc298dc6753200ee492d7e8509"dependencies = ["anyhow","async-stream",@@ -1053,7 +1053,7 @@ dependencies = [[[package]]name = "collab-user"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=28c439274c222bbc298dc6753200ee492d7e8509#28c439274c222bbc298dc6753200ee492d7e8509"dependencies = ["anyhow","collab",@@ -2311,6 +2311,7 @@ dependencies = ["collab-entity","collab-folder","collab-plugins",+ "collab-user","dashmap 6.0.1","dotenv","flowy-ai-pub",diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.tomlindex 83727ebc17..97d782965a 100644--- a/frontend/rust-lib/Cargo.toml+++ b/frontend/rust-lib/Cargo.toml@@ -141,13 +141,13 @@ rocksdb = { git = "https://github.com/rust-rocksdb/rust-rocksdb", rev = "1710120# To switch to the local path, run:# scripts/tool/update_collab_source.sh# ⚠️⚠️⚠️️-collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }-collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }-collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }-collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }-collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }-collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }-collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }+collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "28c439274c222bbc298dc6753200ee492d7e8509" }+collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "28c439274c222bbc298dc6753200ee492d7e8509" }+collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "28c439274c222bbc298dc6753200ee492d7e8509" }+collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "28c439274c222bbc298dc6753200ee492d7e8509" }+collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "28c439274c222bbc298dc6753200ee492d7e8509" }+collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "28c439274c222bbc298dc6753200ee492d7e8509" }+collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "28c439274c222bbc298dc6753200ee492d7e8509" }# Working directory: frontend# To update the commit ID, run:diff --git a/frontend/rust-lib/collab-integrate/src/collab_builder.rs b/frontend/rust-lib/collab-integrate/src/collab_builder.rsindex 55abed6e00..1ca88a931e 100644--- a/frontend/rust-lib/collab-integrate/src/collab_builder.rs+++ b/frontend/rust-lib/collab-integrate/src/collab_builder.rs@@ -7,6 +7,8 @@ use anyhow::Error;use arc_swap::{ArcSwap, ArcSwapOption};use collab::core::collab::DataSource;use collab::core::collab_plugin::CollabPersistence;+use collab::entity::EncodedCollab;+use collab::error::CollabError;use collab::preclude::{Collab, CollabBuilder};use collab_database::workspace_database::{DatabaseCollabService, WorkspaceDatabase};use collab_document::blocks::DocumentData;@@ -163,7 +165,22 @@ impl AppFlowyCollabBuilder {let document = match data {None => Document::open(collab)?,- Some(data) => Document::create_with_data(collab, data)?,+ Some(data) => {+ let document = Document::create_with_data(collab, data)?;+ if let Err(err) = self.write_collab_to_disk(+ object.uid,+ &object.object_id,+ collab_db.clone(),+ &object.collab_type,+ &document,+ ) {+ error!(+ "build_collab: flush document collab to disk failed: {}",+ err+ );+ }+ document+ },};let document = Arc::new(RwLock::new(document));self.finalize(object, builder_config, document)@@ -188,7 +205,19 @@ impl AppFlowyCollabBuilder {let collab = self.build_collab(&object, &collab_db, doc_state)?;let folder = match folder_data {None => Folder::open(object.uid, collab, folder_notifier)?,- Some(data) => Folder::create(object.uid, collab, folder_notifier, data),+ Some(data) => {+ let folder = Folder::create(object.uid, collab, folder_notifier, data);+ if let Err(err) = self.write_collab_to_disk(+ object.uid,+ &object.object_id,+ collab_db.clone(),+ &object.collab_type,+ &folder,+ ) {+ error!("build_collab: flush folder collab to disk failed: {}", err);+ }+ folder+ },};let folder = Arc::new(RwLock::new(folder));self.finalize(object, builder_config, folder)@@ -296,7 +325,7 @@ impl AppFlowyCollabBuilder {}/// Remove all updates in disk and write the final state vector to disk.- pub fn flush_collab_if_not_exist<T>(+ pub fn write_collab_to_disk<T>(&self,uid: i64,object_id: &str,@@ -309,20 +338,17 @@ impl AppFlowyCollabBuilder {{if let Some(collab_db) = collab_db.upgrade() {let write_txn = collab_db.write_txn();- let is_not_exist_on_disk = !write_txn.is_exist(uid, object_id);- if is_not_exist_on_disk {- trace!("flush collab:{}-{}-{} to disk", uid, collab_type, object_id);- let collab: &Collab = collab.borrow();- let encode_collab =- collab.encode_collab_v1(|collab| collab_type.validate_require_data(collab))?;- write_txn.flush_doc(- uid,- object_id,- encode_collab.state_vector.to_vec(),- encode_collab.doc_state.to_vec(),- )?;- write_txn.commit_transaction()?;- }+ trace!("flush collab:{}-{}-{} to disk", uid, collab_type, object_id);+ let collab: &Collab = collab.borrow();+ let encode_collab =+ collab.encode_collab_v1(|collab| collab_type.validate_require_data(collab))?;+ write_txn.flush_doc(+ uid,+ object_id,+ encode_collab.state_vector.to_vec(),+ encode_collab.doc_state.to_vec(),+ )?;+ write_txn.commit_transaction()?;}Ok(())@@ -390,4 +416,31 @@ impl CollabPersistence for KVDBCollabPersistenceImpl {warn!("collab_db is dropped");}}++ fn save_collab_to_disk(+ &self,+ object_id: &str,+ encoded_collab: EncodedCollab,+ ) -> Result<(), CollabError> {+ if let Some(collab_db) = self.db.upgrade() {+ let write_txn = collab_db.write_txn();+ write_txn+ .flush_doc(+ self.uid,+ object_id,+ encoded_collab.state_vector.to_vec(),+ encoded_collab.doc_state.to_vec(),+ )+ .map_err(|err| CollabError::Internal(err.into()))?;++ write_txn+ .commit_transaction()+ .map_err(|err| CollabError::Internal(err.into()))?;+ Ok(())+ } else {+ Err(CollabError::Internal(anyhow::anyhow!(+ "collab_db is dropped"+ )))+ }+ }}diff --git a/frontend/rust-lib/flowy-database2/src/manager.rs b/frontend/rust-lib/flowy-database2/src/manager.rsindex d5a8143918..6141247cd4 100644--- a/frontend/rust-lib/flowy-database2/src/manager.rs+++ b/frontend/rust-lib/flowy-database2/src/manager.rs@@ -18,10 +18,7 @@ use collab_database::workspace_database::{};use collab_entity::{CollabObject, CollabType, EncodedCollab};use collab_plugins::local_storage::kv::KVTransactionDB;-use dashmap::DashMap;-use tokio::select;use tokio::sync::Mutex;-use tokio_util::sync::CancellationToken;use tracing::{error, info, instrument, trace};use collab_integrate::collab_builder::{AppFlowyCollabBuilder, CollabBuilderConfig};@@ -112,7 +109,7 @@ impl DatabaseManager {.build_collab(workspace_database_object_id.as_str(),CollabType::WorkspaceDatabase,- false,+ None,).await?;let collab_object = collab_service@@ -654,7 +651,6 @@ struct WorkspaceDatabaseCollabServiceImpl {collab_builder: Arc<AppFlowyCollabBuilder>,persistence: Arc<dyn DatabaseCollabPersistenceService>,cloud_service: Arc<dyn DatabaseCloudService>,- cancellation: Arc<DashMap<String, Option<CancellationToken>>>,}impl WorkspaceDatabaseCollabServiceImpl {@@ -671,7 +667,6 @@ impl WorkspaceDatabaseCollabServiceImpl {collab_builder,persistence: Arc::new(persistence),cloud_service,- cancellation: Arc::new(Default::default()),}}@@ -681,35 +676,17 @@ impl WorkspaceDatabaseCollabServiceImpl {object_ty: CollabType,) -> Result<Option<EncodedCollab>, DatabaseError> {let workspace_id = self.user.workspace_id().unwrap();- let object_id = object_id.to_string();+ let object_id = object_id.to_string(); // Convert to String for later usetrace!("[Database]: fetch {}:{} from remote", object_id, object_ty);let weak_cloud_service = Arc::downgrade(&self.cloud_service);- match weak_cloud_service.upgrade() {- None => Err(DatabaseError::Internal(anyhow!("Cloud service is dropped"))),- Some(cloud_service) => {- if let Some((_, Some(token))) = self.cancellation.remove(&object_id) {- trace!("cancel previous request for object:{}", object_id);- token.cancel();- }-- let token = CancellationToken::new();- self- .cancellation- .insert(object_id.clone(), Some(token.clone()));- let cloned_cancellation = self.cancellation.clone();- tokio::spawn(async move {- select! {- _ = token.cancelled() => {- Err(DatabaseError::ActionCancelled)- },- encode_collab = cloud_service.get_database_encode_collab(&object_id, object_ty, &workspace_id) => {- cloned_cancellation.remove(&object_id);- Ok(encode_collab?)- }- }- }).await.map_err(|err| DatabaseError::Internal(err.into()))?- },- }+ let cloud_service = match weak_cloud_service.upgrade() {+ None => return Err(DatabaseError::Internal(anyhow!("Cloud service is dropped"))),+ Some(service) => service,+ };+ let encode_collab = cloud_service+ .get_database_encode_collab(&object_id, object_ty, &workspace_id)+ .await?;+ Ok(encode_collab)}#[allow(dead_code)]@@ -778,51 +755,60 @@ impl DatabaseCollabService for WorkspaceDatabaseCollabServiceImpl {&self,object_id: &str,collab_type: CollabType,- is_new: bool,+ encoded_collab: Option<EncodedCollab>,) -> Result<Collab, DatabaseError> {let object = self.build_collab_object(object_id, collab_type.clone())?;- let data_source: DataSource = if is_new {- DataSource::Disk(None)- } else if self.persistence.is_collab_exist(object_id) {- trace!("build collab: load {}:{} from disk", collab_type, object_id);+ let data_source = if self.persistence.is_collab_exist(object_id) {CollabPersistenceImpl {persistence: Some(self.persistence.clone()),}.into()} else {- info!(- "build collab: fetch {}:{} from remote, is_new:{}",- collab_type, object_id, is_new,- );- match self.get_encode_collab(object_id, collab_type.clone()).await {- Ok(Some(encode_collab)) => {+ match encoded_collab {+ None => {info!(- "build collab: {}:{} with remote encode collab, {} bytes",+ "build collab: fetch {}:{} from remote, is_new:{}",collab_type,object_id,- encode_collab.doc_state.len()+ encoded_collab.is_none(),);- DataSource::from(encode_collab)- },- Ok(None) => {- if self.is_local_user {- info!(- "build collab: {}:{} with empty encode collab",- collab_type, object_id- );- CollabPersistenceImpl {- persistence: Some(self.persistence.clone()),- }- .into()- } else {- return Err(DatabaseError::RecordNotFound);+ match self.get_encode_collab(object_id, collab_type.clone()).await {+ Ok(Some(encode_collab)) => {+ info!(+ "build collab: {}:{} with remote encode collab, {} bytes",+ collab_type,+ object_id,+ encode_collab.doc_state.len()+ );+ DataSource::from(encode_collab)+ },+ Ok(None) => {+ if self.is_local_user {+ info!(+ "build collab: {}:{} with empty encode collab",+ collab_type, object_id+ );+ CollabPersistenceImpl {+ persistence: Some(self.persistence.clone()),+ }+ .into()+ } else {+ return Err(DatabaseError::RecordNotFound);+ }+ },+ Err(err) => {+ if !matches!(err, DatabaseError::ActionCancelled) {+ error!("build collab: failed to get encode collab: {}", err);+ }+ return Err(err);+ },}},- Err(err) => {- if !matches!(err, DatabaseError::ActionCancelled) {- error!("build collab: failed to get encode collab: {}", err);- }- return Err(err);+ Some(encoded_collab) => {+ self+ .persistence+ .save_collab(object_id, encoded_collab.clone())?;+ encoded_collab.into()},}};@@ -897,6 +883,32 @@ impl DatabaseCollabPersistenceService for DatabasePersistenceImpl {Ok(())}+ fn save_collab(+ &self,+ object_id: &str,+ encoded_collab: EncodedCollab,+ ) -> Result<(), DatabaseError> {+ let uid = self+ .user+ .user_id()+ .map_err(|err| DatabaseError::Internal(err.into()))?;+ if let Ok(Some(collab_db)) = self.user.collab_db(uid).map(|weak| weak.upgrade()) {+ let write_txn = collab_db.write_txn();+ write_txn+ .flush_doc(+ uid,+ object_id,+ encoded_collab.state_vector.to_vec(),+ encoded_collab.doc_state.to_vec(),+ )+ .map_err(|err| DatabaseError::Internal(anyhow!("failed to flush doc: {}", err)))?;+ write_txn+ .commit_transaction()+ .map_err(|err| DatabaseError::Internal(anyhow!("failed to commit transaction: {}", err)))?;+ }+ Ok(())+ }+fn is_collab_exist(&self, object_id: &str) -> bool {match self.userdiff --git a/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs b/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rsindex 5f9957f964..b0eed0e711 100644--- a/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs+++ b/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs@@ -1461,6 +1461,7 @@ impl DatabaseEditor {let (tx, rx) = oneshot::channel();self.async_load_rows(view_editor, Some(tx), new_token);if should_wait {+ info!("[Database]: block until all rows are loaded");if let Ok(rows) = rx.await {row_metas = rows.into_iter()@@ -1508,7 +1509,7 @@ impl DatabaseEditor {trace!("[Database]: start loading rows");let cloned_database = Arc::downgrade(&self.database);tokio::spawn(async move {- const CHUNK_SIZE: usize = 20;+ const CHUNK_SIZE: usize = 5;let apply_filter_and_sort =|mut loaded_rows: Vec<Arc<Row>>, view_editor: Arc<DatabaseViewEditor>| async move {for loaded_row in loaded_rows.iter() {diff --git a/frontend/rust-lib/flowy-server/Cargo.toml b/frontend/rust-lib/flowy-server/Cargo.tomlindex 0ae7da2093..e5eb124fad 100644--- a/frontend/rust-lib/flowy-server/Cargo.toml+++ b/frontend/rust-lib/flowy-server/Cargo.toml@@ -32,6 +32,7 @@ collab-document = { workspace = true }collab-entity = { workspace = true }collab-folder = { workspace = true }collab-database = { workspace = true }+collab-user = { workspace = true }hex = "0.4.3"postgrest = "1.0"lib-infra = { workspace = true }diff --git a/frontend/rust-lib/flowy-server/src/local_server/impls/database.rs b/frontend/rust-lib/flowy-server/src/local_server/impls/database.rsindex fc42709b93..058b32afa3 100644--- a/frontend/rust-lib/flowy-server/src/local_server/impls/database.rs+++ b/frontend/rust-lib/flowy-server/src/local_server/impls/database.rs@@ -1,6 +1,10 @@use anyhow::Error;use collab::entity::EncodedCollab;+use collab_database::database::default_database_data;+use collab_database::workspace_database::default_workspace_database_data;+use collab_document::document_data::default_document_collab_data;use collab_entity::CollabType;+use collab_user::core::default_user_awareness_data;use flowy_database_pub::cloud::{DatabaseCloudService, DatabaseSnapshot, EncodeCollabByOid};use lib_infra::async_trait::async_trait;@@ -10,11 +14,24 @@ pub(crate) struct LocalServerDatabaseCloudServiceImpl();impl DatabaseCloudService for LocalServerDatabaseCloudServiceImpl {async fn get_database_encode_collab(&self,- _object_id: &str,- _collab_type: CollabType,+ object_id: &str,+ collab_type: CollabType,_workspace_id: &str,) -> Result<Option<EncodedCollab>, Error> {- Ok(None)+ match collab_type {+ CollabType::Document => {+ let encode_collab = default_document_collab_data(object_id)?;+ Ok(Some(encode_collab))+ },+ CollabType::Database => default_database_data(object_id)+ .map(Some)+ .map_err(Into::into),+ CollabType::WorkspaceDatabase => Ok(Some(default_workspace_database_data(object_id))),+ CollabType::Folder => Ok(None),+ CollabType::DatabaseRow => Ok(None),+ CollabType::UserAwareness => Ok(Some(default_user_awareness_data(object_id))),+ CollabType::Unknown => Ok(None),+ }}async fn batch_get_database_encode_collab(diff --git a/frontend/rust-lib/flowy-server/src/local_server/impls/user.rs b/frontend/rust-lib/flowy-server/src/local_server/impls/user.rsindex 092eb946ef..77fd138744 100644--- a/frontend/rust-lib/flowy-server/src/local_server/impls/user.rs+++ b/frontend/rust-lib/flowy-server/src/local_server/impls/user.rs@@ -1,7 +1,9 @@-use std::sync::Arc;-+use collab::core::origin::CollabOrigin;+use collab::preclude::Collab;use collab_entity::CollabObject;+use collab_user::core::UserAwareness;use lazy_static::lazy_static;+use std::sync::Arc;use tokio::sync::Mutex;use uuid::Uuid;@@ -147,10 +149,12 @@ impl UserCloudService for LocalServerUserAuthServiceImpl {&self,_uid: i64,_workspace_id: &str,- _object_id: &str,+ object_id: &str,) -> Result<Vec<u8>, FlowyError> {- // must return record not found error- Err(FlowyError::record_not_found())+ let collab = Collab::new_with_origin(CollabOrigin::Empty, object_id, vec![], false);+ let awareness = UserAwareness::create(collab, None)?;+ let encode_collab = awareness.encode_collab_v1(|_collab| Ok::<_, FlowyError>(()))?;+ Ok(encode_collab.doc_state.to_vec())}async fn reset_workspace(&self, _collab_object: CollabObject) -> Result<(), FlowyError> {diff --git a/frontend/rust-lib/flowy-user/src/services/data_import/appflowy_data_import.rs b/frontend/rust-lib/flowy-user/src/services/data_import/appflowy_data_import.rsindex 5f03cd537f..79650a2b09 100644--- a/frontend/rust-lib/flowy-user/src/services/data_import/appflowy_data_import.rs+++ b/frontend/rust-lib/flowy-user/src/services/data_import/appflowy_data_import.rs@@ -353,7 +353,7 @@ where&mut imported_database_indexer.transact_mut(),)?;- let array = WorkspaceDatabaseBody::new(&mut imported_database_indexer);+ let array = WorkspaceDatabaseBody::open(&mut imported_database_indexer);for database_meta_list in array.get_all_database_meta(&imported_database_indexer.transact()) {database_view_ids_by_database_id.insert(old_to_new_id_map.exchange_new_id(&database_meta_list.database_id),@@ -403,7 +403,7 @@ wherelet new_uid = new_user_session.user_id;let new_object_id = &new_user_session.user_workspace.database_indexer_id;- let array = WorkspaceDatabaseBody::new(&mut database_with_views_collab);+ let array = WorkspaceDatabaseBody::open(&mut database_with_views_collab);let mut txn = database_with_views_collab.transact_mut();for database_meta in array.get_all_database_meta(&txn) {array.update_database(&mut txn, &database_meta.database_id, |update| {