feat: Stream collab objects (#4361)

* feat: stream collab object

* chore: disable snapshot
This commit is contained in:
Nathan.fooo 2024-01-12 06:26:43 +08:00 committed by GitHub
parent 032a648204
commit cd82c13753
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 235 additions and 194 deletions

View File

@ -132,16 +132,17 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.75"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
[[package]]
name = "app-error"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=284e2bf63800561c75a4eb36ce95692f3fbcca56#284e2bf63800561c75a4eb36ce95692f3fbcca56"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=79702b1ced7b4497afef4e7d42e9fed1084e33e5#79702b1ced7b4497afef4e7d42e9fed1084e33e5"
dependencies = [
"anyhow",
"bincode",
"reqwest",
"serde",
"serde_json",
@ -199,9 +200,9 @@ dependencies = [
[[package]]
name = "async-trait"
version = "0.1.74"
version = "0.1.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9"
checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9"
dependencies = [
"proc-macro2",
"quote",
@ -684,7 +685,7 @@ dependencies = [
[[package]]
name = "client-api"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=284e2bf63800561c75a4eb36ce95692f3fbcca56#284e2bf63800561c75a4eb36ce95692f3fbcca56"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=79702b1ced7b4497afef4e7d42e9fed1084e33e5#79702b1ced7b4497afef4e7d42e9fed1084e33e5"
dependencies = [
"anyhow",
"app-error",
@ -1260,7 +1261,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "database-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=284e2bf63800561c75a4eb36ce95692f3fbcca56#284e2bf63800561c75a4eb36ce95692f3fbcca56"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=79702b1ced7b4497afef4e7d42e9fed1084e33e5#79702b1ced7b4497afef4e7d42e9fed1084e33e5"
dependencies = [
"anyhow",
"app-error",
@ -2052,6 +2053,7 @@ dependencies = [
"collab",
"collab-entity",
"flowy-error",
"flowy-folder-pub",
"lib-infra",
"serde",
"serde_json",
@ -2084,9 +2086,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]]
name = "form_urlencoded"
version = "1.2.0"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652"
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
dependencies = [
"percent-encoding",
]
@ -2494,7 +2496,7 @@ dependencies = [
[[package]]
name = "gotrue"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=284e2bf63800561c75a4eb36ce95692f3fbcca56#284e2bf63800561c75a4eb36ce95692f3fbcca56"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=79702b1ced7b4497afef4e7d42e9fed1084e33e5#79702b1ced7b4497afef4e7d42e9fed1084e33e5"
dependencies = [
"anyhow",
"futures-util",
@ -2510,7 +2512,7 @@ dependencies = [
[[package]]
name = "gotrue-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=284e2bf63800561c75a4eb36ce95692f3fbcca56#284e2bf63800561c75a4eb36ce95692f3fbcca56"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=79702b1ced7b4497afef4e7d42e9fed1084e33e5#79702b1ced7b4497afef4e7d42e9fed1084e33e5"
dependencies = [
"anyhow",
"app-error",
@ -2849,6 +2851,16 @@ dependencies = [
"unicode-normalization",
]
[[package]]
name = "idna"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
dependencies = [
"unicode-bidi",
"unicode-normalization",
]
[[package]]
name = "if_chain"
version = "1.0.2"
@ -2919,7 +2931,7 @@ dependencies = [
[[package]]
name = "infra"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=284e2bf63800561c75a4eb36ce95692f3fbcca56#284e2bf63800561c75a4eb36ce95692f3fbcca56"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=79702b1ced7b4497afef4e7d42e9fed1084e33e5#79702b1ced7b4497afef4e7d42e9fed1084e33e5"
dependencies = [
"anyhow",
"reqwest",
@ -3840,9 +3852,9 @@ dependencies = [
[[package]]
name = "percent-encoding"
version = "2.3.0"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "pest"
@ -4256,9 +4268,9 @@ dependencies = [
[[package]]
name = "prost"
version = "0.12.1"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4fdd22f3b9c31b53c060df4a0613a1c7f062d4115a2b984dd15b1858f7e340d"
checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a"
dependencies = [
"bytes",
"prost-derive",
@ -4266,9 +4278,9 @@ dependencies = [
[[package]]
name = "prost-build"
version = "0.12.1"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8bdf592881d821b83d471f8af290226c8d51402259e9bb5be7f9f8bdebbb11ac"
checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2"
dependencies = [
"bytes",
"heck 0.4.1",
@ -4288,9 +4300,9 @@ dependencies = [
[[package]]
name = "prost-derive"
version = "0.12.1"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32"
checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e"
dependencies = [
"anyhow",
"itertools",
@ -4301,9 +4313,9 @@ dependencies = [
[[package]]
name = "prost-types"
version = "0.12.1"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e081b29f63d83a4bc75cfc9f3fe424f9156cf92d8a4f0c9407cce9a1b67327cf"
checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e"
dependencies = [
"prost",
]
@ -4578,7 +4590,7 @@ dependencies = [
[[package]]
name = "realtime-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=284e2bf63800561c75a4eb36ce95692f3fbcca56#284e2bf63800561c75a4eb36ce95692f3fbcca56"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=79702b1ced7b4497afef4e7d42e9fed1084e33e5#79702b1ced7b4497afef4e7d42e9fed1084e33e5"
dependencies = [
"anyhow",
"bincode",
@ -4600,7 +4612,7 @@ dependencies = [
[[package]]
name = "realtime-protocol"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=284e2bf63800561c75a4eb36ce95692f3fbcca56#284e2bf63800561c75a4eb36ce95692f3fbcca56"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=79702b1ced7b4497afef4e7d42e9fed1084e33e5#79702b1ced7b4497afef4e7d42e9fed1084e33e5"
dependencies = [
"anyhow",
"bincode",
@ -4697,9 +4709,9 @@ dependencies = [
[[package]]
name = "reqwest"
version = "0.11.20"
version = "0.11.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1"
checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41"
dependencies = [
"base64 0.21.5",
"bytes",
@ -4728,6 +4740,7 @@ dependencies = [
"serde",
"serde_json",
"serde_urlencoded",
"system-configuration",
"tokio",
"tokio-native-tls",
"tokio-rustls",
@ -5077,18 +5090,18 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.194"
version = "1.0.195"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b114498256798c94a0689e1a15fec6005dee8ac1f41de56404b67afc2a4b773"
checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.194"
version = "1.0.195"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0"
checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c"
dependencies = [
"proc-macro2",
"quote",
@ -5097,9 +5110,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.108"
version = "1.0.111"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b"
checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4"
dependencies = [
"itoa 1.0.6",
"ryu",
@ -5247,7 +5260,7 @@ dependencies = [
[[package]]
name = "shared_entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=284e2bf63800561c75a4eb36ce95692f3fbcca56#284e2bf63800561c75a4eb36ce95692f3fbcca56"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=79702b1ced7b4497afef4e7d42e9fed1084e33e5#79702b1ced7b4497afef4e7d42e9fed1084e33e5"
dependencies = [
"anyhow",
"app-error",
@ -5523,6 +5536,27 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "system-configuration"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7"
dependencies = [
"bitflags 1.3.2",
"core-foundation",
"system-configuration-sys",
]
[[package]]
name = "system-configuration-sys"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "system-deps"
version = "5.0.0"
@ -5882,18 +5916,18 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c"
[[package]]
name = "thiserror"
version = "1.0.48"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7"
checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.48"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35"
checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471"
dependencies = [
"proc-macro2",
"quote",
@ -5964,9 +5998,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
version = "1.34.0"
version = "1.35.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9"
checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
dependencies = [
"backtrace",
"bytes",
@ -6418,12 +6452,12 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]]
name = "url"
version = "2.4.1"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5"
checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
dependencies = [
"form_urlencoded",
"idna 0.4.0",
"idna 0.5.0",
"percent-encoding",
"serde",
]
@ -6436,9 +6470,9 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
[[package]]
name = "uuid"
version = "1.5.0"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc"
checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560"
dependencies = [
"getrandom 0.2.10",
"serde",
@ -7030,7 +7064,7 @@ dependencies = [
[[package]]
name = "workspace-template"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=284e2bf63800561c75a4eb36ce95692f3fbcca56#284e2bf63800561c75a4eb36ce95692f3fbcca56"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=79702b1ced7b4497afef4e7d42e9fed1084e33e5#79702b1ced7b4497afef4e7d42e9fed1084e33e5"
dependencies = [
"anyhow",
"async-trait",
@ -7126,9 +7160,9 @@ dependencies = [
[[package]]
name = "yrs"
version = "0.17.1"
version = "0.17.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86f2fbea97ed32722d4f09fcf1aace9daf36e8b2e72b1f605d5a1bee575fa0da"
checksum = "68aea14c6c33f2edd8a5ff9415360cfa5b98d90cce30c5ee3be59a8419fb15a9"
dependencies = [
"atomic_refcell",
"rand 0.7.3",

View File

@ -57,7 +57,7 @@ custom-protocol = ["tauri/custom-protocol"]
# Run the script:
# scripts/tool/update_client_api_rev.sh new_rev_id
# ⚠️⚠️⚠️️
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "284e2bf63800561c75a4eb36ce95692f3fbcca56" }
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "79702b1ced7b4497afef4e7d42e9fed1084e33e5" }
# Please use the following script to update collab.
# Working directory: frontend
#

View File

@ -133,16 +133,17 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.75"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
[[package]]
name = "app-error"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=284e2bf63800561c75a4eb36ce95692f3fbcca56#284e2bf63800561c75a4eb36ce95692f3fbcca56"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=79702b1ced7b4497afef4e7d42e9fed1084e33e5#79702b1ced7b4497afef4e7d42e9fed1084e33e5"
dependencies = [
"anyhow",
"bincode",
"reqwest",
"serde",
"serde_json",
@ -225,9 +226,9 @@ dependencies = [
[[package]]
name = "async-trait"
version = "0.1.74"
version = "0.1.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9"
checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9"
dependencies = [
"proc-macro2",
"quote",
@ -657,7 +658,7 @@ dependencies = [
[[package]]
name = "client-api"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=284e2bf63800561c75a4eb36ce95692f3fbcca56#284e2bf63800561c75a4eb36ce95692f3fbcca56"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=79702b1ced7b4497afef4e7d42e9fed1084e33e5#79702b1ced7b4497afef4e7d42e9fed1084e33e5"
dependencies = [
"anyhow",
"app-error",
@ -1193,7 +1194,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "database-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=284e2bf63800561c75a4eb36ce95692f3fbcca56#284e2bf63800561c75a4eb36ce95692f3fbcca56"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=79702b1ced7b4497afef4e7d42e9fed1084e33e5#79702b1ced7b4497afef4e7d42e9fed1084e33e5"
dependencies = [
"anyhow",
"app-error",
@ -2060,6 +2061,7 @@ dependencies = [
"collab",
"collab-entity",
"flowy-error",
"flowy-folder-pub",
"lib-infra",
"serde",
"serde_json",
@ -2092,9 +2094,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]]
name = "form_urlencoded"
version = "1.2.0"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652"
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
dependencies = [
"percent-encoding",
]
@ -2329,7 +2331,7 @@ dependencies = [
[[package]]
name = "gotrue"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=284e2bf63800561c75a4eb36ce95692f3fbcca56#284e2bf63800561c75a4eb36ce95692f3fbcca56"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=79702b1ced7b4497afef4e7d42e9fed1084e33e5#79702b1ced7b4497afef4e7d42e9fed1084e33e5"
dependencies = [
"anyhow",
"futures-util",
@ -2345,7 +2347,7 @@ dependencies = [
[[package]]
name = "gotrue-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=284e2bf63800561c75a4eb36ce95692f3fbcca56#284e2bf63800561c75a4eb36ce95692f3fbcca56"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=79702b1ced7b4497afef4e7d42e9fed1084e33e5#79702b1ced7b4497afef4e7d42e9fed1084e33e5"
dependencies = [
"anyhow",
"app-error",
@ -2646,6 +2648,16 @@ dependencies = [
"unicode-normalization",
]
[[package]]
name = "idna"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
dependencies = [
"unicode-bidi",
"unicode-normalization",
]
[[package]]
name = "if_chain"
version = "1.0.2"
@ -2693,7 +2705,7 @@ dependencies = [
[[package]]
name = "infra"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=284e2bf63800561c75a4eb36ce95692f3fbcca56#284e2bf63800561c75a4eb36ce95692f3fbcca56"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=79702b1ced7b4497afef4e7d42e9fed1084e33e5#79702b1ced7b4497afef4e7d42e9fed1084e33e5"
dependencies = [
"anyhow",
"reqwest",
@ -3345,9 +3357,9 @@ dependencies = [
[[package]]
name = "percent-encoding"
version = "2.3.0"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "pest"
@ -3698,9 +3710,9 @@ dependencies = [
[[package]]
name = "prost"
version = "0.12.1"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4fdd22f3b9c31b53c060df4a0613a1c7f062d4115a2b984dd15b1858f7e340d"
checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a"
dependencies = [
"bytes",
"prost-derive",
@ -3708,9 +3720,9 @@ dependencies = [
[[package]]
name = "prost-build"
version = "0.12.1"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8bdf592881d821b83d471f8af290226c8d51402259e9bb5be7f9f8bdebbb11ac"
checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2"
dependencies = [
"bytes",
"heck 0.4.1",
@ -3730,9 +3742,9 @@ dependencies = [
[[package]]
name = "prost-derive"
version = "0.12.1"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32"
checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e"
dependencies = [
"anyhow",
"itertools",
@ -3743,9 +3755,9 @@ dependencies = [
[[package]]
name = "prost-types"
version = "0.12.1"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e081b29f63d83a4bc75cfc9f3fe424f9156cf92d8a4f0c9407cce9a1b67327cf"
checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e"
dependencies = [
"prost",
]
@ -4064,7 +4076,7 @@ dependencies = [
[[package]]
name = "realtime-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=284e2bf63800561c75a4eb36ce95692f3fbcca56#284e2bf63800561c75a4eb36ce95692f3fbcca56"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=79702b1ced7b4497afef4e7d42e9fed1084e33e5#79702b1ced7b4497afef4e7d42e9fed1084e33e5"
dependencies = [
"anyhow",
"bincode",
@ -4086,7 +4098,7 @@ dependencies = [
[[package]]
name = "realtime-protocol"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=284e2bf63800561c75a4eb36ce95692f3fbcca56#284e2bf63800561c75a4eb36ce95692f3fbcca56"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=79702b1ced7b4497afef4e7d42e9fed1084e33e5#79702b1ced7b4497afef4e7d42e9fed1084e33e5"
dependencies = [
"anyhow",
"bincode",
@ -4184,9 +4196,9 @@ dependencies = [
[[package]]
name = "reqwest"
version = "0.11.20"
version = "0.11.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1"
checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41"
dependencies = [
"base64 0.21.5",
"bytes",
@ -4216,6 +4228,7 @@ dependencies = [
"serde",
"serde_json",
"serde_urlencoded",
"system-configuration",
"tokio",
"tokio-native-tls",
"tokio-rustls",
@ -4541,18 +4554,18 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.194"
version = "1.0.195"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b114498256798c94a0689e1a15fec6005dee8ac1f41de56404b67afc2a4b773"
checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.194"
version = "1.0.195"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0"
checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c"
dependencies = [
"proc-macro2",
"quote",
@ -4561,9 +4574,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.108"
version = "1.0.111"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b"
checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4"
dependencies = [
"itoa",
"ryu",
@ -4664,7 +4677,7 @@ dependencies = [
[[package]]
name = "shared_entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=284e2bf63800561c75a4eb36ce95692f3fbcca56#284e2bf63800561c75a4eb36ce95692f3fbcca56"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=79702b1ced7b4497afef4e7d42e9fed1084e33e5#79702b1ced7b4497afef4e7d42e9fed1084e33e5"
dependencies = [
"anyhow",
"app-error",
@ -4904,6 +4917,27 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
[[package]]
name = "system-configuration"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7"
dependencies = [
"bitflags 1.3.2",
"core-foundation",
"system-configuration-sys",
]
[[package]]
name = "system-configuration-sys"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "tap"
version = "1.0.1"
@ -4987,18 +5021,18 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.48"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7"
checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.48"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35"
checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471"
dependencies = [
"proc-macro2",
"quote",
@ -5071,9 +5105,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
version = "1.34.0"
version = "1.35.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9"
checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
dependencies = [
"backtrace",
"bytes",
@ -5600,12 +5634,12 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]]
name = "url"
version = "2.4.1"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5"
checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
dependencies = [
"form_urlencoded",
"idna 0.4.0",
"idna 0.5.0",
"percent-encoding",
]
@ -5617,9 +5651,9 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
[[package]]
name = "uuid"
version = "1.5.0"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc"
checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560"
dependencies = [
"getrandom 0.2.10",
"serde",
@ -5962,7 +5996,7 @@ dependencies = [
[[package]]
name = "workspace-template"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=284e2bf63800561c75a4eb36ce95692f3fbcca56#284e2bf63800561c75a4eb36ce95692f3fbcca56"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=79702b1ced7b4497afef4e7d42e9fed1084e33e5#79702b1ced7b4497afef4e7d42e9fed1084e33e5"
dependencies = [
"anyhow",
"async-trait",
@ -5990,9 +6024,9 @@ dependencies = [
[[package]]
name = "yrs"
version = "0.17.1"
version = "0.17.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86f2fbea97ed32722d4f09fcf1aace9daf36e8b2e72b1f605d5a1bee575fa0da"
checksum = "68aea14c6c33f2edd8a5ff9415360cfa5b98d90cce30c5ee3be59a8419fb15a9"
dependencies = [
"atomic_refcell",
"rand 0.7.3",

View File

@ -105,7 +105,7 @@ incremental = false
# Run the script:
# scripts/tool/update_client_api_rev.sh new_rev_id
# ⚠️⚠️⚠️️
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "284e2bf63800561c75a4eb36ce95692f3fbcca56" }
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "79702b1ced7b4497afef4e7d42e9fed1084e33e5" }
# Please use the following script to update collab.
# Working directory: frontend
#

View File

@ -233,7 +233,7 @@ impl AppFlowyCollabBuilder {
object_type.clone(),
collab_db.clone(),
persistence_config.clone(),
self.snapshot_persistence.lock().as_ref().map(Arc::clone),
None,
))
.with_device_id(self.device_id.clone())
.build()?,

View File

@ -28,15 +28,8 @@ impl AppFlowyDartConfiguration {
pub fn write_env(&self) {
self.authenticator_type.write_env();
match self.authenticator_type {
AuthenticatorType::AppFlowyCloud => {
self.appflowy_cloud_config.write_env();
},
AuthenticatorType::Supabase => {
self.supabase_config.write_env();
},
_ => {},
}
self.appflowy_cloud_config.write_env();
self.supabase_config.write_env();
for (k, v) in self.envs.iter() {
std::env::set_var(k, v);

View File

@ -1,2 +1,2 @@
mod edit_test;
mod snapshot_test;
// mod snapshot_test;

View File

@ -1,3 +1,4 @@
pub mod cloud;
pub mod entities;
pub mod folder_builder;
mod folder_service;

View File

@ -1,9 +1,7 @@
use bytes::Bytes;
use tokio::fs::File;
use tokio::io::AsyncReadExt;
use flowy_error::FlowyError;
use flowy_storage::{FileStorageService, ObjectValue, StorageObject};
use flowy_storage::{FileStorageService, StorageObject};
use lib_infra::future::FutureResult;
use crate::af_cloud::AFServer;
@ -20,43 +18,15 @@ impl<T> FileStorageService for AFCloudFileStorageServiceImpl<T>
where
T: AFServer,
{
fn create_object(&self, object: StorageObject) -> FutureResult<String, FlowyError> {
let try_get_client = self.0.try_get_client();
FutureResult::new(async move {
let client = try_get_client?;
match object.value {
ObjectValue::File { file_path } => {
let mut file = File::open(&file_path).await?;
let mime = mime_guess::from_path(file_path)
.first_or_octet_stream()
.to_string();
let mut buffer = Vec::new();
file.read_to_end(&mut buffer).await?;
Ok(client.put_blob(&object.workspace_id, buffer, mime).await?)
},
ObjectValue::Bytes { bytes, mime } => {
Ok(client.put_blob(&object.workspace_id, bytes, mime).await?)
},
}
})
fn create_object(&self, _object: StorageObject) -> FutureResult<String, FlowyError> {
FutureResult::new(async move { Err(FlowyError::not_support()) })
}
fn delete_object_by_url(&self, object_url: String) -> FutureResult<(), FlowyError> {
let try_get_client = self.0.try_get_client();
FutureResult::new(async move {
let client = try_get_client?;
client.delete_blob(&object_url).await?;
Ok(())
})
fn delete_object_by_url(&self, _object_url: String) -> FutureResult<(), FlowyError> {
FutureResult::new(async move { Err(FlowyError::not_support()) })
}
fn get_object_by_url(&self, object_url: String) -> FutureResult<Bytes, FlowyError> {
let try_get_client = self.0.try_get_client();
FutureResult::new(async move {
let client = try_get_client?;
let bytes = client.get_blob(&object_url).await?;
Ok(bytes)
})
fn get_object_by_url(&self, _object_url: String) -> FutureResult<Bytes, FlowyError> {
FutureResult::new(async move { Err(FlowyError::not_support()) })
}
}

View File

@ -134,7 +134,7 @@ where
})
.collect::<Vec<_>>();
try_get_client?
.batch_create_collab(&workspace_id, params)
.create_collab_list(&workspace_id, params)
.await
.map_err(FlowyError::from)?;
Ok(())

View File

@ -273,7 +273,7 @@ where
})
.collect::<Vec<_>>();
try_get_client?
.batch_create_collab(&workspace_id, params)
.create_collab_list(&workspace_id, params)
.await
.map_err(FlowyError::from)?;
Ok(())

View File

@ -17,4 +17,5 @@ serde_repr.workspace = true
chrono = { workspace = true, default-features = false, features = ["clock", "serde"] }
anyhow.workspace = true
tokio = { workspace = true, features = ["sync"] }
tokio-stream = "0.1.14"
tokio-stream = "0.1.14"
flowy-folder-pub.workspace = true

View File

@ -18,7 +18,6 @@ use tracing::info;
use collab_integrate::{CollabKVAction, CollabKVDB, PersistenceError};
use flowy_error::{ErrorCode, FlowyError, FlowyResult};
use flowy_folder_pub::cloud::gen_view_id;
use flowy_user_pub::entities::Authenticator;
use crate::migrations::MigrationUser;
@ -29,7 +28,6 @@ pub fn migration_anon_user_on_sign_up(
old_collab_db: &Arc<CollabKVDB>,
new_user: &MigrationUser,
new_collab_db: &Arc<CollabKVDB>,
authenticator: &Authenticator,
) -> FlowyResult<()> {
new_collab_db
.with_write_txn(|new_collab_w_txn| {
@ -75,7 +73,6 @@ pub fn migration_anon_user_on_sign_up(
&old_collab_r_txn,
new_user,
new_collab_w_txn,
authenticator,
)?;
// Migrate other collab objects
@ -198,7 +195,6 @@ fn migrate_workspace_folder<'a, 'b, W, R>(
old_collab_r_txn: &R,
new_user: &MigrationUser,
new_collab_w_txn: &W,
_authenticator: &Authenticator,
) -> Result<(), PersistenceError>
where
'a: 'b,

View File

@ -0,0 +1,47 @@
use crate::migrations::MigrationUser;
use crate::services::data_import::importer::import_data;
use crate::services::data_import::{
import_appflowy_data_folder, upload_imported_data, ImportContext,
};
use collab_integrate::CollabKVDB;
use flowy_error::{internal_error, ErrorCode, FlowyError, FlowyResult};
use flowy_user_deps::cloud::UserCloudService;
use std::sync::Arc;
#[allow(dead_code)]
pub async fn migration_anon_user_on_appflowy_cloud_sign_up(
old_user: &MigrationUser,
old_collab_db: &Arc<CollabKVDB>,
new_user: &MigrationUser,
new_collab_db: &Arc<CollabKVDB>,
user_cloud_service: Arc<dyn UserCloudService>,
) -> FlowyResult<()> {
let import_context = ImportContext {
imported_session: old_user.session.clone(),
imported_collab_db: old_collab_db.clone(),
container_name: None,
};
let cloned_new_collab_db = new_collab_db.clone();
let import_data = tokio::task::spawn_blocking(move || {
import_appflowy_data_folder(
&new_user.session,
&new_user.session.user_workspace.id,
&cloned_new_collab_db,
import_context,
)
})
.await
.map_err(internal_error)??;
upload_imported_data(
new_user.session.user_id,
new_collab_db.clone(),
&new_user.session.user_workspace.id,
&new_user.user_profile.authenticator,
&import_data,
user_cloud_service,
)
.await?;
Ok(())
}

View File

@ -3,5 +3,6 @@ pub use sync_af_user_collab::*;
pub use sync_supabase_user_collab::*;
mod migrate_anon_user_collab;
// mod migrate_anon_user_to_appflowy_cloud;
mod sync_af_user_collab;
mod sync_supabase_user_collab;

View File

@ -172,7 +172,7 @@ pub(crate) fn import_appflowy_data_folder(
let new_object_id = old_to_new_id_map.lock().renew_id(object_id);
document_object_ids.lock().insert(new_object_id.clone());
debug!("import from: {}, to: {}", object_id, new_object_id,);
import_collab_object(
write_collab_object(
imported_collab,
session.user_id,
&new_object_id,
@ -353,7 +353,7 @@ where
"migrate database from: {}, to: {}",
object_id, new_object_id,
);
import_collab_object(
write_collab_object(
database_collab,
session.user_id,
&new_object_id,
@ -377,7 +377,7 @@ where
mut_row_with_collab(imported_collab, |row_update| {
row_update.set_row_id(RowId::from(new_row_id.clone()));
});
import_collab_object(
write_collab_object(
imported_collab,
session.user_id,
&new_row_id,
@ -400,7 +400,7 @@ where
Ok(())
}
fn import_collab_object<'a, W>(collab: &Collab, new_uid: i64, new_object_id: &str, w_txn: &'a W)
fn write_collab_object<'a, W>(collab: &Collab, new_uid: i64, new_object_id: &str, w_txn: &'a W)
where
W: CollabKVAction<'a>,
PersistenceError: From<W::Error>,
@ -443,7 +443,7 @@ where
PersistenceError: From<W::Error>,
{
let collab = Collab::new_with_doc_state(CollabOrigin::Empty, new_object_id, doc_state, vec![])?;
import_collab_object(&collab, new_uid, new_object_id, w_txn);
write_collab_object(&collab, new_uid, new_object_id, w_txn);
Ok(())
}
@ -661,31 +661,9 @@ pub async fn upload_imported_data(
// Upload
let mut size_counter = 0;
let mut objects: Vec<UserCollabParams> = vec![];
let upload_size_limit = 4 * 1024 * 1024;
for (collab_type, encoded_collab_by_oid) in object_by_collab_type {
info!(
"Batch import collab:{} ids: {:?}",
collab_type,
encoded_collab_by_oid.keys(),
);
for (oid, encoded_collab) in encoded_collab_by_oid {
let obj_size = encoded_collab.len();
// When the limit is exceeded, batch create with the current list of objects
// and reset for the next batch.
if size_counter + obj_size > upload_size_limit && !objects.is_empty() {
batch_create(
uid,
workspace_id,
&user_cloud_service,
&size_counter,
objects,
)
.await;
objects = Vec::new();
size_counter = 0;
}
// Add the current object to the batch.
objects.push(UserCollabParams {
object_id: oid,
@ -696,7 +674,6 @@ pub async fn upload_imported_data(
}
}
// After the loop, upload any remaining objects.
if !objects.is_empty() {
batch_create(
uid,
@ -717,14 +694,6 @@ async fn batch_create(
size_counter: &usize,
objects: Vec<UserCollabParams>,
) {
if objects.len() == 1 && size_counter > &(4 * 1024 * 1024) {
info!(
"Skip upload collab object: {}, payload size: {}",
objects[0].object_id, size_counter
);
return;
}
let ids = objects
.iter()
.map(|o| o.object_id.clone())

View File

@ -771,16 +771,10 @@ impl UserManager {
) -> Result<(), FlowyError> {
let old_collab_db = self.database.get_collab_db(old_user.session.user_id)?;
let new_collab_db = self.database.get_collab_db(new_user.session.user_id)?;
migration_anon_user_on_sign_up(
old_user,
&old_collab_db,
new_user,
&new_collab_db,
authenticator,
)?;
match authenticator {
Authenticator::Supabase => {
migration_anon_user_on_sign_up(old_user, &old_collab_db, new_user, &new_collab_db)?;
if let Err(err) = sync_supabase_user_data_to_cloud(
self.cloud_services.get_user_service()?,
&self.user_config.device_id,
@ -793,6 +787,7 @@ impl UserManager {
}
},
Authenticator::AppFlowyCloud => {
migration_anon_user_on_sign_up(old_user, &old_collab_db, new_user, &new_collab_db)?;
if let Err(err) = sync_af_user_data_to_cloud(
self.cloud_services.get_user_service()?,
&self.user_config.device_id,