chore: Collab wasm build (#4297)

* fix: ci

* fix: ci

* fix: build

* chore: bump collab
This commit is contained in:
Nathan.fooo 2024-01-05 00:05:38 +08:00 committed by GitHub
parent eac878d563
commit 5a87229fe9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 308 additions and 381 deletions

View File

@ -193,7 +193,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -204,7 +204,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -352,7 +352,7 @@ dependencies = [
"regex",
"rustc-hash",
"shlex",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -831,7 +831,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=b036feb396aa6a1dbbab9589bd032e29db8ab024#b036feb396aa6a1dbbab9589bd032e29db8ab024"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c425595182ef5a43913484a775fae6f59fe9e52#5c425595182ef5a43913484a775fae6f59fe9e52"
dependencies = [
"anyhow",
"async-trait",
@ -851,15 +851,13 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=b036feb396aa6a1dbbab9589bd032e29db8ab024#b036feb396aa6a1dbbab9589bd032e29db8ab024"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c425595182ef5a43913484a775fae6f59fe9e52#5c425595182ef5a43913484a775fae6f59fe9e52"
dependencies = [
"anyhow",
"async-trait",
"base64 0.21.5",
"chrono",
"collab",
"collab-entity",
"collab-persistence",
"collab-plugins",
"lazy_static",
"lru",
@ -880,11 +878,10 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=b036feb396aa6a1dbbab9589bd032e29db8ab024#b036feb396aa6a1dbbab9589bd032e29db8ab024"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c425595182ef5a43913484a775fae6f59fe9e52#5c425595182ef5a43913484a775fae6f59fe9e52"
dependencies = [
"anyhow",
"collab",
"collab-persistence",
"nanoid",
"parking_lot",
"serde",
@ -898,7 +895,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=b036feb396aa6a1dbbab9589bd032e29db8ab024#b036feb396aa6a1dbbab9589bd032e29db8ab024"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c425595182ef5a43913484a775fae6f59fe9e52#5c425595182ef5a43913484a775fae6f59fe9e52"
dependencies = [
"anyhow",
"bytes",
@ -912,12 +909,11 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=b036feb396aa6a1dbbab9589bd032e29db8ab024#b036feb396aa6a1dbbab9589bd032e29db8ab024"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c425595182ef5a43913484a775fae6f59fe9e52#5c425595182ef5a43913484a775fae6f59fe9e52"
dependencies = [
"anyhow",
"chrono",
"collab",
"collab-persistence",
"parking_lot",
"serde",
"serde_json",
@ -936,7 +932,6 @@ dependencies = [
"async-trait",
"collab",
"collab-entity",
"collab-persistence",
"collab-plugins",
"lib-infra",
"parking_lot",
@ -947,43 +942,26 @@ dependencies = [
]
[[package]]
name = "collab-persistence"
name = "collab-plugins"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=b036feb396aa6a1dbbab9589bd032e29db8ab024#b036feb396aa6a1dbbab9589bd032e29db8ab024"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c425595182ef5a43913484a775fae6f59fe9e52#5c425595182ef5a43913484a775fae6f59fe9e52"
dependencies = [
"anyhow",
"async-trait",
"bincode",
"bytes",
"chrono",
"collab",
"collab-entity",
"futures-util",
"lazy_static",
"parking_lot",
"rocksdb",
"serde",
"smallvec",
"thiserror",
"tokio",
"tracing",
"yrs",
]
[[package]]
name = "collab-plugins"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=b036feb396aa6a1dbbab9589bd032e29db8ab024#b036feb396aa6a1dbbab9589bd032e29db8ab024"
dependencies = [
"anyhow",
"async-trait",
"bytes",
"collab",
"collab-entity",
"collab-persistence",
"futures-util",
"parking_lot",
"rand 0.8.5",
"rocksdb",
"serde",
"serde_json",
"similar 2.2.1",
"smallvec",
"thiserror",
"tokio",
"tokio-retry",
@ -996,7 +974,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=b036feb396aa6a1dbbab9589bd032e29db8ab024#b036feb396aa6a1dbbab9589bd032e29db8ab024"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c425595182ef5a43913484a775fae6f59fe9e52#5c425595182ef5a43913484a775fae6f59fe9e52"
dependencies = [
"anyhow",
"collab",
@ -1243,7 +1221,7 @@ dependencies = [
"cssparser-macros",
"dtoa-short",
"itoa 1.0.6",
"phf 0.11.2",
"phf 0.8.0",
"smallvec",
]
@ -1254,7 +1232,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331"
dependencies = [
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -1318,7 +1296,7 @@ dependencies = [
"proc-macro2",
"quote",
"strsim",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -1329,7 +1307,7 @@ checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a"
dependencies = [
"darling_core",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -1433,7 +1411,7 @@ dependencies = [
"diesel_table_macro_syntax",
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -1453,7 +1431,7 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5"
dependencies = [
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -1972,7 +1950,7 @@ dependencies = [
"client-api",
"collab-database",
"collab-document",
"collab-persistence",
"collab-plugins",
"fancy-regex 0.11.0",
"flowy-codegen",
"flowy-derive",
@ -2322,7 +2300,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -3895,7 +3873,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -4105,7 +4083,7 @@ dependencies = [
"pest_meta",
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -4157,7 +4135,6 @@ version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
dependencies = [
"phf_macros 0.11.2",
"phf_shared 0.11.2",
]
@ -4249,19 +4226,6 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "phf_macros"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b"
dependencies = [
"phf_generator 0.11.2",
"phf_shared 0.11.2",
"proc-macro2",
"quote",
"syn 2.0.46",
]
[[package]]
name = "phf_shared"
version = "0.8.0"
@ -4307,7 +4271,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -4424,7 +4388,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9825a04601d60621feed79c4e6b56d65db77cdca55cef43b46b0de1096d1c282"
dependencies = [
"proc-macro2",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -4478,9 +4442,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"
[[package]]
name = "proc-macro2"
version = "1.0.74"
version = "1.0.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2de98502f212cfcea8d0bb305bd0f49d7ebdd75b64ba0a68f937d888f4e0d6db"
checksum = "907a61bd0f64c2f29cd1cf1dc34d05176426a3f504a78010f08416ddb7b13708"
dependencies = [
"unicode-ident",
]
@ -4503,7 +4467,7 @@ checksum = "8bdf592881d821b83d471f8af290226c8d51402259e9bb5be7f9f8bdebbb11ac"
dependencies = [
"bytes",
"heck 0.4.1",
"itertools 0.11.0",
"itertools 0.10.5",
"log",
"multimap",
"once_cell",
@ -4512,7 +4476,7 @@ dependencies = [
"prost",
"prost-types",
"regex",
"syn 2.0.46",
"syn 2.0.47",
"tempfile",
"which",
]
@ -4524,10 +4488,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32"
dependencies = [
"anyhow",
"itertools 0.11.0",
"itertools 0.10.5",
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -5393,7 +5357,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -5415,7 +5379,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -5464,7 +5428,7 @@ dependencies = [
"darling",
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -5906,7 +5870,7 @@ dependencies = [
"proc-macro2",
"quote",
"rustversion",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -5928,9 +5892,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.46"
version = "2.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89456b690ff72fddcecf231caedbe615c59480c93358a93dfae7fc29e3ebbf0e"
checksum = "1726efe18f42ae774cc644f330953a5e7b3c3003d3edcecf18850fe9d4dd9afb"
dependencies = [
"proc-macro2",
"quote",
@ -6311,7 +6275,7 @@ checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -6403,7 +6367,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -6582,7 +6546,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -7009,7 +6973,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
"wasm-bindgen-shared",
]
@ -7043,7 +7007,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -7576,7 +7540,7 @@ checksum = "dd7e48ccf166952882ca8bd778a43502c64f33bf94c12ebe2a7f08e5a0f6689f"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]

View File

@ -67,14 +67,13 @@ client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "40d
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "b036feb396aa6a1dbbab9589bd032e29db8ab024" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "b036feb396aa6a1dbbab9589bd032e29db8ab024" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "b036feb396aa6a1dbbab9589bd032e29db8ab024" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "b036feb396aa6a1dbbab9589bd032e29db8ab024" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "b036feb396aa6a1dbbab9589bd032e29db8ab024" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "b036feb396aa6a1dbbab9589bd032e29db8ab024" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "b036feb396aa6a1dbbab9589bd032e29db8ab024" }
collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "b036feb396aa6a1dbbab9589bd032e29db8ab024" }
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c425595182ef5a43913484a775fae6f59fe9e52" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c425595182ef5a43913484a775fae6f59fe9e52" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c425595182ef5a43913484a775fae6f59fe9e52" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c425595182ef5a43913484a775fae6f59fe9e52" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c425595182ef5a43913484a775fae6f59fe9e52" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c425595182ef5a43913484a775fae6f59fe9e52" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c425595182ef5a43913484a775fae6f59fe9e52" }

View File

@ -204,7 +204,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -215,7 +215,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -413,7 +413,7 @@ dependencies = [
"regex",
"rustc-hash",
"shlex",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -736,7 +736,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=b036feb396aa6a1dbbab9589bd032e29db8ab024#b036feb396aa6a1dbbab9589bd032e29db8ab024"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c425595182ef5a43913484a775fae6f59fe9e52#5c425595182ef5a43913484a775fae6f59fe9e52"
dependencies = [
"anyhow",
"async-trait",
@ -756,15 +756,13 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=b036feb396aa6a1dbbab9589bd032e29db8ab024#b036feb396aa6a1dbbab9589bd032e29db8ab024"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c425595182ef5a43913484a775fae6f59fe9e52#5c425595182ef5a43913484a775fae6f59fe9e52"
dependencies = [
"anyhow",
"async-trait",
"base64 0.21.5",
"chrono",
"collab",
"collab-entity",
"collab-persistence",
"collab-plugins",
"lazy_static",
"lru",
@ -785,11 +783,10 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=b036feb396aa6a1dbbab9589bd032e29db8ab024#b036feb396aa6a1dbbab9589bd032e29db8ab024"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c425595182ef5a43913484a775fae6f59fe9e52#5c425595182ef5a43913484a775fae6f59fe9e52"
dependencies = [
"anyhow",
"collab",
"collab-persistence",
"nanoid",
"parking_lot",
"serde",
@ -803,7 +800,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=b036feb396aa6a1dbbab9589bd032e29db8ab024#b036feb396aa6a1dbbab9589bd032e29db8ab024"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c425595182ef5a43913484a775fae6f59fe9e52#5c425595182ef5a43913484a775fae6f59fe9e52"
dependencies = [
"anyhow",
"bytes",
@ -817,12 +814,11 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=b036feb396aa6a1dbbab9589bd032e29db8ab024#b036feb396aa6a1dbbab9589bd032e29db8ab024"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c425595182ef5a43913484a775fae6f59fe9e52#5c425595182ef5a43913484a775fae6f59fe9e52"
dependencies = [
"anyhow",
"chrono",
"collab",
"collab-persistence",
"parking_lot",
"serde",
"serde_json",
@ -841,7 +837,6 @@ dependencies = [
"async-trait",
"collab",
"collab-entity",
"collab-persistence",
"collab-plugins",
"lib-infra",
"parking_lot",
@ -852,43 +847,26 @@ dependencies = [
]
[[package]]
name = "collab-persistence"
name = "collab-plugins"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=b036feb396aa6a1dbbab9589bd032e29db8ab024#b036feb396aa6a1dbbab9589bd032e29db8ab024"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c425595182ef5a43913484a775fae6f59fe9e52#5c425595182ef5a43913484a775fae6f59fe9e52"
dependencies = [
"anyhow",
"async-trait",
"bincode",
"bytes",
"chrono",
"collab",
"collab-entity",
"futures-util",
"lazy_static",
"parking_lot",
"rocksdb",
"serde",
"smallvec",
"thiserror",
"tokio",
"tracing",
"yrs",
]
[[package]]
name = "collab-plugins"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=b036feb396aa6a1dbbab9589bd032e29db8ab024#b036feb396aa6a1dbbab9589bd032e29db8ab024"
dependencies = [
"anyhow",
"async-trait",
"bytes",
"collab",
"collab-entity",
"collab-persistence",
"futures-util",
"parking_lot",
"rand 0.8.5",
"rocksdb",
"serde",
"serde_json",
"similar 2.2.1",
"smallvec",
"thiserror",
"tokio",
"tokio-retry",
@ -901,7 +879,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=b036feb396aa6a1dbbab9589bd032e29db8ab024#b036feb396aa6a1dbbab9589bd032e29db8ab024"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5c425595182ef5a43913484a775fae6f59fe9e52#5c425595182ef5a43913484a775fae6f59fe9e52"
dependencies = [
"anyhow",
"collab",
@ -1122,7 +1100,7 @@ dependencies = [
"cssparser-macros",
"dtoa-short",
"itoa",
"phf 0.11.2",
"phf 0.8.0",
"smallvec",
]
@ -1133,7 +1111,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331"
dependencies = [
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -1367,7 +1345,7 @@ dependencies = [
"diesel_table_macro_syntax",
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -1387,7 +1365,7 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5"
dependencies = [
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -1932,7 +1910,7 @@ dependencies = [
"client-api",
"collab-database",
"collab-document",
"collab-persistence",
"collab-plugins",
"fancy-regex 0.11.0",
"flowy-codegen",
"flowy-derive",
@ -2303,7 +2281,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -3395,7 +3373,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -3575,7 +3553,7 @@ dependencies = [
"pest_meta",
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -3605,7 +3583,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"
dependencies = [
"phf_macros 0.8.0",
"phf_macros",
"phf_shared 0.8.0",
"proc-macro-hack",
]
@ -3625,7 +3603,6 @@ version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
dependencies = [
"phf_macros 0.11.2",
"phf_shared 0.11.2",
]
@ -3693,19 +3670,6 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "phf_macros"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b"
dependencies = [
"phf_generator 0.11.2",
"phf_shared 0.11.2",
"proc-macro2",
"quote",
"syn 2.0.46",
]
[[package]]
name = "phf_shared"
version = "0.8.0"
@ -3750,7 +3714,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -3840,7 +3804,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8832c0f9be7e3cae60727e6256cfd2cd3c3e2b6cd5dad4190ecb2fd658c9030b"
dependencies = [
"proc-macro2",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -3884,9 +3848,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"
[[package]]
name = "proc-macro2"
version = "1.0.74"
version = "1.0.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2de98502f212cfcea8d0bb305bd0f49d7ebdd75b64ba0a68f937d888f4e0d6db"
checksum = "907a61bd0f64c2f29cd1cf1dc34d05176426a3f504a78010f08416ddb7b13708"
dependencies = [
"unicode-ident",
]
@ -3909,7 +3873,7 @@ checksum = "8bdf592881d821b83d471f8af290226c8d51402259e9bb5be7f9f8bdebbb11ac"
dependencies = [
"bytes",
"heck 0.4.1",
"itertools 0.11.0",
"itertools 0.10.5",
"log",
"multimap",
"once_cell",
@ -3918,7 +3882,7 @@ dependencies = [
"prost",
"prost-types",
"regex",
"syn 2.0.46",
"syn 2.0.47",
"tempfile",
"which",
]
@ -3930,10 +3894,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32"
dependencies = [
"anyhow",
"itertools 0.11.0",
"itertools 0.10.5",
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -4841,7 +4805,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -4863,7 +4827,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -5265,7 +5229,7 @@ dependencies = [
"proc-macro2",
"quote",
"rustversion",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -5287,9 +5251,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.46"
version = "2.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89456b690ff72fddcecf231caedbe615c59480c93358a93dfae7fc29e3ebbf0e"
checksum = "1726efe18f42ae774cc644f330953a5e7b3c3003d3edcecf18850fe9d4dd9afb"
dependencies = [
"proc-macro2",
"quote",
@ -5400,7 +5364,7 @@ checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -5505,7 +5469,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -5739,7 +5703,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]
@ -6142,7 +6106,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
"wasm-bindgen-shared",
]
@ -6176,7 +6140,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -6424,7 +6388,7 @@ checksum = "dd7e48ccf166952882ca8bd778a43502c64f33bf94c12ebe2a7f08e5a0f6689f"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.46",
"syn 2.0.47",
]
[[package]]

View File

@ -117,11 +117,10 @@ client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "40d
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "b036feb396aa6a1dbbab9589bd032e29db8ab024" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "b036feb396aa6a1dbbab9589bd032e29db8ab024" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "b036feb396aa6a1dbbab9589bd032e29db8ab024" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "b036feb396aa6a1dbbab9589bd032e29db8ab024" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "b036feb396aa6a1dbbab9589bd032e29db8ab024" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "b036feb396aa6a1dbbab9589bd032e29db8ab024" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "b036feb396aa6a1dbbab9589bd032e29db8ab024" }
collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "b036feb396aa6a1dbbab9589bd032e29db8ab024" }
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c425595182ef5a43913484a775fae6f59fe9e52" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c425595182ef5a43913484a775fae6f59fe9e52" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c425595182ef5a43913484a775fae6f59fe9e52" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c425595182ef5a43913484a775fae6f59fe9e52" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c425595182ef5a43913484a775fae6f59fe9e52" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c425595182ef5a43913484a775fae6f59fe9e52" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5c425595182ef5a43913484a775fae6f59fe9e52" }

View File

@ -7,7 +7,6 @@ edition = "2021"
[dependencies]
collab = { version = "0.1.0" }
collab-persistence = { version = "0.1.0", features = ["rocksdb_persistence"] }
collab-plugins = { version = "0.1.0" }
collab-entity = { version = "0.1.0" }
serde.workspace = true
@ -20,8 +19,8 @@ tokio = { workspace = true, features = ["sync"]}
lib-infra = { workspace = true }
[features]
default = ["rocksdb_plugin", "snapshot_plugin"]
supabase_integrate = ["collab-plugins/postgres_storage_plugin", "rocksdb_plugin"]
default = ["rocksdb_plugin"]
supabase_integrate = ["rocksdb_plugin"]
appflowy_cloud_integrate = ["rocksdb_plugin"]
snapshot_plugin = ["collab-plugins/snapshot_plugin"]
rocksdb_plugin = ["collab-plugins/rocksdb_plugin"]
snapshot_plugin = ["rocksdb_plugin"]
rocksdb_plugin = []

View File

@ -5,14 +5,15 @@ use anyhow::Error;
use collab::core::collab::{CollabDocState, MutexCollab};
use collab::preclude::{CollabBuilder, CollabPlugin};
use collab_entity::{CollabObject, CollabType};
use collab_persistence::kv::rocks_kv::RocksCollabDB;
use collab_plugins::cloud_storage::network_state::{CollabNetworkReachability, CollabNetworkState};
use collab_plugins::local_storage::rocksdb::{RocksdbBackup, RocksdbDiskPlugin};
use collab_plugins::connect_state::{CollabConnectReachability, CollabConnectState};
use collab_plugins::local_storage::kv::snapshot::SnapshotPersistence;
use collab_plugins::local_storage::rocksdb::rocksdb_plugin::{RocksdbBackup, RocksdbDiskPlugin};
use collab_plugins::local_storage::rocksdb::snapshot_plugin::CollabSnapshotPlugin;
use collab_plugins::local_storage::CollabPersistenceConfig;
use collab_plugins::snapshot::{CollabSnapshotPlugin, SnapshotPersistence};
use parking_lot::{Mutex, RwLock};
use tracing::trace;
use crate::CollabKVDB;
use lib_infra::future::Fut;
#[derive(Clone, Debug)]
@ -33,7 +34,7 @@ pub enum CollabPluginProviderContext {
uid: i64,
collab_object: CollabObject,
local_collab: Weak<MutexCollab>,
local_collab_db: Weak<RocksCollabDB>,
local_collab_db: Weak<CollabKVDB>,
},
}
@ -83,7 +84,7 @@ where
}
pub struct AppFlowyCollabBuilder {
network_reachability: CollabNetworkReachability,
network_reachability: CollabConnectReachability,
workspace_id: RwLock<Option<String>>,
plugin_provider: tokio::sync::RwLock<Arc<dyn CollabCloudPluginProvider>>,
snapshot_persistence: Mutex<Option<Arc<dyn SnapshotPersistence>>>,
@ -111,7 +112,7 @@ impl CollabBuilderConfig {
impl AppFlowyCollabBuilder {
pub fn new<T: CollabCloudPluginProvider>(storage_provider: T, device_id: String) -> Self {
Self {
network_reachability: CollabNetworkReachability::new(),
network_reachability: CollabConnectReachability::new(),
workspace_id: Default::default(),
plugin_provider: tokio::sync::RwLock::new(Arc::new(storage_provider)),
snapshot_persistence: Default::default(),
@ -136,11 +137,11 @@ impl AppFlowyCollabBuilder {
if reachable {
self
.network_reachability
.set_state(CollabNetworkState::Connected)
.set_state(CollabConnectState::Connected)
} else {
self
.network_reachability
.set_state(CollabNetworkState::Disconnected)
.set_state(CollabConnectState::Disconnected)
}
}
@ -166,7 +167,7 @@ impl AppFlowyCollabBuilder {
///
/// This function will initiate the creation of a [MutexCollab] object if it does not already exist.
/// To check for the existence of the object prior to creation, you should utilize a transaction
/// returned by the [read_txn] method of the [RocksCollabDB]. Then, invoke the [is_exist] method
/// returned by the [read_txn] method of the [CollabKVDB]. Then, invoke the [is_exist] method
/// to confirm the object's presence.
///
/// # Parameters
@ -174,7 +175,7 @@ impl AppFlowyCollabBuilder {
/// - `object_id`: A string reference representing the ID of the object.
/// - `object_type`: The type of the collaboration, defined by the [CollabType] enum.
/// - `raw_data`: The raw data of the collaboration object, defined by the [CollabDocState] type.
/// - `collab_db`: A weak reference to the [RocksCollabDB].
/// - `collab_db`: A weak reference to the [CollabKVDB].
///
pub async fn build(
&self,
@ -182,7 +183,7 @@ impl AppFlowyCollabBuilder {
object_id: &str,
object_type: CollabType,
collab_doc_state: CollabDocState,
collab_db: Weak<RocksCollabDB>,
collab_db: Weak<CollabKVDB>,
build_config: CollabBuilderConfig,
) -> Result<Arc<MutexCollab>, Error> {
let persistence_config = CollabPersistenceConfig::default();
@ -203,7 +204,7 @@ impl AppFlowyCollabBuilder {
///
/// This function will initiate the creation of a [MutexCollab] object if it does not already exist.
/// To check for the existence of the object prior to creation, you should utilize a transaction
/// returned by the [read_txn] method of the [RocksCollabDB]. Then, invoke the [is_exist] method
/// returned by the [read_txn] method of the [CollabKVDB]. Then, invoke the [is_exist] method
/// to confirm the object's presence.
///
/// # Parameters
@ -211,7 +212,7 @@ impl AppFlowyCollabBuilder {
/// - `object_id`: A string reference representing the ID of the object.
/// - `object_type`: The type of the collaboration, defined by the [CollabType] enum.
/// - `raw_data`: The raw data of the collaboration object, defined by the [CollabDocState] type.
/// - `collab_db`: A weak reference to the [RocksCollabDB].
/// - `collab_db`: A weak reference to the [CollabKVDB].
///
#[allow(clippy::too_many_arguments)]
pub async fn build_with_config(
@ -219,7 +220,7 @@ impl AppFlowyCollabBuilder {
uid: i64,
object_id: &str,
object_type: CollabType,
collab_db: Weak<RocksCollabDB>,
collab_db: Weak<CollabKVDB>,
collab_doc_state: CollabDocState,
persistence_config: &CollabPersistenceConfig,
build_config: CollabBuilderConfig,

View File

@ -1,26 +1,20 @@
pub use collab::core::collab::MutexCollab;
pub use collab::preclude::Snapshot;
pub use collab_persistence::doc::YrsDocAction;
pub use collab_persistence::error::PersistenceError;
#[cfg(any(
feature = "appflowy_cloud_integrate",
feature = "supabase_integrate",
feature = "rocksdb_plugin"
))]
pub use collab_persistence::kv::rocks_kv::RocksCollabDB;
pub use collab_persistence::snapshot::CollabSnapshot;
#[cfg(feature = "supabase_integrate")]
pub use collab_plugins::cloud_storage::*;
#[cfg(any(
feature = "appflowy_cloud_integrate",
feature = "supabase_integrate",
feature = "rocksdb_plugin"
))]
pub use collab_plugins::local_storage::CollabPersistenceConfig;
#[cfg(feature = "snapshot_plugin")]
pub use collab_plugins::snapshot::{
calculate_snapshot_diff, try_encode_snapshot, SnapshotPersistence,
};
#[cfg(any(
feature = "appflowy_cloud_integrate",
feature = "supabase_integrate",
feature = "rocksdb_plugin"
))]
pub use collab_plugins::CollabKVDB;
pub mod collab_builder;
pub mod config;
pub use collab_plugins::local_storage::kv::doc::CollabKVAction;
pub use collab_plugins::local_storage::kv::error::PersistenceError;
pub use collab_plugins::local_storage::kv::snapshot::{CollabSnapshot, SnapshotPersistence};

View File

@ -1,7 +1,7 @@
use std::sync::{Arc, Weak};
use collab::core::collab_plugin::EncodedCollab;
use collab_plugins::local_storage::rocksdb::RocksdbBackup;
use collab_plugins::local_storage::rocksdb::rocksdb_plugin::RocksdbBackup;
use diesel::SqliteConnection;
use flowy_error::FlowyError;

View File

@ -3,7 +3,7 @@ use std::sync::{Arc, Weak};
use tokio::sync::RwLock;
use collab_integrate::collab_builder::AppFlowyCollabBuilder;
use collab_integrate::RocksCollabDB;
use collab_integrate::CollabKVDB;
use flowy_database2::{DatabaseManager, DatabaseUser};
use flowy_database_deps::cloud::DatabaseCloudService;
use flowy_error::FlowyError;
@ -47,7 +47,7 @@ impl DatabaseUser for DatabaseUserImpl {
.token()
}
fn collab_db(&self, uid: i64) -> Result<Weak<RocksCollabDB>, FlowyError> {
fn collab_db(&self, uid: i64) -> Result<Weak<CollabKVDB>, FlowyError> {
self
.0
.upgrade()

View File

@ -1,7 +1,7 @@
use std::sync::{Arc, Weak};
use collab_integrate::collab_builder::AppFlowyCollabBuilder;
use collab_integrate::RocksCollabDB;
use collab_integrate::CollabKVDB;
use flowy_database2::DatabaseManager;
use flowy_document::manager::{DocumentManager, DocumentUser};
use flowy_document_deps::cloud::DocumentCloudService;
@ -54,7 +54,7 @@ impl DocumentUser for DocumentUserImpl {
.token()
}
fn collab_db(&self, uid: i64) -> Result<Weak<RocksCollabDB>, FlowyError> {
fn collab_db(&self, uid: i64) -> Result<Weak<CollabKVDB>, FlowyError> {
self
.0
.upgrade()

View File

@ -7,7 +7,7 @@ use bytes::Bytes;
use tokio::sync::RwLock;
use collab_integrate::collab_builder::AppFlowyCollabBuilder;
use collab_integrate::RocksCollabDB;
use collab_integrate::CollabKVDB;
use flowy_database2::entities::DatabaseLayoutPB;
use flowy_database2::services::share::csv::CSVFormat;
use flowy_database2::template::{make_default_board, make_default_calendar, make_default_grid};
@ -99,7 +99,7 @@ impl FolderUser for FolderUserImpl {
.token()
}
fn collab_db(&self, uid: i64) -> Result<Weak<RocksCollabDB>, FlowyError> {
fn collab_db(&self, uid: i64) -> Result<Weak<CollabKVDB>, FlowyError> {
self
.user_manager
.upgrade()

View File

@ -22,7 +22,6 @@ pub(crate) fn create_log_filter(level: String, with_crates: Vec<String>) -> Stri
filters.push(format!("flowy_folder={}", level));
filters.push(format!("collab_sync={}", level));
filters.push(format!("collab_folder={}", level));
filters.push(format!("collab_persistence={}", level));
filters.push(format!("collab_database={}", level));
filters.push(format!("collab_plugins={}", level));
filters.push(format!("collab_integrate={}", level));

View File

@ -7,13 +7,13 @@ use collab::core::collab::CollabDocState;
use collab::core::origin::{CollabClient, CollabOrigin};
use collab::preclude::CollabPlugin;
use collab_entity::CollabType;
use collab_plugins::cloud_storage::postgres::SupabaseDBPlugin;
use tokio_stream::wrappers::WatchStream;
use tracing::{debug, instrument};
use collab_integrate::collab_builder::{
CollabCloudPluginProvider, CollabPluginProviderContext, CollabPluginProviderType,
};
use collab_integrate::postgres::SupabaseDBPlugin;
use flowy_database_deps::cloud::{CollabDocStateByOid, DatabaseCloudService, DatabaseSnapshot};
use flowy_document::deps::DocumentData;
use flowy_document_deps::cloud::{DocumentCloudService, DocumentSnapshot};

View File

@ -4,7 +4,7 @@ use std::sync::{Arc, Weak};
use collab::core::collab::{CollabDocState, MutexCollab};
use collab_database::blocks::BlockEvent;
use collab_database::database::{DatabaseData, MutexDatabase, YrsDocAction};
use collab_database::database::{DatabaseData, MutexDatabase};
use collab_database::error::DatabaseError;
use collab_database::user::{
CollabDocStateByOid, CollabFuture, DatabaseCollabService, WorkspaceDatabase,
@ -17,7 +17,7 @@ use tokio::sync::{Mutex, RwLock};
use tracing::{event, instrument, trace};
use collab_integrate::collab_builder::{AppFlowyCollabBuilder, CollabBuilderConfig};
use collab_integrate::{CollabPersistenceConfig, RocksCollabDB};
use collab_integrate::{CollabKVAction, CollabKVDB, CollabPersistenceConfig};
use flowy_database_deps::cloud::DatabaseCloudService;
use flowy_error::{internal_error, FlowyError, FlowyResult};
use flowy_task::TaskDispatcher;
@ -36,7 +36,7 @@ use crate::services::share::csv::{CSVFormat, CSVImporter, ImportResult};
pub trait DatabaseUser: Send + Sync {
fn user_id(&self) -> Result<i64, FlowyError>;
fn token(&self) -> Result<Option<String>, FlowyError>;
fn collab_db(&self, uid: i64) -> Result<Weak<RocksCollabDB>, FlowyError>;
fn collab_db(&self, uid: i64) -> Result<Weak<CollabKVDB>, FlowyError>;
}
pub struct DatabaseManager {
@ -66,7 +66,7 @@ impl DatabaseManager {
}
}
fn is_collab_exist(&self, uid: i64, collab_db: &Weak<RocksCollabDB>, object_id: &str) -> bool {
fn is_collab_exist(&self, uid: i64, collab_db: &Weak<CollabKVDB>, object_id: &str) -> bool {
match collab_db.upgrade() {
None => false,
Some(collab_db) => {
@ -459,7 +459,7 @@ impl DatabaseCollabService for UserDatabaseCollabServiceImpl {
uid: i64,
object_id: &str,
object_type: CollabType,
collab_db: Weak<RocksCollabDB>,
collab_db: Weak<CollabKVDB>,
collab_raw_data: CollabDocState,
config: &CollabPersistenceConfig,
) -> Arc<MutexCollab> {

View File

@ -9,14 +9,13 @@ use collab::preclude::Collab;
use collab_document::blocks::DocumentData;
use collab_document::document::Document;
use collab_document::document_data::default_document_data;
use collab_document::YrsDocAction;
use collab_entity::CollabType;
use lru::LruCache;
use parking_lot::Mutex;
use tracing::{event, instrument};
use collab_integrate::collab_builder::{AppFlowyCollabBuilder, CollabBuilderConfig};
use collab_integrate::RocksCollabDB;
use collab_integrate::{CollabKVAction, CollabKVDB};
use flowy_document_deps::cloud::DocumentCloudService;
use flowy_error::{internal_error, ErrorCode, FlowyError, FlowyResult};
use flowy_storage::FileStorageService;
@ -29,7 +28,7 @@ pub trait DocumentUser: Send + Sync {
fn user_id(&self) -> Result<i64, FlowyError>;
fn workspace_id(&self) -> Result<String, FlowyError>;
fn token(&self) -> Result<Option<String>, FlowyError>; // unused now.
fn collab_db(&self, uid: i64) -> Result<Weak<RocksCollabDB>, FlowyError>;
fn collab_db(&self, uid: i64) -> Result<Weak<CollabKVDB>, FlowyError>;
}
pub struct DocumentManager {

View File

@ -17,7 +17,7 @@ use collab_integrate::collab_builder::{
AppFlowyCollabBuilder, CollabCloudPluginProvider, CollabPluginProviderContext,
CollabPluginProviderType,
};
use collab_integrate::RocksCollabDB;
use collab_integrate::CollabKVDB;
use flowy_document::document::MutexDocument;
use flowy_document::manager::{DocumentManager, DocumentUser};
use flowy_document_deps::cloud::*;
@ -54,7 +54,7 @@ impl Deref for DocumentTest {
}
pub struct FakeUser {
collab_db: Arc<RocksCollabDB>,
collab_db: Arc<CollabKVDB>,
}
impl FakeUser {
@ -63,7 +63,7 @@ impl FakeUser {
let tempdir = TempDir::new().unwrap();
let path = tempdir.into_path();
let collab_db = Arc::new(RocksCollabDB::open(path).unwrap());
let collab_db = Arc::new(CollabKVDB::open(path).unwrap());
Self { collab_db }
}
@ -82,7 +82,7 @@ impl DocumentUser for FakeUser {
Ok(None)
}
fn collab_db(&self, _uid: i64) -> Result<std::sync::Weak<RocksCollabDB>, FlowyError> {
fn collab_db(&self, _uid: i64) -> Result<std::sync::Weak<CollabKVDB>, FlowyError> {
Ok(Arc::downgrade(&self.collab_db))
}
}

View File

@ -27,7 +27,7 @@ r2d2 = { version = "0.8", optional = true }
url = { version = "2.2", optional = true }
collab-database = { version = "0.1.0", optional = true }
collab-document = { version = "0.1.0", optional = true }
collab-persistence = { version = "0.1.0", optional = true }
collab-plugins = { version = "0.1.0", optional = true }
tokio-postgres = { version = "0.7.8", optional = true }
client-api = { version = "0.1.0", optional = true }
@ -37,7 +37,7 @@ impl_from_dispatch_error = ["lib-dispatch"]
impl_from_serde = []
impl_from_reqwest = ["reqwest"]
impl_from_sqlite = ["flowy-sqlite", "r2d2"]
impl_from_collab = ["collab-database", "collab-document", "impl_from_reqwest", "collab-persistence"]
impl_from_collab = ["collab-database", "collab-document", "impl_from_reqwest", "collab-plugins"]
impl_from_postgres = ["tokio-postgres"]
impl_from_url = ["url"]
impl_from_appflowy_cloud = ["client-api"]

View File

@ -1,6 +1,6 @@
use collab_database::error::DatabaseError;
use collab_document::error::DocumentError;
use collab_persistence::PersistenceError;
use collab_plugins::local_storage::kv::PersistenceError;
use crate::{ErrorCode, FlowyError};

View File

@ -11,7 +11,7 @@ use parking_lot::{Mutex, RwLock};
use tracing::{error, event, info, instrument, Level};
use collab_integrate::collab_builder::{AppFlowyCollabBuilder, CollabBuilderConfig};
use collab_integrate::{CollabPersistenceConfig, RocksCollabDB};
use collab_integrate::{CollabKVDB, CollabPersistenceConfig};
use flowy_error::{internal_error, ErrorCode, FlowyError, FlowyResult};
use flowy_folder_deps::cloud::{gen_view_id, FolderCloudService};
use flowy_folder_deps::folder_builder::ParentChildViews;
@ -40,7 +40,7 @@ use crate::view_operation::{create_view, FolderOperationHandler, FolderOperation
pub trait FolderUser: Send + Sync {
fn user_id(&self) -> Result<i64, FlowyError>;
fn token(&self) -> Result<Option<String>, FlowyError>;
fn collab_db(&self, uid: i64) -> Result<Weak<RocksCollabDB>, FlowyError>;
fn collab_db(&self, uid: i64) -> Result<Weak<CollabKVDB>, FlowyError>;
/// Import appflowy data from the given path.
/// If the container name is not empty, then the data will be imported to the given container.
@ -136,7 +136,7 @@ impl FolderManager {
&self,
uid: i64,
workspace_id: &str,
collab_db: Weak<RocksCollabDB>,
collab_db: Weak<CollabKVDB>,
collab_doc_state: CollabDocState,
) -> Result<Arc<MutexCollab>, FlowyError> {
let collab = self

View File

@ -3,7 +3,7 @@ use std::sync::{Arc, Weak};
use collab_folder::{Folder, FolderNotify, UserId};
use tracing::{event, Level};
use collab_integrate::RocksCollabDB;
use collab_integrate::CollabKVDB;
use flowy_error::{ErrorCode, FlowyError, FlowyResult};
use crate::manager::{FolderInitDataSource, FolderManager};
@ -108,7 +108,7 @@ impl FolderManager {
&self,
uid: i64,
workspace_id: &str,
collab_db: Weak<RocksCollabDB>,
collab_db: Weak<CollabKVDB>,
folder_notifier: FolderNotify,
) -> Result<Folder, FlowyError> {
event!(
@ -133,7 +133,7 @@ impl FolderManager {
&self,
uid: i64,
workspace_id: &str,
collab_db: Weak<RocksCollabDB>,
collab_db: Weak<CollabKVDB>,
folder_notifier: FolderNotify,
) -> Result<Folder, FlowyError> {
event!(Level::INFO, "Init folder from local disk");

View File

@ -1,7 +1,7 @@
use collab_folder::Folder;
use std::sync::Arc;
use collab_integrate::YrsDocAction;
use collab_integrate::CollabKVAction;
use flowy_error::{ErrorCode, FlowyError, FlowyResult};
use flowy_folder_deps::folder_builder::ParentChildViews;

View File

@ -23,7 +23,7 @@ anyhow.workspace = true
uuid.workspace = true
chrono = { workspace = true, default-features = false, features = ["clock", "serde"] }
collab = { version = "0.1.0" }
collab-plugins = { version = "0.1.0"}
collab-plugins = { version = "0.1.0", features = ["postgres_plugin"] }
collab-document = { version = "0.1.0" }
collab-entity = { version = "0.1.0" }
hex = "0.4.3"

View File

@ -15,7 +15,7 @@ use collab_folder::{Folder, UserId};
use parking_lot::{Mutex, RwLock};
use tracing::info;
use collab_integrate::{PersistenceError, RocksCollabDB, YrsDocAction};
use collab_integrate::{CollabKVAction, CollabKVDB, PersistenceError};
use flowy_error::{ErrorCode, FlowyError, FlowyResult};
use flowy_folder_deps::cloud::gen_view_id;
use flowy_user_deps::entities::Authenticator;
@ -26,9 +26,9 @@ use crate::migrations::MigrationUser;
/// the user is a local user and try to use AppFlowy cloud service.
pub fn migration_anon_user_on_sign_up(
old_user: &MigrationUser,
old_collab_db: &Arc<RocksCollabDB>,
old_collab_db: &Arc<CollabKVDB>,
new_user: &MigrationUser,
new_collab_db: &Arc<RocksCollabDB>,
new_collab_db: &Arc<CollabKVDB>,
authenticator: &Authenticator,
) -> FlowyResult<()> {
new_collab_db
@ -129,16 +129,19 @@ impl DerefMut for OldToNewIdMap {
}
}
fn migrate_database_with_views_object<'a, W>(
fn migrate_database_with_views_object<'a, 'b, W, R>(
old_to_new_id_map: &mut OldToNewIdMap,
old_user: &MigrationUser,
old_collab_r_txn: &'a W,
old_collab_r_txn: &R,
new_user: &MigrationUser,
new_collab_w_txn: &'a W,
new_collab_w_txn: &W,
) -> Result<(), PersistenceError>
where
W: YrsDocAction<'a>,
'a: 'b,
W: CollabKVAction<'a>,
R: CollabKVAction<'b>,
PersistenceError: From<W::Error>,
PersistenceError: From<R::Error>,
{
let database_with_views_collab = Collab::new(
old_user.session.user_id,
@ -180,7 +183,7 @@ where
fn migrate_collab_object<'a, W>(collab: &Collab, new_uid: i64, new_object_id: &str, w_txn: &'a W)
where
W: YrsDocAction<'a>,
W: CollabKVAction<'a>,
PersistenceError: From<W::Error>,
{
let txn = collab.transact();
@ -189,18 +192,20 @@ where
}
}
fn migrate_workspace_folder<'a, 'b, W>(
fn migrate_workspace_folder<'a, 'b, W, R>(
old_to_new_id_map: &mut OldToNewIdMap,
old_user: &MigrationUser,
old_collab_r_txn: &'b W,
old_collab_r_txn: &R,
new_user: &MigrationUser,
new_collab_w_txn: &'a W,
new_collab_w_txn: &W,
_authenticator: &Authenticator,
) -> Result<(), PersistenceError>
where
'a: 'b,
W: YrsDocAction<'a>,
W: CollabKVAction<'a>,
R: CollabKVAction<'b>,
PersistenceError: From<W::Error>,
PersistenceError: From<R::Error>,
{
let old_uid = old_user.session.user_id;
let old_workspace_id = &old_user.session.user_workspace.id;
@ -334,7 +339,7 @@ fn migrate_databases<'a, W>(
collab_by_oid: &HashMap<String, Collab>,
) -> Result<(), PersistenceError>
where
W: YrsDocAction<'a>,
W: CollabKVAction<'a>,
PersistenceError: From<W::Error>,
{
// Migrate databases
@ -438,7 +443,7 @@ fn make_collab_by_oid<'a, R>(
object_ids: &[String],
) -> HashMap<String, Collab>
where
R: YrsDocAction<'a>,
R: CollabKVAction<'a>,
PersistenceError: From<R::Error>,
{
let mut collab_by_oid = HashMap::new();

View File

@ -13,7 +13,7 @@ use collab_entity::{CollabObject, CollabType};
use collab_folder::{Folder, View, ViewLayout};
use parking_lot::Mutex;
use collab_integrate::{PersistenceError, RocksCollabDB, YrsDocAction};
use collab_integrate::{CollabKVAction, CollabKVDB, PersistenceError};
use flowy_error::FlowyResult;
use flowy_user_deps::cloud::UserCloudService;
@ -24,7 +24,7 @@ pub async fn sync_af_user_data_to_cloud(
user_service: Arc<dyn UserCloudService>,
device_id: &str,
new_user: &MigrationUser,
collab_db: &Arc<RocksCollabDB>,
collab_db: &Arc<CollabKVDB>,
) -> FlowyResult<()> {
let workspace_id = new_user.session.user_workspace.id.clone();
let uid = new_user.session.user_id;
@ -82,7 +82,7 @@ fn sync_view(
workspace_id: String,
device_id: String,
view: Arc<View>,
collab_db: Arc<RocksCollabDB>,
collab_db: Arc<CollabKVDB>,
user_service: Arc<dyn UserCloudService>,
synced_database: Arc<Mutex<Vec<String>>>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + Sync>> {
@ -215,7 +215,7 @@ fn sync_view(
fn get_collab_encode_v1(
uid: i64,
collab_object: &CollabObject,
collab_db: &Arc<RocksCollabDB>,
collab_db: &Arc<CollabKVDB>,
) -> Result<Vec<u8>, PersistenceError> {
let collab = Collab::new(uid, &collab_object.object_id, "phantom", vec![]);
let _ = collab.with_origin_transact_mut(|txn| {
@ -229,7 +229,7 @@ fn get_collab_encode_v1(
fn get_database_encode_v1(
uid: i64,
collab_object: &CollabObject,
collab_db: &Arc<RocksCollabDB>,
collab_db: &Arc<CollabKVDB>,
) -> Result<(Vec<u8>, Vec<String>), PersistenceError> {
let collab = Collab::new(uid, &collab_object.object_id, "phantom", vec![]);
let _ = collab.with_origin_transact_mut(|txn| {
@ -246,7 +246,7 @@ async fn sync_folder(
uid: i64,
workspace_id: &str,
device_id: &str,
collab_db: &Arc<RocksCollabDB>,
collab_db: &Arc<CollabKVDB>,
user_service: Arc<dyn UserCloudService>,
) -> Result<MutexFolder, Error> {
let (folder, encode_v1) = {
@ -295,7 +295,7 @@ async fn sync_database_views(
workspace_id: &str,
device_id: &str,
database_views_aggregate_id: &str,
collab_db: &Arc<RocksCollabDB>,
collab_db: &Arc<CollabKVDB>,
user_service: Arc<dyn UserCloudService>,
) -> Vec<Arc<DatabaseViewTracker>> {
let collab_object = CollabObject::new(

View File

@ -13,7 +13,7 @@ use collab_entity::{CollabObject, CollabType};
use collab_folder::{Folder, View, ViewLayout};
use parking_lot::Mutex;
use collab_integrate::{PersistenceError, RocksCollabDB, YrsDocAction};
use collab_integrate::{CollabKVAction, CollabKVDB, PersistenceError};
use flowy_error::FlowyResult;
use flowy_user_deps::cloud::UserCloudService;
@ -24,7 +24,7 @@ pub async fn sync_supabase_user_data_to_cloud(
user_service: Arc<dyn UserCloudService>,
device_id: &str,
new_user: &MigrationUser,
collab_db: &Arc<RocksCollabDB>,
collab_db: &Arc<CollabKVDB>,
) -> FlowyResult<()> {
let workspace_id = new_user.session.user_workspace.id.clone();
let uid = new_user.session.user_id;
@ -79,7 +79,7 @@ fn sync_view(
workspace_id: String,
device_id: String,
view: Arc<View>,
collab_db: Arc<RocksCollabDB>,
collab_db: Arc<CollabKVDB>,
user_service: Arc<dyn UserCloudService>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + Sync>> {
Box::pin(async move {
@ -205,7 +205,7 @@ fn sync_view(
fn get_collab_doc_state(
uid: i64,
collab_object: &CollabObject,
collab_db: &Arc<RocksCollabDB>,
collab_db: &Arc<CollabKVDB>,
) -> Result<Vec<u8>, PersistenceError> {
let collab = Collab::new(uid, &collab_object.object_id, "phantom", vec![]);
let _ = collab.with_origin_transact_mut(|txn| {
@ -224,7 +224,7 @@ fn get_collab_doc_state(
fn get_database_doc_state(
uid: i64,
collab_object: &CollabObject,
collab_db: &Arc<RocksCollabDB>,
collab_db: &Arc<CollabKVDB>,
) -> Result<(Vec<u8>, Vec<String>), PersistenceError> {
let collab = Collab::new(uid, &collab_object.object_id, "phantom", vec![]);
let _ = collab.with_origin_transact_mut(|txn| {
@ -246,7 +246,7 @@ async fn sync_folder(
uid: i64,
workspace_id: &str,
device_id: &str,
collab_db: &Arc<RocksCollabDB>,
collab_db: &Arc<CollabKVDB>,
user_service: Arc<dyn UserCloudService>,
) -> Result<MutexFolder, Error> {
let (folder, update) = {
@ -295,7 +295,7 @@ async fn sync_database_views(
workspace_id: &str,
device_id: &str,
database_views_aggregate_id: &str,
collab_db: &Arc<RocksCollabDB>,
collab_db: &Arc<CollabKVDB>,
user_service: Arc<dyn UserCloudService>,
) -> Vec<Arc<DatabaseViewTracker>> {
let collab_object = CollabObject::new(

View File

@ -9,7 +9,7 @@ use tokio_stream::StreamExt;
use tracing::{debug, error, event, info, instrument};
use collab_integrate::collab_builder::AppFlowyCollabBuilder;
use collab_integrate::RocksCollabDB;
use collab_integrate::CollabKVDB;
use flowy_error::{internal_error, ErrorCode, FlowyResult};
use flowy_folder_deps::entities::ImportData;
use flowy_server_config::AuthenticatorType;
@ -261,7 +261,7 @@ impl UserManager {
self.database.get_pool(uid)
}
pub fn get_collab_db(&self, uid: i64) -> Result<Weak<RocksCollabDB>, FlowyError> {
pub fn get_collab_db(&self, uid: i64) -> Result<Weak<CollabKVDB>, FlowyError> {
self
.database
.get_collab_db(uid)

View File

@ -7,7 +7,7 @@ use collab_document::document_data::default_document_data;
use collab_folder::{Folder, View};
use tracing::{event, instrument};
use collab_integrate::{PersistenceError, RocksCollabDB, YrsDocAction};
use collab_integrate::{CollabKVAction, CollabKVDB, PersistenceError};
use flowy_error::{internal_error, FlowyError, FlowyResult};
use flowy_user_deps::entities::Authenticator;
@ -27,7 +27,7 @@ impl UserDataMigration for HistoricalEmptyDocumentMigration {
fn run(
&self,
session: &Session,
collab_db: &Arc<RocksCollabDB>,
collab_db: &Arc<CollabKVDB>,
authenticator: &Authenticator,
) -> FlowyResult<()> {
// - The `empty document` struct has already undergone refactoring prior to the launch of the AppFlowy cloud version.
@ -36,29 +36,34 @@ impl UserDataMigration for HistoricalEmptyDocumentMigration {
if !matches!(authenticator, Authenticator::Local) {
return Ok(());
}
let write_txn = collab_db.write_txn();
let origin = CollabOrigin::Client(CollabClient::new(session.user_id, "phantom"));
let folder_collab = match load_collab(session.user_id, &write_txn, &session.user_workspace.id) {
Ok(fc) => fc,
Err(_) => return Ok(()),
};
collab_db
.with_write_txn(|write_txn| {
let origin = CollabOrigin::Client(CollabClient::new(session.user_id, "phantom"));
let folder_collab =
match load_collab(session.user_id, write_txn, &session.user_workspace.id) {
Ok(fc) => fc,
Err(_) => return Ok(()),
};
let folder = Folder::open(session.user_id, folder_collab, None)?;
let migration_views = folder.get_workspace_views();
let folder = Folder::open(session.user_id, folder_collab, None)?;
let migration_views = folder.get_workspace_views();
// For historical reasons, the first level documents are empty. So migrate them by inserting
// the default document data.
for view in migration_views {
if migrate_empty_document(&write_txn, &origin, &view, session.user_id).is_err() {
event!(
tracing::Level::ERROR,
"Failed to migrate document {}",
view.id
);
}
}
// For historical reasons, the first level documents are empty. So migrate them by inserting
// the default document data.
for view in migration_views {
if migrate_empty_document(write_txn, &origin, &view, session.user_id).is_err() {
event!(
tracing::Level::ERROR,
"Failed to migrate document {}",
view.id
);
}
}
Ok(())
})
.map_err(internal_error)?;
write_txn.commit_transaction().map_err(internal_error)?;
Ok(())
}
}
@ -70,7 +75,7 @@ fn migrate_empty_document<'a, W>(
user_id: i64,
) -> Result<(), FlowyError>
where
W: YrsDocAction<'a>,
W: CollabKVAction<'a>,
PersistenceError: From<W::Error>,
{
// If the document is not exist, we don't need to migrate it.

View File

@ -3,7 +3,7 @@ use std::sync::Arc;
use chrono::NaiveDateTime;
use diesel::{RunQueryDsl, SqliteConnection};
use collab_integrate::RocksCollabDB;
use collab_integrate::CollabKVDB;
use flowy_error::FlowyResult;
use flowy_sqlite::schema::user_data_migration_records;
use flowy_sqlite::ConnectionPool;
@ -13,14 +13,14 @@ use crate::services::entities::Session;
pub struct UserLocalDataMigration {
session: Session,
collab_db: Arc<RocksCollabDB>,
collab_db: Arc<CollabKVDB>,
sqlite_pool: Arc<ConnectionPool>,
}
impl UserLocalDataMigration {
pub fn new(
session: Session,
collab_db: Arc<RocksCollabDB>,
collab_db: Arc<CollabKVDB>,
sqlite_pool: Arc<ConnectionPool>,
) -> Self {
Self {
@ -78,7 +78,7 @@ pub trait UserDataMigration {
fn run(
&self,
user: &Session,
collab_db: &Arc<RocksCollabDB>,
collab_db: &Arc<CollabKVDB>,
authenticator: &Authenticator,
) -> FlowyResult<()>;
}

View File

@ -3,7 +3,7 @@ use std::sync::Arc;
use collab::core::collab::MutexCollab;
use collab::preclude::Collab;
use collab_integrate::{PersistenceError, YrsDocAction};
use collab_integrate::{CollabKVAction, PersistenceError};
use flowy_error::FlowyResult;
pub(crate) fn load_collab<'a, R>(
@ -12,7 +12,7 @@ pub(crate) fn load_collab<'a, R>(
object_id: &str,
) -> FlowyResult<Arc<MutexCollab>>
where
R: YrsDocAction<'a>,
R: CollabKVAction<'a>,
PersistenceError: From<R::Error>,
{
let collab = Collab::new(uid, object_id, "phantom", vec![]);

View File

@ -3,7 +3,7 @@ use std::sync::Arc;
use collab_folder::Folder;
use tracing::instrument;
use collab_integrate::{RocksCollabDB, YrsDocAction};
use collab_integrate::{CollabKVAction, CollabKVDB};
use flowy_error::{internal_error, FlowyResult};
use flowy_user_deps::entities::Authenticator;
@ -25,7 +25,7 @@ impl UserDataMigration for FavoriteV1AndWorkspaceArrayMigration {
fn run(
&self,
session: &Session,
collab_db: &Arc<RocksCollabDB>,
collab_db: &Arc<CollabKVDB>,
authenticator: &Authenticator,
) -> FlowyResult<()> {
// Note on `favorite` Struct Refactoring and Migration:
@ -35,33 +35,33 @@ impl UserDataMigration for FavoriteV1AndWorkspaceArrayMigration {
if !matches!(authenticator, Authenticator::Local) {
return Ok(());
}
let write_txn = collab_db.write_txn();
if let Ok(collab) = load_collab(session.user_id, &write_txn, &session.user_workspace.id) {
let folder = Folder::open(session.user_id, collab, None)?;
folder.migrate_workspace_to_view();
collab_db
.with_write_txn(|write_txn| {
if let Ok(collab) = load_collab(session.user_id, write_txn, &session.user_workspace.id) {
let folder = Folder::open(session.user_id, collab, None)?;
folder.migrate_workspace_to_view();
let favorite_view_ids = folder
.get_favorite_v1()
.into_iter()
.map(|fav| fav.id)
.collect::<Vec<String>>();
let favorite_view_ids = folder
.get_favorite_v1()
.into_iter()
.map(|fav| fav.id)
.collect::<Vec<String>>();
if !favorite_view_ids.is_empty() {
folder.add_favorites(favorite_view_ids);
}
if !favorite_view_ids.is_empty() {
folder.add_favorites(favorite_view_ids);
}
let encode = folder.encode_collab_v1();
write_txn
.flush_doc_with(
session.user_id,
&session.user_workspace.id,
&encode.doc_state,
&encode.state_vector,
)
.map_err(internal_error)?;
write_txn.commit_transaction().map_err(internal_error)?;
}
let encode = folder.encode_collab_v1();
write_txn.flush_doc_with(
session.user_id,
&session.user_workspace.id,
&encode.doc_state,
&encode.state_vector,
)?;
}
Ok(())
})
.map_err(internal_error)?;
Ok(())
}

View File

@ -3,7 +3,7 @@ use std::sync::Arc;
use collab_folder::Folder;
use tracing::instrument;
use collab_integrate::{RocksCollabDB, YrsDocAction};
use collab_integrate::{CollabKVAction, CollabKVDB};
use flowy_error::{internal_error, FlowyResult};
use flowy_user_deps::entities::Authenticator;
@ -23,34 +23,34 @@ impl UserDataMigration for WorkspaceTrashMapToSectionMigration {
fn run(
&self,
session: &Session,
collab_db: &Arc<RocksCollabDB>,
collab_db: &Arc<CollabKVDB>,
_authenticator: &Authenticator,
) -> FlowyResult<()> {
let write_txn = collab_db.write_txn();
if let Ok(collab) = load_collab(session.user_id, &write_txn, &session.user_workspace.id) {
let folder = Folder::open(session.user_id, collab, None)?;
let trash_ids = folder
.get_trash_v1()
.into_iter()
.map(|fav| fav.id)
.collect::<Vec<String>>();
collab_db
.with_write_txn(|write_txn| {
if let Ok(collab) = load_collab(session.user_id, write_txn, &session.user_workspace.id) {
let folder = Folder::open(session.user_id, collab, None)?;
let trash_ids = folder
.get_trash_v1()
.into_iter()
.map(|fav| fav.id)
.collect::<Vec<String>>();
if !trash_ids.is_empty() {
folder.add_trash(trash_ids);
}
if !trash_ids.is_empty() {
folder.add_trash(trash_ids);
}
let encode = folder.encode_collab_v1();
write_txn
.flush_doc_with(
session.user_id,
&session.user_workspace.id,
&encode.doc_state,
&encode.state_vector,
)
.map_err(internal_error)?;
write_txn.commit_transaction().map_err(internal_error)?;
}
let encode = folder.encode_collab_v1();
write_txn.flush_doc_with(
session.user_id,
&session.user_workspace.id,
&encode.doc_state,
&encode.state_vector,
)?;
}
Ok(())
})
.map_err(internal_error)?;
Ok(())
}

View File

@ -16,7 +16,7 @@ use collab_database::user::DatabaseViewTrackerList;
use collab_document::document_data::default_document_collab_data;
use collab_entity::CollabType;
use collab_folder::{Folder, UserId, View, ViewIdentifier, ViewLayout};
use collab_integrate::{PersistenceError, RocksCollabDB, YrsDocAction};
use collab_integrate::{CollabKVAction, CollabKVDB, PersistenceError};
use flowy_error::{internal_error, FlowyError};
use flowy_folder_deps::cloud::gen_view_id;
use flowy_folder_deps::entities::ImportData;
@ -32,7 +32,7 @@ use tracing::{debug, event, info, instrument};
pub(crate) struct ImportContext {
pub imported_session: Session,
pub imported_collab_db: Arc<RocksCollabDB>,
pub imported_collab_db: Arc<CollabKVDB>,
pub container_name: Option<String>,
}
@ -55,7 +55,7 @@ pub(crate) fn get_appflowy_data_folder_import_context(path: &str) -> anyhow::Res
))?;
let collab_db_path = user_paths.collab_db_path(session.user_id);
let collab_db = Arc::new(RocksCollabDB::open(collab_db_path)?);
let collab_db = Arc::new(CollabKVDB::open(collab_db_path)?);
Ok(ImportContext {
imported_session: session,
imported_collab_db: collab_db,
@ -72,13 +72,12 @@ pub(crate) fn get_appflowy_data_folder_import_context(path: &str) -> anyhow::Res
pub(crate) fn import_appflowy_data_folder(
session: &Session,
workspace_id: &str,
collab_db: &Arc<RocksCollabDB>,
collab_db: &Arc<CollabKVDB>,
import_context: ImportContext,
) -> anyhow::Result<ImportData> {
let imported_session = import_context.imported_session;
let imported_collab_db = import_context.imported_collab_db;
let container_name = import_context.container_name;
let imported_collab_read_txn = imported_collab_db.read_txn();
let mut database_view_ids_by_database_id: HashMap<String, Vec<String>> = HashMap::new();
let row_object_ids = Mutex::new(HashSet::new());
@ -90,6 +89,7 @@ pub(crate) fn import_appflowy_data_folder(
};
let views = collab_db.with_write_txn(|collab_write_txn| {
let imported_collab_read_txn = imported_collab_db.read_txn();
// use the old_to_new_id_map to keep track of the other collab object id and the new collab object id
let old_to_new_id_map = Arc::new(Mutex::new(OldToNewIdMap::new()));
let mut all_imported_object_ids = imported_collab_read_txn
@ -210,12 +210,12 @@ pub(crate) fn import_appflowy_data_folder(
fn migrate_database_view_tracker<'a, W>(
old_to_new_id_map: &mut OldToNewIdMap,
other_session: &Session,
other_collab_read_txn: &'a W,
other_collab_read_txn: &W,
database_view_ids_by_database_id: &mut HashMap<String, Vec<String>>,
database_object_ids: &Mutex<HashSet<String>>,
) -> Result<(), PersistenceError>
where
W: YrsDocAction<'a>,
W: CollabKVAction<'a>,
PersistenceError: From<W::Error>,
{
let database_view_tracker_collab = Collab::new(
@ -261,7 +261,7 @@ fn migrate_databases<'a, W>(
row_object_ids: &Mutex<HashSet<String>>,
) -> Result<(), PersistenceError>
where
W: YrsDocAction<'a>,
W: CollabKVAction<'a>,
PersistenceError: From<W::Error>,
{
// Migrate databases
@ -365,7 +365,7 @@ where
fn import_collab_object<'a, W>(collab: &Collab, new_uid: i64, new_object_id: &str, w_txn: &'a W)
where
W: YrsDocAction<'a>,
W: CollabKVAction<'a>,
PersistenceError: From<W::Error>,
{
let txn = collab.transact();
@ -381,7 +381,7 @@ fn import_collab_object_with_doc_state<'a, W>(
w_txn: &'a W,
) -> Result<(), anyhow::Error>
where
W: YrsDocAction<'a>,
W: CollabKVAction<'a>,
PersistenceError: From<W::Error>,
{
let collab = Collab::new_with_doc_state(CollabOrigin::Empty, new_object_id, doc_state, vec![])?;
@ -389,15 +389,14 @@ where
Ok(())
}
fn import_workspace_views<'a, 'b, W>(
fn import_workspace_views<'a, W>(
parent_view_id: &str,
old_to_new_id_map: &mut OldToNewIdMap,
other_session: &Session,
other_collab_read_txn: &W,
) -> Result<Vec<ParentChildViews>, PersistenceError>
where
'a: 'b,
W: YrsDocAction<'a>,
W: CollabKVAction<'a>,
PersistenceError: From<W::Error>,
{
let other_folder_collab = Collab::new(
@ -538,7 +537,7 @@ impl DerefMut for OldToNewIdMap {
#[instrument(level = "debug", skip_all)]
pub async fn upload_imported_data(
uid: i64,
user_collab_db: Arc<RocksCollabDB>,
user_collab_db: Arc<CollabKVDB>,
workspace_id: &str,
user_authenticator: &Authenticator,
import_data: &ImportData,
@ -656,7 +655,7 @@ fn load_and_process_collab_data<'a, R>(
object_ids: &[String],
) -> HashMap<String, Vec<u8>>
where
R: YrsDocAction<'a>,
R: CollabKVAction<'a>,
PersistenceError: From<R::Error>,
{
load_collab_by_oid(uid, collab_read, object_ids)

View File

@ -1,6 +1,6 @@
use crate::services::data_import::appflowy_data_import::import_appflowy_data_folder;
use crate::services::entities::Session;
use collab_integrate::{PersistenceError, RocksCollabDB, YrsDocAction};
use collab_integrate::{CollabKVAction, CollabKVDB, PersistenceError};
use std::collections::HashMap;
use crate::services::data_import::ImportContext;
@ -22,7 +22,7 @@ pub enum ImportDataSource {
pub(crate) fn import_data(
session: &Session,
context: ImportContext,
collab_db: Arc<RocksCollabDB>,
collab_db: Arc<CollabKVDB>,
) -> anyhow::Result<ImportData> {
import_appflowy_data_folder(session, &session.user_workspace.id, &collab_db, context)
}
@ -34,7 +34,7 @@ pub fn load_collab_by_oid<'a, R>(
object_ids: &[String],
) -> HashMap<String, Collab>
where
R: YrsDocAction<'a>,
R: CollabKVAction<'a>,
PersistenceError: From<R::Error>,
{
let mut collab_by_oid = HashMap::new();

View File

@ -5,7 +5,7 @@ use chrono::Local;
use parking_lot::RwLock;
use tracing::{error, event, info, instrument};
use collab_integrate::{PersistenceError, RocksCollabDB, YrsDocAction};
use collab_integrate::{CollabKVAction, CollabKVDB, PersistenceError};
use flowy_error::FlowyError;
use flowy_sqlite::schema::user_workspace_table;
use flowy_sqlite::ConnectionPool;
@ -30,7 +30,7 @@ pub trait UserDBPath: Send + Sync + 'static {
pub struct UserDB {
paths: Box<dyn UserDBPath>,
sqlite_map: RwLock<HashMap<i64, Database>>,
collab_db_map: RwLock<HashMap<i64, Arc<RocksCollabDB>>>,
collab_db_map: RwLock<HashMap<i64, Arc<CollabKVDB>>>,
}
impl UserDB {
@ -138,7 +138,7 @@ impl UserDB {
Ok(pool)
}
pub(crate) fn get_collab_db(&self, user_id: i64) -> Result<Arc<RocksCollabDB>, FlowyError> {
pub(crate) fn get_collab_db(&self, user_id: i64) -> Result<Arc<CollabKVDB>, FlowyError> {
let collab_db = self.open_collab_db(self.paths.collab_db_path(user_id), user_id)?;
Ok(collab_db)
}
@ -194,7 +194,7 @@ impl UserDB {
&self,
collab_db_path: impl AsRef<Path>,
uid: i64,
) -> Result<Arc<RocksCollabDB>, PersistenceError> {
) -> Result<Arc<CollabKVDB>, PersistenceError> {
if let Some(collab_db) = self.collab_db_map.read().get(&uid) {
return Ok(collab_db.clone());
}
@ -205,7 +205,7 @@ impl UserDB {
uid,
collab_db_path.as_ref()
);
let db = match RocksCollabDB::open(&collab_db_path) {
let db = match CollabKVDB::open(&collab_db_path) {
Ok(db) => Ok(db),
Err(err) => {
error!("open collab db error, {:?}", err);
@ -372,7 +372,7 @@ fn zip_time_format() -> &'static str {
}
pub(crate) fn validate_collab_db(
result: Result<Arc<RocksCollabDB>, PersistenceError>,
result: Result<Arc<CollabKVDB>, PersistenceError>,
uid: i64,
workspace_id: &str,
) -> bool {

View File

@ -9,7 +9,7 @@ use collab_user::core::{MutexUserAwareness, UserAwareness};
use tracing::{error, trace};
use uuid::Uuid;
use collab_integrate::RocksCollabDB;
use collab_integrate::CollabKVDB;
use flowy_error::{ErrorCode, FlowyError, FlowyResult};
use crate::entities::ReminderPB;
@ -162,7 +162,7 @@ impl UserManager {
async fn collab_for_user_awareness(
&self,
session: &Session,
collab_db: Weak<RocksCollabDB>,
collab_db: Weak<CollabKVDB>,
raw_data: CollabDocState,
) -> Result<Arc<MutexCollab>, FlowyError> {
let collab_builder = self.collab_builder.upgrade().ok_or(FlowyError::new(