chore: fix database row meta (#6078)

* chore: fix database row meta

* chore: update

* chore: update client api

* chore: clippy

* chore: update client api

* chore: update collab

* chore: update client api
This commit is contained in:
Nathan.fooo 2024-08-26 23:42:18 +08:00 committed by GitHub
parent f342f5ec7e
commit 93bf1f79f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 172 additions and 174 deletions

View File

@ -89,6 +89,15 @@ class CellController<T, D> {
fieldId: _cellContext.fieldId,
);
_rowCache.addListener(
rowId: rowId,
onRowChanged: (context, reason) {
if (reason == const ChangedReason.didFetchRow()) {
_onRowMetaChanged?.call();
}
},
);
// 1. Listen on user edit event and load the new cell data if needed.
// For example:
// user input: 12

View File

@ -1,3 +1,5 @@
import 'dart:async';
import 'package:appflowy/plugins/database/application/row/row_service.dart';
import 'package:appflowy/plugins/database/domain/row_listener.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
@ -38,6 +40,25 @@ class RowController {
Future<void> initialize() async {
await _rowBackendSvc.initRow(rowMeta.id);
unawaited(
_rowBackendSvc.getRowMeta(rowId).then(
(result) {
if (_isDisposed) {
return;
}
result.fold(
(rowMeta) {
_rowMeta = rowMeta;
_rowCache.setRowMeta(rowMeta);
_onRowMetaChanged?.call();
},
(error) => debugPrint(error.toString()),
);
},
),
);
_rowListener.start(
onRowFetched: (DidFetchRowPB row) {
_rowCache.setRowMeta(row.meta);

View File

@ -172,7 +172,7 @@ checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
[[package]]
name = "app-error"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"bincode",
@ -192,7 +192,7 @@ dependencies = [
[[package]]
name = "appflowy-ai-client"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"bytes",
@ -826,7 +826,7 @@ dependencies = [
[[package]]
name = "client-api"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"again",
"anyhow",
@ -877,7 +877,7 @@ dependencies = [
[[package]]
name = "client-api-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"collab-entity",
"collab-rt-entity",
@ -890,7 +890,7 @@ dependencies = [
[[package]]
name = "client-websocket"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"futures-channel",
"futures-util",
@ -964,7 +964,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"arc-swap",
@ -989,7 +989,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"async-trait",
@ -1018,7 +1018,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"arc-swap",
@ -1038,7 +1038,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"bytes",
@ -1057,7 +1057,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"arc-swap",
@ -1100,7 +1100,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"async-stream",
@ -1138,7 +1138,7 @@ dependencies = [
[[package]]
name = "collab-rt-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"bincode",
@ -1163,7 +1163,7 @@ dependencies = [
[[package]]
name = "collab-rt-protocol"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"async-trait",
@ -1180,7 +1180,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"collab",
@ -1551,7 +1551,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "database-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"app-error",
@ -3076,7 +3076,7 @@ dependencies = [
[[package]]
name = "gotrue"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"futures-util",
@ -3093,7 +3093,7 @@ dependencies = [
[[package]]
name = "gotrue-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"app-error",
@ -3525,7 +3525,7 @@ dependencies = [
[[package]]
name = "infra"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"bytes",
@ -6122,7 +6122,7 @@ dependencies = [
[[package]]
name = "shared-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"app-error",

View File

@ -53,7 +53,7 @@ collab-user = { version = "0.2" }
# Run the script:
# scripts/tool/update_client_api_rev.sh new_rev_id
# ⚠️⚠️⚠️️
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "50e6a41513348f42a441c9c4f90220fcec2ba2ca" }
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "8cc410ce6542855b89f98f4c278049b7d679eb8f" }
[dependencies]
serde_json.workspace = true
@ -116,13 +116,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 = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
# Working directory: frontend
# To update the commit ID, run:

View File

@ -163,7 +163,7 @@ checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
[[package]]
name = "app-error"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"bincode",
@ -183,7 +183,7 @@ dependencies = [
[[package]]
name = "appflowy-ai-client"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"bytes",
@ -800,7 +800,7 @@ dependencies = [
[[package]]
name = "client-api"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"again",
"anyhow",
@ -851,7 +851,7 @@ dependencies = [
[[package]]
name = "client-api-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"collab-entity",
"collab-rt-entity",
@ -864,7 +864,7 @@ dependencies = [
[[package]]
name = "client-websocket"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"futures-channel",
"futures-util",
@ -947,7 +947,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"arc-swap",
@ -972,7 +972,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"async-trait",
@ -1001,7 +1001,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"arc-swap",
@ -1021,7 +1021,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"bytes",
@ -1040,7 +1040,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"arc-swap",
@ -1083,7 +1083,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"async-stream",
@ -1121,7 +1121,7 @@ dependencies = [
[[package]]
name = "collab-rt-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"bincode",
@ -1146,7 +1146,7 @@ dependencies = [
[[package]]
name = "collab-rt-protocol"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"async-trait",
@ -1163,7 +1163,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"collab",
@ -1541,7 +1541,7 @@ checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5"
[[package]]
name = "database-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"app-error",
@ -3143,7 +3143,7 @@ dependencies = [
[[package]]
name = "gotrue"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"futures-util",
@ -3160,7 +3160,7 @@ dependencies = [
[[package]]
name = "gotrue-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"app-error",
@ -3597,7 +3597,7 @@ dependencies = [
[[package]]
name = "infra"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"bytes",
@ -6186,7 +6186,7 @@ dependencies = [
[[package]]
name = "shared-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"app-error",

View File

@ -52,7 +52,7 @@ collab-user = { version = "0.2" }
# Run the script:
# scripts/tool/update_client_api_rev.sh new_rev_id
# ⚠️⚠️⚠️️
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "50e6a41513348f42a441c9c4f90220fcec2ba2ca" }
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "8cc410ce6542855b89f98f4c278049b7d679eb8f" }
[dependencies]
serde_json.workspace = true
@ -116,13 +116,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 = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
# Working directory: frontend
# To update the commit ID, run:

View File

@ -163,7 +163,7 @@ checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
[[package]]
name = "app-error"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"bincode",
@ -183,7 +183,7 @@ dependencies = [
[[package]]
name = "appflowy-ai-client"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"bytes",
@ -718,7 +718,7 @@ dependencies = [
[[package]]
name = "client-api"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"again",
"anyhow",
@ -769,7 +769,7 @@ dependencies = [
[[package]]
name = "client-api-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"collab-entity",
"collab-rt-entity",
@ -782,7 +782,7 @@ dependencies = [
[[package]]
name = "client-websocket"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"futures-channel",
"futures-util",
@ -825,7 +825,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"arc-swap",
@ -850,7 +850,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"async-trait",
@ -879,7 +879,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"arc-swap",
@ -899,7 +899,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"bytes",
@ -918,7 +918,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"arc-swap",
@ -961,7 +961,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"async-stream",
@ -999,7 +999,7 @@ dependencies = [
[[package]]
name = "collab-rt-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"bincode",
@ -1024,7 +1024,7 @@ dependencies = [
[[package]]
name = "collab-rt-protocol"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"async-trait",
@ -1041,7 +1041,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f747496df74b61bccfa25eaefae161a331f71f96#f747496df74b61bccfa25eaefae161a331f71f96"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ec4f92941942f20c84dce142cd2eeafd44ca7362#ec4f92941942f20c84dce142cd2eeafd44ca7362"
dependencies = [
"anyhow",
"collab",
@ -1375,7 +1375,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "database-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"app-error",
@ -2754,7 +2754,7 @@ dependencies = [
[[package]]
name = "gotrue"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"futures-util",
@ -2771,7 +2771,7 @@ dependencies = [
[[package]]
name = "gotrue-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"app-error",
@ -3136,7 +3136,7 @@ dependencies = [
[[package]]
name = "infra"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"bytes",
@ -5344,7 +5344,7 @@ dependencies = [
[[package]]
name = "shared-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=50e6a41513348f42a441c9c4f90220fcec2ba2ca#50e6a41513348f42a441c9c4f90220fcec2ba2ca"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8cc410ce6542855b89f98f4c278049b7d679eb8f#8cc410ce6542855b89f98f4c278049b7d679eb8f"
dependencies = [
"anyhow",
"app-error",

View File

@ -100,8 +100,8 @@ dashmap = "6.0.1"
# Run the script.add_workspace_members:
# scripts/tool/update_client_api_rev.sh new_rev_id
# ⚠️⚠️⚠️️
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "50e6a41513348f42a441c9c4f90220fcec2ba2ca" }
client-api-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "50e6a41513348f42a441c9c4f90220fcec2ba2ca" }
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "8cc410ce6542855b89f98f4c278049b7d679eb8f" }
client-api-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "8cc410ce6542855b89f98f4c278049b7d679eb8f" }
[profile.dev]
opt-level = 0
@ -136,13 +136,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 = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f747496df74b61bccfa25eaefae161a331f71f96" }
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ec4f92941942f20c84dce142cd2eeafd44ca7362" }
# Working directory: frontend
# To update the commit ID, run:

View File

@ -162,14 +162,6 @@ impl AppFlowyCollabBuilder {
collab.enable_undo_redo();
let document = Document::open_with(collab, data)?;
self.flush_collab_if_not_exist(
object.uid,
&object.object_id,
collab_db.clone(),
&expected_collab_type,
&document,
)?;
let document = Arc::new(RwLock::new(document));
self.finalize(object, builder_config, document)
}
@ -192,15 +184,6 @@ impl AppFlowyCollabBuilder {
assert_eq!(object.collab_type, expected_collab_type);
let collab = self.build_collab(&object, &collab_db, doc_state)?;
let folder = Folder::open_with(object.uid, collab, folder_notifier, folder_data);
self.flush_collab_if_not_exist(
object.uid,
&object.object_id,
collab_db.clone(),
&expected_collab_type,
&folder,
)?;
let folder = Arc::new(RwLock::new(folder));
self.finalize(object, builder_config, folder)
}
@ -222,15 +205,6 @@ impl AppFlowyCollabBuilder {
assert_eq!(object.collab_type, expected_collab_type);
let collab = self.build_collab(&object, &collab_db, doc_state)?;
let user_awareness = UserAwareness::open(collab, notifier);
self.flush_collab_if_not_exist(
object.uid,
&object.object_id,
collab_db.clone(),
&expected_collab_type,
&user_awareness,
)?;
let user_awareness = Arc::new(RwLock::new(user_awareness));
self.finalize(object, builder_config, user_awareness)
}
@ -241,22 +215,13 @@ impl AppFlowyCollabBuilder {
&self,
object: CollabObject,
collab: Collab,
collab_db: Weak<CollabKVDB>,
_collab_db: Weak<CollabKVDB>,
builder_config: CollabBuilderConfig,
collab_service: impl DatabaseCollabService,
) -> Result<Arc<RwLock<WorkspaceDatabase>>, Error> {
let expected_collab_type = CollabType::WorkspaceDatabase;
assert_eq!(object.collab_type, expected_collab_type);
let workspace = WorkspaceDatabase::open(collab, collab_service);
self.flush_collab_if_not_exist(
object.uid,
&object.object_id,
collab_db.clone(),
&expected_collab_type,
&workspace,
)?;
let workspace = WorkspaceDatabase::open(&object.object_id, collab, collab_service);
let workspace = Arc::new(RwLock::new(workspace));
self.finalize(object, builder_config, workspace)
}
@ -267,7 +232,7 @@ impl AppFlowyCollabBuilder {
collab_db: &Weak<CollabKVDB>,
data_source: DataSource,
) -> Result<Collab, Error> {
let collab = CollabBuilder::new(object.uid, &object.object_id, data_source)
let mut collab = CollabBuilder::new(object.uid, &object.object_id, data_source)
.with_device_id(self.workspace_integrate.device_id()?)
.build()?;
@ -280,7 +245,7 @@ impl AppFlowyCollabBuilder {
persistence_config.clone(),
);
collab.add_plugin(Box::new(db_plugin));
collab.initialize();
Ok(collab)
}
@ -293,17 +258,8 @@ impl AppFlowyCollabBuilder {
where
T: BorrowMut<Collab> + Send + Sync + 'static,
{
if !build_config.sync_enable {
return Ok(collab);
}
let mut write_collab = collab.try_write()?;
if !write_collab.borrow().get_state().is_uninitialized() {
warn!("{} is already initialized", object);
drop(write_collab);
return Ok(collab);
}
if build_config.sync_enable {
trace!("🚀finalize collab:{}", object);
let plugin_provider = self.plugin_provider.load_full();
let provider_type = plugin_provider.provider_type();
@ -326,10 +282,10 @@ impl AppFlowyCollabBuilder {
},
CollabPluginProviderType::Local => {},
}
}
(*write_collab).borrow_mut().initialize();
drop(write_collab);
Ok(collab)
}
@ -349,17 +305,17 @@ impl AppFlowyCollabBuilder {
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", collab_type, object_id);
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()?;
}
}

View File

@ -31,7 +31,7 @@ async fn af_cloud_edit_document_test() {
let rx = test
.notification_sender
.subscribe_with_condition::<DocumentSyncStatePB, _>(&document_id, |pb| {
pb.value != DocumentSyncState::Syncing
pb.value == DocumentSyncState::SyncFinished
});
let _ = receive_with_timeout(rx, Duration::from_secs(30)).await;

View File

@ -98,7 +98,7 @@ impl From<Row> for RowMetaPB {
}
}
impl std::convert::From<RowDetail> for RowMetaPB {
impl From<RowDetail> for RowMetaPB {
fn from(row_detail: RowDetail) -> Self {
Self {
id: row_detail.row.id.to_string(),

View File

@ -762,20 +762,31 @@ impl DatabaseCollabService for WorkspaceDatabaseCollabServiceImpl {
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);
CollabPersistenceImpl {
persistence: Some(self.persistence.clone()),
}
.into()
} else {
match self.get_encode_collab(object_id, collab_type).await {
trace!(
"build collab: fetch {}:{} from remote",
collab_type,
object_id
);
match self.get_encode_collab(object_id, collab_type.clone()).await {
Ok(Some(encode_collab)) => {
self
.persistence
.flush_collab(object_id, encode_collab.clone())
.map_err(|err| DatabaseError::Internal(anyhow!("Failed to flush collab: {}", err)))?;
trace!(
"build collab: {}:{} with remote encode collab",
collab_type,
object_id
);
DataSource::from(encode_collab)
},
Ok(None) => {
info!(
"build collab: {}:{} with empty encode collab",
collab_type, object_id
);
// when collab not exist, create a default collab
CollabPersistenceImpl {
persistence: Some(self.persistence.clone()),
@ -783,7 +794,7 @@ impl DatabaseCollabService for WorkspaceDatabaseCollabServiceImpl {
.into()
},
Err(err) => {
error!("Failed to get encode collab: {}", err);
error!("build collab: failed to get encode collab: {}", err);
return Err(err);
},
}
@ -825,7 +836,7 @@ impl DatabaseCollabPersistenceService for DatabasePersistenceImpl {
return;
}
trace!("[Database]: start loading collab:{}", object_id);
trace!("[Database]: start loading collab:{} from disk", object_id);
let mut txn = collab.transact_mut();
match db_read.load_doc_with_txn(uid, &object_id, &mut txn) {
Ok(update_count) => {
@ -881,12 +892,12 @@ impl DatabaseCollabPersistenceService for DatabasePersistenceImpl {
object_id: &str,
encode_collab: EncodedCollab,
) -> Result<(), DatabaseError> {
trace!("[Database]: flush collab:{}", object_id);
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()) {
trace!("[Database]: flush collab:{}", object_id);
let write_txn = collab_db.write_txn();
write_txn
.flush_doc(

View File

@ -91,5 +91,8 @@ impl std::convert::From<i32> for DatabaseNotification {
#[tracing::instrument(level = "trace")]
pub fn send_notification(id: &str, ty: DatabaseNotification) -> NotificationBuilder {
#[cfg(feature = "verbose_log")]
trace!("[Database Notification]: id:{}, ty:{:?}", id, ty);
NotificationBuilder::new(id, ty, DATABASE_OBSERVABLE_SOURCE)
}

View File

@ -31,6 +31,7 @@ use collab_database::views::{
};
use collab_entity::CollabType;
use collab_integrate::collab_builder::{AppFlowyCollabBuilder, CollabBuilderConfig};
use dashmap::DashMap;
use flowy_error::{internal_error, ErrorCode, FlowyError, FlowyResult};
use flowy_notification::DebounceNotificationSender;
use lib_infra::box_any::BoxAny;
@ -58,6 +59,7 @@ pub struct DatabaseEditor {
is_opening: ArcSwap<bool>,
opening_ret_txs: Arc<RwLock<Vec<OpenDatabaseResult>>>,
database_cancellation: Arc<RwLock<Option<CancellationToken>>>,
finalized_rows: Arc<DashMap<RowId, bool>>,
}
impl DatabaseEditor {
@ -120,6 +122,7 @@ impl DatabaseEditor {
is_opening: Default::default(),
opening_ret_txs: Arc::new(Default::default()),
database_cancellation,
finalized_rows: Arc::new(Default::default()),
});
observe_block_event(&database_id, &this).await;
Ok(this)
@ -699,18 +702,13 @@ impl DatabaseEditor {
}
pub async fn init_database_row(&self, row_id: &RowId) -> FlowyResult<()> {
if let Some(database_row) = self.database.read().await.get_database_row(row_id) {
if !database_row
.read()
.await
.collab
.get_state()
.is_uninitialized()
{
if let Some(entry) = self.finalized_rows.get(row_id) {
if *entry.value() {
return Ok(());
}
}
self.finalized_rows.insert(row_id.clone(), true);
debug!("Init database row: {}", row_id);
let database_row = self
.database

View File

@ -32,7 +32,8 @@ impl<T> DatabaseCloudService for AFCloudDatabaseCloudServiceImpl<T>
where
T: AFServer,
{
#[instrument(level = "debug", skip_all)]
#[instrument(level = "debug", skip_all, err)]
#[allow(clippy::blocks_in_conditions)]
async fn get_database_encode_collab(
&self,
object_id: &str,

View File

@ -15,7 +15,6 @@ where
PersistenceError: From<R::Error>,
{
let mut collab_by_oid = HashMap::new();
for object_id in object_ids {
match load_collab_by_object_id(uid, collab_read_txn, object_id) {
Ok(collab) => {