From a0fc4b86b09a2b0d5bd083b50213706e7eca8474 Mon Sep 17 00:00:00 2001 From: "Nathan.fooo" <86001920+appflowy@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:00:23 +0800 Subject: [PATCH] chore: update collab libs rev (#3342) --- frontend/appflowy_tauri/src-tauri/Cargo.toml | 18 +- frontend/rust-lib/Cargo.lock | 173 ++++++------------ frontend/rust-lib/Cargo.toml | 16 +- .../rust-lib/flowy-database2/src/manager.rs | 5 +- .../src/services/database/database_editor.rs | 4 +- .../src/services/database_view/view_editor.rs | 2 +- .../rust-lib/flowy-document2/src/manager.rs | 8 +- .../src/migrations/migrate_to_new_user.rs | 14 +- .../src/migrations/sync_new_user.rs | 12 +- 9 files changed, 99 insertions(+), 153 deletions(-) diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.toml b/frontend/appflowy_tauri/src-tauri/Cargo.toml index f033d4b4c1..26c9e68e9c 100644 --- a/frontend/appflowy_tauri/src-tauri/Cargo.toml +++ b/frontend/appflowy_tauri/src-tauri/Cargo.toml @@ -34,15 +34,15 @@ default = ["custom-protocol"] custom-protocol = ["tauri/custom-protocol"] [patch.crates-io] -collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } -collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } -collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } -collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } -collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } -appflowy-integrate = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } -collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } -collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } -collab-define = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } +collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" } +collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" } +collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" } +collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" } +collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" } +appflowy-integrate = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" } +collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" } +collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" } +collab-define = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" } #collab = { path = "../../../../AppFlowy-Collab/collab" } #collab-folder = { path = "../../../../AppFlowy-Collab/collab-folder" } diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock index 5d9fc1645e..f75aeb67e3 100644 --- a/frontend/rust-lib/Cargo.lock +++ b/frontend/rust-lib/Cargo.lock @@ -120,7 +120,7 @@ checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "appflowy-integrate" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=223011#223011a4340d0d98e7e10ca6bb19b8d622b0f568" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a6ce82#a6ce82e00345fb34eccaf2fad55ec722365d38fa" dependencies = [ "anyhow", "collab", @@ -129,7 +129,8 @@ dependencies = [ "collab-folder", "collab-persistence", "collab-plugins", - "parking_lot 0.12.1", + "futures", + "parking_lot", "serde", "serde_json", "tracing", @@ -611,12 +612,13 @@ dependencies = [ [[package]] name = "collab" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=223011#223011a4340d0d98e7e10ca6bb19b8d622b0f568" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a6ce82#a6ce82e00345fb34eccaf2fad55ec722365d38fa" dependencies = [ "anyhow", + "async-trait", "bytes", "lib0", - "parking_lot 0.12.1", + "parking_lot", "serde", "serde_json", "thiserror", @@ -626,28 +628,10 @@ dependencies = [ "yrs", ] -[[package]] -name = "collab-client-ws" -version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=223011#223011a4340d0d98e7e10ca6bb19b8d622b0f568" -dependencies = [ - "bytes", - "collab-sync", - "futures-util", - "serde", - "serde_json", - "thiserror", - "tokio", - "tokio-retry", - "tokio-stream", - "tokio-tungstenite", - "tracing", -] - [[package]] name = "collab-database" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=223011#223011a4340d0d98e7e10ca6bb19b8d622b0f568" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a6ce82#a6ce82e00345fb34eccaf2fad55ec722365d38fa" dependencies = [ "anyhow", "async-trait", @@ -660,7 +644,7 @@ dependencies = [ "lazy_static", "lru", "nanoid", - "parking_lot 0.12.1", + "parking_lot", "serde", "serde_json", "serde_repr", @@ -676,7 +660,7 @@ dependencies = [ [[package]] name = "collab-define" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=223011#223011a4340d0d98e7e10ca6bb19b8d622b0f568" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a6ce82#a6ce82e00345fb34eccaf2fad55ec722365d38fa" dependencies = [ "anyhow", "collab", @@ -688,7 +672,7 @@ dependencies = [ [[package]] name = "collab-derive" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=223011#223011a4340d0d98e7e10ca6bb19b8d622b0f568" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a6ce82#a6ce82e00345fb34eccaf2fad55ec722365d38fa" dependencies = [ "proc-macro2", "quote", @@ -700,14 +684,14 @@ dependencies = [ [[package]] name = "collab-document" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=223011#223011a4340d0d98e7e10ca6bb19b8d622b0f568" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a6ce82#a6ce82e00345fb34eccaf2fad55ec722365d38fa" dependencies = [ "anyhow", "collab", "collab-derive", "collab-persistence", "nanoid", - "parking_lot 0.12.1", + "parking_lot", "serde", "serde_json", "thiserror", @@ -719,14 +703,14 @@ dependencies = [ [[package]] name = "collab-folder" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=223011#223011a4340d0d98e7e10ca6bb19b8d622b0f568" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a6ce82#a6ce82e00345fb34eccaf2fad55ec722365d38fa" dependencies = [ "anyhow", "chrono", "collab", "collab-derive", "collab-persistence", - "parking_lot 0.12.1", + "parking_lot", "serde", "serde_json", "serde_repr", @@ -739,16 +723,17 @@ dependencies = [ [[package]] name = "collab-persistence" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=223011#223011a4340d0d98e7e10ca6bb19b8d622b0f568" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a6ce82#a6ce82e00345fb34eccaf2fad55ec722365d38fa" dependencies = [ + "async-trait", "bincode", "chrono", + "collab", "lazy_static", "lib0", - "parking_lot 0.12.1", + "parking_lot", "rocksdb", "serde", - "sled", "smallvec", "thiserror", "tokio", @@ -759,17 +744,17 @@ dependencies = [ [[package]] name = "collab-plugins" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=223011#223011a4340d0d98e7e10ca6bb19b8d622b0f568" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a6ce82#a6ce82e00345fb34eccaf2fad55ec722365d38fa" dependencies = [ "anyhow", "async-trait", "collab", - "collab-client-ws", "collab-define", "collab-persistence", "collab-sync", + "collab-ws", "futures-util", - "parking_lot 0.12.1", + "parking_lot", "rand 0.8.5", "serde", "serde_json", @@ -787,14 +772,14 @@ dependencies = [ [[package]] name = "collab-sync" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=223011#223011a4340d0d98e7e10ca6bb19b8d622b0f568" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a6ce82#a6ce82e00345fb34eccaf2fad55ec722365d38fa" dependencies = [ "bytes", "collab", "futures-util", "lib0", "md5", - "parking_lot 0.12.1", + "parking_lot", "serde", "serde_json", "thiserror", @@ -809,12 +794,12 @@ dependencies = [ [[package]] name = "collab-user" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=223011#223011a4340d0d98e7e10ca6bb19b8d622b0f568" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a6ce82#a6ce82e00345fb34eccaf2fad55ec722365d38fa" dependencies = [ "anyhow", "collab", "collab-define", - "parking_lot 0.12.1", + "parking_lot", "serde", "serde_json", "tokio", @@ -822,6 +807,24 @@ dependencies = [ "tracing", ] +[[package]] +name = "collab-ws" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a6ce82#a6ce82e00345fb34eccaf2fad55ec722365d38fa" +dependencies = [ + "bytes", + "collab-sync", + "futures-util", + "serde", + "serde_json", + "thiserror", + "tokio", + "tokio-retry", + "tokio-stream", + "tokio-tungstenite", + "tracing", +] + [[package]] name = "config" version = "0.10.1" @@ -1072,7 +1075,7 @@ dependencies = [ "lazy_static", "lib-dispatch", "log", - "parking_lot 0.12.1", + "parking_lot", "protobuf", "serde", "serde_json", @@ -1090,7 +1093,7 @@ dependencies = [ "hashbrown 0.12.3", "lock_api", "once_cell", - "parking_lot_core 0.9.7", + "parking_lot_core", ] [[package]] @@ -1367,7 +1370,7 @@ dependencies = [ "lib-dispatch", "lib-infra", "lib-log", - "parking_lot 0.12.1", + "parking_lot", "serde", "serde_json", "serde_repr", @@ -1415,7 +1418,7 @@ dependencies = [ "lib-dispatch", "lib-infra", "nanoid", - "parking_lot 0.12.1", + "parking_lot", "protobuf", "rayon", "rust_decimal", @@ -1475,7 +1478,7 @@ dependencies = [ "lib-dispatch", "lib-infra", "nanoid", - "parking_lot 0.12.1", + "parking_lot", "protobuf", "serde", "serde_json", @@ -1556,7 +1559,7 @@ dependencies = [ "lib-dispatch", "lib-infra", "nanoid", - "parking_lot 0.12.1", + "parking_lot", "protobuf", "strum_macros 0.21.1", "tokio", @@ -1619,7 +1622,7 @@ dependencies = [ "lazy_static", "lib-infra", "mime_guess", - "parking_lot 0.12.1", + "parking_lot", "postgrest", "reqwest", "serde", @@ -1657,7 +1660,7 @@ dependencies = [ "libsqlite3-sys", "openssl", "openssl-sys", - "parking_lot 0.12.1", + "parking_lot", "r2d2", "scheduled-thread-pool", "serde", @@ -1726,7 +1729,7 @@ dependencies = [ "lib-dispatch", "lib-infra", "nanoid", - "parking_lot 0.12.1", + "parking_lot", "protobuf", "serde", "serde_json", @@ -1772,7 +1775,7 @@ dependencies = [ "log", "nanoid", "once_cell", - "parking_lot 0.12.1", + "parking_lot", "protobuf", "quickcheck", "quickcheck_macros", @@ -1835,16 +1838,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fs2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "fuchsia-cprng" version = "0.1.1" @@ -1940,15 +1933,6 @@ dependencies = [ "slab", ] -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - [[package]] name = "generic-array" version = "0.14.7" @@ -2889,17 +2873,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.6", -] - [[package]] name = "parking_lot" version = "0.12.1" @@ -2907,21 +2880,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.7", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall 0.2.16", - "smallvec", - "winapi", + "parking_lot_core", ] [[package]] @@ -3485,7 +3444,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93" dependencies = [ "log", - "parking_lot 0.12.1", + "parking_lot", "scheduled-thread-pool", ] @@ -3923,7 +3882,7 @@ version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3cbc66816425a074528352f5789333ecff06ca41b36b0b0efdfbb29edc391a19" dependencies = [ - "parking_lot 0.12.1", + "parking_lot", ] [[package]] @@ -4127,22 +4086,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "sled" -version = "0.34.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f96b4737c2ce5987354855aed3797279def4ebf734436c6aa4552cf8e169935" -dependencies = [ - "crc32fast", - "crossbeam-epoch", - "crossbeam-utils", - "fs2", - "fxhash", - "libc", - "log", - "parking_lot 0.11.2", -] - [[package]] name = "slug" version = "0.1.4" @@ -4432,7 +4375,7 @@ dependencies = [ "libc", "mio", "num_cpus", - "parking_lot 0.12.1", + "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2 0.4.9", @@ -4485,7 +4428,7 @@ dependencies = [ "futures-channel", "futures-util", "log", - "parking_lot 0.12.1", + "parking_lot", "percent-encoding", "phf 0.11.1", "pin-project-lite", diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.toml index 6f1952866c..648ee96fc9 100644 --- a/frontend/rust-lib/Cargo.toml +++ b/frontend/rust-lib/Cargo.toml @@ -49,14 +49,14 @@ lto = false incremental = false [patch.crates-io] -collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } -collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } -collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } -collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } -appflowy-integrate = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } -collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } -collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } -collab-define = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } +collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" } +collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" } +collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" } +collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" } +appflowy-integrate = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" } +collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" } +collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" } +collab-define = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" } #collab = { path = "../AppFlowy-Collab/collab" } #collab-folder = { path = "../AppFlowy-Collab/collab-folder" } diff --git a/frontend/rust-lib/flowy-database2/src/manager.rs b/frontend/rust-lib/flowy-database2/src/manager.rs index 84355b63a9..8fbdf4eced 100644 --- a/frontend/rust-lib/flowy-database2/src/manager.rs +++ b/frontend/rust-lib/flowy-database2/src/manager.rs @@ -255,10 +255,7 @@ impl DatabaseManager { let (field, layout_setting) = DatabaseLayoutDepsResolver::new(database, layout) .resolve_deps_when_create_database_linked_view(); if let Some(field) = field { - params = params.with_deps_fields( - vec![field.clone()], - vec![default_field_settings_by_layout_map()], - ); + params = params.with_deps_fields(vec![field], vec![default_field_settings_by_layout_map()]); } if let Some(layout_setting) = layout_setting { params = params.with_layout_setting(layout_setting); diff --git a/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs b/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs index fd819fb306..4416ad8f2d 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 @@ -1422,12 +1422,12 @@ impl DatabaseViewData for DatabaseViewDataImpl { fn get_field_settings( &self, view_id: &str, - field_ids: &Vec, + field_ids: &[String], ) -> HashMap { let field_settings_map = self .database .lock() - .get_field_settings(view_id, Some(&field_ids)); + .get_field_settings(view_id, Some(field_ids)); field_settings_map .into_iter() diff --git a/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs b/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs index 4ce9de521d..65aff62db8 100644 --- a/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs +++ b/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs @@ -126,7 +126,7 @@ pub trait DatabaseViewData: Send + Sync + 'static { fn get_field_settings( &self, view_id: &str, - field_ids: &Vec, + field_ids: &[String], ) -> HashMap; fn get_all_field_settings(&self, view_id: &str) -> HashMap; diff --git a/frontend/rust-lib/flowy-document2/src/manager.rs b/frontend/rust-lib/flowy-document2/src/manager.rs index aec5f8dd09..f18fd608ce 100644 --- a/frontend/rust-lib/flowy-document2/src/manager.rs +++ b/frontend/rust-lib/flowy-document2/src/manager.rs @@ -72,7 +72,7 @@ impl DocumentManager { if self.is_doc_exist(doc_id).unwrap_or(false) { self.get_document(doc_id).await } else { - let collab = self.collab_for_document(uid, doc_id, vec![])?; + let collab = self.collab_for_document(uid, doc_id, vec![]).await?; let data = data.unwrap_or_else(default_document_data); let document = Arc::new(MutexDocument::create_with_data(collab, data)?); Ok(document) @@ -92,7 +92,7 @@ impl DocumentManager { } let uid = self.user.user_id()?; - let collab = self.collab_for_document(uid, doc_id, updates)?; + let collab = self.collab_for_document(uid, doc_id, updates).await?; let document = Arc::new(MutexDocument::open(doc_id, collab)?); // save the document to the memory and read it from the memory if we open the same document again. @@ -110,7 +110,7 @@ impl DocumentManager { updates = self.cloud_service.get_document_updates(doc_id).await?; } let uid = self.user.user_id()?; - let collab = self.collab_for_document(uid, doc_id, updates)?; + let collab = self.collab_for_document(uid, doc_id, updates).await?; Document::open(collab)? .get_document_data() .map_err(internal_error) @@ -155,7 +155,7 @@ impl DocumentManager { Ok(snapshots) } - fn collab_for_document( + async fn collab_for_document( &self, uid: i64, doc_id: &str, diff --git a/frontend/rust-lib/flowy-user/src/migrations/migrate_to_new_user.rs b/frontend/rust-lib/flowy-user/src/migrations/migrate_to_new_user.rs index cd2fed82d6..301313ce56 100644 --- a/frontend/rust-lib/flowy-user/src/migrations/migrate_to_new_user.rs +++ b/frontend/rust-lib/flowy-user/src/migrations/migrate_to_new_user.rs @@ -144,7 +144,7 @@ where vec![], ); database_with_views_collab.with_origin_transact_mut(|txn| { - old_collab_r_txn.load_doc( + old_collab_r_txn.load_doc_with_txn( old_user.session.user_id, &old_user.session.user_workspace.database_views_aggregate_id, txn, @@ -186,14 +186,15 @@ where } } -fn migrate_workspace_folder<'a, W>( +fn migrate_workspace_folder<'a, 'b, W>( old_to_new_id_map: &mut OldToNewIdMap, old_user: &MigrationUser, - old_collab_r_txn: &'a W, + old_collab_r_txn: &'b W, new_user: &MigrationUser, new_collab_w_txn: &'a W, ) -> Result<(), PersistenceError> where + 'a: 'b, W: YrsDocAction<'a>, PersistenceError: From, { @@ -203,8 +204,9 @@ where let new_workspace_id = &new_user.session.user_workspace.id; let old_folder_collab = Collab::new(old_uid, old_workspace_id, "phantom", vec![]); - old_folder_collab - .with_origin_transact_mut(|txn| old_collab_r_txn.load_doc(old_uid, old_workspace_id, txn))?; + old_folder_collab.with_origin_transact_mut(|txn| { + old_collab_r_txn.load_doc_with_txn(old_uid, old_workspace_id, txn) + })?; let old_folder = Folder::open(Arc::new(MutexCollab::from_collab(old_folder_collab)), None); let mut folder_data = old_folder .get_folder_data() @@ -417,7 +419,7 @@ where for object_id in object_ids { let collab = Collab::new(old_user.session.user_id, object_id, "phantom", vec![]); match collab.with_origin_transact_mut(|txn| { - old_collab_r_txn.load_doc(old_user.session.user_id, &object_id, txn) + old_collab_r_txn.load_doc_with_txn(old_user.session.user_id, &object_id, txn) }) { Ok(_) => { collab_by_oid.insert(object_id.clone(), collab); diff --git a/frontend/rust-lib/flowy-user/src/migrations/sync_new_user.rs b/frontend/rust-lib/flowy-user/src/migrations/sync_new_user.rs index 9b195e5f9e..24886f40cd 100644 --- a/frontend/rust-lib/flowy-user/src/migrations/sync_new_user.rs +++ b/frontend/rust-lib/flowy-user/src/migrations/sync_new_user.rs @@ -175,7 +175,7 @@ fn get_collab_init_update( let _ = collab.with_origin_transact_mut(|txn| { collab_db .read_txn() - .load_doc(uid, &collab_object.object_id, txn) + .load_doc_with_txn(uid, &collab_object.object_id, txn) })?; let update = collab.encode_as_update_v1().0; if update.is_empty() { @@ -194,7 +194,7 @@ fn get_database_init_update( let _ = collab.with_origin_transact_mut(|txn| { collab_db .read_txn() - .load_doc(uid, &collab_object.object_id, txn) + .load_doc_with_txn(uid, &collab_object.object_id, txn) })?; let row_ids = get_database_row_ids(&collab).unwrap_or_default(); @@ -215,7 +215,11 @@ async fn sync_folder( let (folder, update) = { let collab = Collab::new(uid, workspace_id, "phantom", vec![]); // Use the temporary result to short the lifetime of the TransactionMut - collab.with_origin_transact_mut(|txn| collab_db.read_txn().load_doc(uid, workspace_id, txn))?; + collab.with_origin_transact_mut(|txn| { + collab_db + .read_txn() + .load_doc_with_txn(uid, workspace_id, txn) + })?; let update = collab.encode_as_update_v1().0; ( MutexFolder::new(Folder::open( @@ -264,7 +268,7 @@ async fn sync_database_views( .with_origin_transact_mut(|txn| { collab_db .read_txn() - .load_doc(uid, database_views_aggregate_id, txn) + .load_doc_with_txn(uid, database_views_aggregate_id, txn) }) .map(|_| { (