chore: update collab libs rev (#3342)

This commit is contained in:
Nathan.fooo 2023-09-06 16:00:23 +08:00 committed by GitHub
parent 790580eea4
commit a0fc4b86b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 99 additions and 153 deletions

View File

@ -34,15 +34,15 @@ default = ["custom-protocol"]
custom-protocol = ["tauri/custom-protocol"] custom-protocol = ["tauri/custom-protocol"]
[patch.crates-io] [patch.crates-io]
collab = { 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 = "223011" } collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" }
collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" }
appflowy-integrate = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } appflowy-integrate = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" }
collab-define = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } collab-define = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" }
#collab = { path = "../../../../AppFlowy-Collab/collab" } #collab = { path = "../../../../AppFlowy-Collab/collab" }
#collab-folder = { path = "../../../../AppFlowy-Collab/collab-folder" } #collab-folder = { path = "../../../../AppFlowy-Collab/collab-folder" }

View File

@ -120,7 +120,7 @@ checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
[[package]] [[package]]
name = "appflowy-integrate" name = "appflowy-integrate"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"collab", "collab",
@ -129,7 +129,8 @@ dependencies = [
"collab-folder", "collab-folder",
"collab-persistence", "collab-persistence",
"collab-plugins", "collab-plugins",
"parking_lot 0.12.1", "futures",
"parking_lot",
"serde", "serde",
"serde_json", "serde_json",
"tracing", "tracing",
@ -611,12 +612,13 @@ dependencies = [
[[package]] [[package]]
name = "collab" name = "collab"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"async-trait",
"bytes", "bytes",
"lib0", "lib0",
"parking_lot 0.12.1", "parking_lot",
"serde", "serde",
"serde_json", "serde_json",
"thiserror", "thiserror",
@ -626,28 +628,10 @@ dependencies = [
"yrs", "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]] [[package]]
name = "collab-database" name = "collab-database"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
@ -660,7 +644,7 @@ dependencies = [
"lazy_static", "lazy_static",
"lru", "lru",
"nanoid", "nanoid",
"parking_lot 0.12.1", "parking_lot",
"serde", "serde",
"serde_json", "serde_json",
"serde_repr", "serde_repr",
@ -676,7 +660,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-define" name = "collab-define"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"collab", "collab",
@ -688,7 +672,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-derive" name = "collab-derive"
version = "0.1.0" 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 = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -700,14 +684,14 @@ dependencies = [
[[package]] [[package]]
name = "collab-document" name = "collab-document"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"collab", "collab",
"collab-derive", "collab-derive",
"collab-persistence", "collab-persistence",
"nanoid", "nanoid",
"parking_lot 0.12.1", "parking_lot",
"serde", "serde",
"serde_json", "serde_json",
"thiserror", "thiserror",
@ -719,14 +703,14 @@ dependencies = [
[[package]] [[package]]
name = "collab-folder" name = "collab-folder"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",
"collab", "collab",
"collab-derive", "collab-derive",
"collab-persistence", "collab-persistence",
"parking_lot 0.12.1", "parking_lot",
"serde", "serde",
"serde_json", "serde_json",
"serde_repr", "serde_repr",
@ -739,16 +723,17 @@ dependencies = [
[[package]] [[package]]
name = "collab-persistence" name = "collab-persistence"
version = "0.1.0" 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 = [ dependencies = [
"async-trait",
"bincode", "bincode",
"chrono", "chrono",
"collab",
"lazy_static", "lazy_static",
"lib0", "lib0",
"parking_lot 0.12.1", "parking_lot",
"rocksdb", "rocksdb",
"serde", "serde",
"sled",
"smallvec", "smallvec",
"thiserror", "thiserror",
"tokio", "tokio",
@ -759,17 +744,17 @@ dependencies = [
[[package]] [[package]]
name = "collab-plugins" name = "collab-plugins"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
"collab", "collab",
"collab-client-ws",
"collab-define", "collab-define",
"collab-persistence", "collab-persistence",
"collab-sync", "collab-sync",
"collab-ws",
"futures-util", "futures-util",
"parking_lot 0.12.1", "parking_lot",
"rand 0.8.5", "rand 0.8.5",
"serde", "serde",
"serde_json", "serde_json",
@ -787,14 +772,14 @@ dependencies = [
[[package]] [[package]]
name = "collab-sync" name = "collab-sync"
version = "0.1.0" 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 = [ dependencies = [
"bytes", "bytes",
"collab", "collab",
"futures-util", "futures-util",
"lib0", "lib0",
"md5", "md5",
"parking_lot 0.12.1", "parking_lot",
"serde", "serde",
"serde_json", "serde_json",
"thiserror", "thiserror",
@ -809,12 +794,12 @@ dependencies = [
[[package]] [[package]]
name = "collab-user" name = "collab-user"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"collab", "collab",
"collab-define", "collab-define",
"parking_lot 0.12.1", "parking_lot",
"serde", "serde",
"serde_json", "serde_json",
"tokio", "tokio",
@ -822,6 +807,24 @@ dependencies = [
"tracing", "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]] [[package]]
name = "config" name = "config"
version = "0.10.1" version = "0.10.1"
@ -1072,7 +1075,7 @@ dependencies = [
"lazy_static", "lazy_static",
"lib-dispatch", "lib-dispatch",
"log", "log",
"parking_lot 0.12.1", "parking_lot",
"protobuf", "protobuf",
"serde", "serde",
"serde_json", "serde_json",
@ -1090,7 +1093,7 @@ dependencies = [
"hashbrown 0.12.3", "hashbrown 0.12.3",
"lock_api", "lock_api",
"once_cell", "once_cell",
"parking_lot_core 0.9.7", "parking_lot_core",
] ]
[[package]] [[package]]
@ -1367,7 +1370,7 @@ dependencies = [
"lib-dispatch", "lib-dispatch",
"lib-infra", "lib-infra",
"lib-log", "lib-log",
"parking_lot 0.12.1", "parking_lot",
"serde", "serde",
"serde_json", "serde_json",
"serde_repr", "serde_repr",
@ -1415,7 +1418,7 @@ dependencies = [
"lib-dispatch", "lib-dispatch",
"lib-infra", "lib-infra",
"nanoid", "nanoid",
"parking_lot 0.12.1", "parking_lot",
"protobuf", "protobuf",
"rayon", "rayon",
"rust_decimal", "rust_decimal",
@ -1475,7 +1478,7 @@ dependencies = [
"lib-dispatch", "lib-dispatch",
"lib-infra", "lib-infra",
"nanoid", "nanoid",
"parking_lot 0.12.1", "parking_lot",
"protobuf", "protobuf",
"serde", "serde",
"serde_json", "serde_json",
@ -1556,7 +1559,7 @@ dependencies = [
"lib-dispatch", "lib-dispatch",
"lib-infra", "lib-infra",
"nanoid", "nanoid",
"parking_lot 0.12.1", "parking_lot",
"protobuf", "protobuf",
"strum_macros 0.21.1", "strum_macros 0.21.1",
"tokio", "tokio",
@ -1619,7 +1622,7 @@ dependencies = [
"lazy_static", "lazy_static",
"lib-infra", "lib-infra",
"mime_guess", "mime_guess",
"parking_lot 0.12.1", "parking_lot",
"postgrest", "postgrest",
"reqwest", "reqwest",
"serde", "serde",
@ -1657,7 +1660,7 @@ dependencies = [
"libsqlite3-sys", "libsqlite3-sys",
"openssl", "openssl",
"openssl-sys", "openssl-sys",
"parking_lot 0.12.1", "parking_lot",
"r2d2", "r2d2",
"scheduled-thread-pool", "scheduled-thread-pool",
"serde", "serde",
@ -1726,7 +1729,7 @@ dependencies = [
"lib-dispatch", "lib-dispatch",
"lib-infra", "lib-infra",
"nanoid", "nanoid",
"parking_lot 0.12.1", "parking_lot",
"protobuf", "protobuf",
"serde", "serde",
"serde_json", "serde_json",
@ -1772,7 +1775,7 @@ dependencies = [
"log", "log",
"nanoid", "nanoid",
"once_cell", "once_cell",
"parking_lot 0.12.1", "parking_lot",
"protobuf", "protobuf",
"quickcheck", "quickcheck",
"quickcheck_macros", "quickcheck_macros",
@ -1835,16 +1838,6 @@ dependencies = [
"percent-encoding", "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]] [[package]]
name = "fuchsia-cprng" name = "fuchsia-cprng"
version = "0.1.1" version = "0.1.1"
@ -1940,15 +1933,6 @@ dependencies = [
"slab", "slab",
] ]
[[package]]
name = "fxhash"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
dependencies = [
"byteorder",
]
[[package]] [[package]]
name = "generic-array" name = "generic-array"
version = "0.14.7" version = "0.14.7"
@ -2889,17 +2873,6 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" 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]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.12.1" version = "0.12.1"
@ -2907,21 +2880,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [ dependencies = [
"lock_api", "lock_api",
"parking_lot_core 0.9.7", "parking_lot_core",
]
[[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",
] ]
[[package]] [[package]]
@ -3485,7 +3444,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93" checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93"
dependencies = [ dependencies = [
"log", "log",
"parking_lot 0.12.1", "parking_lot",
"scheduled-thread-pool", "scheduled-thread-pool",
] ]
@ -3923,7 +3882,7 @@ version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3cbc66816425a074528352f5789333ecff06ca41b36b0b0efdfbb29edc391a19" checksum = "3cbc66816425a074528352f5789333ecff06ca41b36b0b0efdfbb29edc391a19"
dependencies = [ dependencies = [
"parking_lot 0.12.1", "parking_lot",
] ]
[[package]] [[package]]
@ -4127,22 +4086,6 @@ dependencies = [
"autocfg", "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]] [[package]]
name = "slug" name = "slug"
version = "0.1.4" version = "0.1.4"
@ -4432,7 +4375,7 @@ dependencies = [
"libc", "libc",
"mio", "mio",
"num_cpus", "num_cpus",
"parking_lot 0.12.1", "parking_lot",
"pin-project-lite", "pin-project-lite",
"signal-hook-registry", "signal-hook-registry",
"socket2 0.4.9", "socket2 0.4.9",
@ -4485,7 +4428,7 @@ dependencies = [
"futures-channel", "futures-channel",
"futures-util", "futures-util",
"log", "log",
"parking_lot 0.12.1", "parking_lot",
"percent-encoding", "percent-encoding",
"phf 0.11.1", "phf 0.11.1",
"pin-project-lite", "pin-project-lite",

View File

@ -49,14 +49,14 @@ lto = false
incremental = false incremental = false
[patch.crates-io] [patch.crates-io]
collab = { 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 = "223011" } collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" }
appflowy-integrate = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } appflowy-integrate = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" }
collab-define = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "223011" } collab-define = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a6ce82" }
#collab = { path = "../AppFlowy-Collab/collab" } #collab = { path = "../AppFlowy-Collab/collab" }
#collab-folder = { path = "../AppFlowy-Collab/collab-folder" } #collab-folder = { path = "../AppFlowy-Collab/collab-folder" }

View File

@ -255,10 +255,7 @@ impl DatabaseManager {
let (field, layout_setting) = DatabaseLayoutDepsResolver::new(database, layout) let (field, layout_setting) = DatabaseLayoutDepsResolver::new(database, layout)
.resolve_deps_when_create_database_linked_view(); .resolve_deps_when_create_database_linked_view();
if let Some(field) = field { if let Some(field) = field {
params = params.with_deps_fields( params = params.with_deps_fields(vec![field], vec![default_field_settings_by_layout_map()]);
vec![field.clone()],
vec![default_field_settings_by_layout_map()],
);
} }
if let Some(layout_setting) = layout_setting { if let Some(layout_setting) = layout_setting {
params = params.with_layout_setting(layout_setting); params = params.with_layout_setting(layout_setting);

View File

@ -1422,12 +1422,12 @@ impl DatabaseViewData for DatabaseViewDataImpl {
fn get_field_settings( fn get_field_settings(
&self, &self,
view_id: &str, view_id: &str,
field_ids: &Vec<String>, field_ids: &[String],
) -> HashMap<String, FieldSettings> { ) -> HashMap<String, FieldSettings> {
let field_settings_map = self let field_settings_map = self
.database .database
.lock() .lock()
.get_field_settings(view_id, Some(&field_ids)); .get_field_settings(view_id, Some(field_ids));
field_settings_map field_settings_map
.into_iter() .into_iter()

View File

@ -126,7 +126,7 @@ pub trait DatabaseViewData: Send + Sync + 'static {
fn get_field_settings( fn get_field_settings(
&self, &self,
view_id: &str, view_id: &str,
field_ids: &Vec<String>, field_ids: &[String],
) -> HashMap<String, FieldSettings>; ) -> HashMap<String, FieldSettings>;
fn get_all_field_settings(&self, view_id: &str) -> HashMap<String, FieldSettings>; fn get_all_field_settings(&self, view_id: &str) -> HashMap<String, FieldSettings>;

View File

@ -72,7 +72,7 @@ impl DocumentManager {
if self.is_doc_exist(doc_id).unwrap_or(false) { if self.is_doc_exist(doc_id).unwrap_or(false) {
self.get_document(doc_id).await self.get_document(doc_id).await
} else { } 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 data = data.unwrap_or_else(default_document_data);
let document = Arc::new(MutexDocument::create_with_data(collab, data)?); let document = Arc::new(MutexDocument::create_with_data(collab, data)?);
Ok(document) Ok(document)
@ -92,7 +92,7 @@ impl DocumentManager {
} }
let uid = self.user.user_id()?; 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)?); 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. // 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?; updates = self.cloud_service.get_document_updates(doc_id).await?;
} }
let uid = self.user.user_id()?; 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)? Document::open(collab)?
.get_document_data() .get_document_data()
.map_err(internal_error) .map_err(internal_error)
@ -155,7 +155,7 @@ impl DocumentManager {
Ok(snapshots) Ok(snapshots)
} }
fn collab_for_document( async fn collab_for_document(
&self, &self,
uid: i64, uid: i64,
doc_id: &str, doc_id: &str,

View File

@ -144,7 +144,7 @@ where
vec![], vec![],
); );
database_with_views_collab.with_origin_transact_mut(|txn| { 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_id,
&old_user.session.user_workspace.database_views_aggregate_id, &old_user.session.user_workspace.database_views_aggregate_id,
txn, 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_to_new_id_map: &mut OldToNewIdMap,
old_user: &MigrationUser, old_user: &MigrationUser,
old_collab_r_txn: &'a W, old_collab_r_txn: &'b W,
new_user: &MigrationUser, new_user: &MigrationUser,
new_collab_w_txn: &'a W, new_collab_w_txn: &'a W,
) -> Result<(), PersistenceError> ) -> Result<(), PersistenceError>
where where
'a: 'b,
W: YrsDocAction<'a>, W: YrsDocAction<'a>,
PersistenceError: From<W::Error>, PersistenceError: From<W::Error>,
{ {
@ -203,8 +204,9 @@ where
let new_workspace_id = &new_user.session.user_workspace.id; let new_workspace_id = &new_user.session.user_workspace.id;
let old_folder_collab = Collab::new(old_uid, old_workspace_id, "phantom", vec![]); let old_folder_collab = Collab::new(old_uid, old_workspace_id, "phantom", vec![]);
old_folder_collab old_folder_collab.with_origin_transact_mut(|txn| {
.with_origin_transact_mut(|txn| old_collab_r_txn.load_doc(old_uid, old_workspace_id, 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 old_folder = Folder::open(Arc::new(MutexCollab::from_collab(old_folder_collab)), None);
let mut folder_data = old_folder let mut folder_data = old_folder
.get_folder_data() .get_folder_data()
@ -417,7 +419,7 @@ where
for object_id in object_ids { for object_id in object_ids {
let collab = Collab::new(old_user.session.user_id, object_id, "phantom", vec![]); let collab = Collab::new(old_user.session.user_id, object_id, "phantom", vec![]);
match collab.with_origin_transact_mut(|txn| { 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(_) => { Ok(_) => {
collab_by_oid.insert(object_id.clone(), collab); collab_by_oid.insert(object_id.clone(), collab);

View File

@ -175,7 +175,7 @@ fn get_collab_init_update(
let _ = collab.with_origin_transact_mut(|txn| { let _ = collab.with_origin_transact_mut(|txn| {
collab_db collab_db
.read_txn() .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; let update = collab.encode_as_update_v1().0;
if update.is_empty() { if update.is_empty() {
@ -194,7 +194,7 @@ fn get_database_init_update(
let _ = collab.with_origin_transact_mut(|txn| { let _ = collab.with_origin_transact_mut(|txn| {
collab_db collab_db
.read_txn() .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(); let row_ids = get_database_row_ids(&collab).unwrap_or_default();
@ -215,7 +215,11 @@ async fn sync_folder(
let (folder, update) = { let (folder, update) = {
let collab = Collab::new(uid, workspace_id, "phantom", vec![]); let collab = Collab::new(uid, workspace_id, "phantom", vec![]);
// Use the temporary result to short the lifetime of the TransactionMut // 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; let update = collab.encode_as_update_v1().0;
( (
MutexFolder::new(Folder::open( MutexFolder::new(Folder::open(
@ -264,7 +268,7 @@ async fn sync_database_views(
.with_origin_transact_mut(|txn| { .with_origin_transact_mut(|txn| {
collab_db collab_db
.read_txn() .read_txn()
.load_doc(uid, database_views_aggregate_id, txn) .load_doc_with_txn(uid, database_views_aggregate_id, txn)
}) })
.map(|_| { .map(|_| {
( (