chore: use collab without gc (#391)
This commit is contained in:
parent
a2076d4dae
commit
c5112cc761
|
|
@ -1386,7 +1386,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "collab"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6c8931dabb793181f54b16d7aba6f795055b92cb#6c8931dabb793181f54b16d7aba6f795055b92cb"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ba46c5e9e39049c4fedd6f3d67410368874b324f#ba46c5e9e39049c4fedd6f3d67410368874b324f"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
|
@ -1409,7 +1409,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "collab-document"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6c8931dabb793181f54b16d7aba6f795055b92cb#6c8931dabb793181f54b16d7aba6f795055b92cb"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ba46c5e9e39049c4fedd6f3d67410368874b324f#ba46c5e9e39049c4fedd6f3d67410368874b324f"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"collab",
|
||||
|
|
@ -1428,7 +1428,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "collab-entity"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6c8931dabb793181f54b16d7aba6f795055b92cb#6c8931dabb793181f54b16d7aba6f795055b92cb"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ba46c5e9e39049c4fedd6f3d67410368874b324f#ba46c5e9e39049c4fedd6f3d67410368874b324f"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bytes",
|
||||
|
|
@ -1443,7 +1443,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "collab-folder"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6c8931dabb793181f54b16d7aba6f795055b92cb#6c8931dabb793181f54b16d7aba6f795055b92cb"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ba46c5e9e39049c4fedd6f3d67410368874b324f#ba46c5e9e39049c4fedd6f3d67410368874b324f"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
|
|
|
|||
|
|
@ -175,10 +175,10 @@ inherits = "release"
|
|||
debug = true
|
||||
|
||||
[patch.crates-io]
|
||||
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6c8931dabb793181f54b16d7aba6f795055b92cb" }
|
||||
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6c8931dabb793181f54b16d7aba6f795055b92cb" }
|
||||
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6c8931dabb793181f54b16d7aba6f795055b92cb" }
|
||||
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6c8931dabb793181f54b16d7aba6f795055b92cb" }
|
||||
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ba46c5e9e39049c4fedd6f3d67410368874b324f" }
|
||||
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ba46c5e9e39049c4fedd6f3d67410368874b324f" }
|
||||
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ba46c5e9e39049c4fedd6f3d67410368874b324f" }
|
||||
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ba46c5e9e39049c4fedd6f3d67410368874b324f" }
|
||||
|
||||
[features]
|
||||
custom_env= []
|
||||
|
|
|
|||
|
|
@ -493,13 +493,14 @@ impl TestClient {
|
|||
let (sink, stream) = (handler.sink(), handler.stream());
|
||||
let origin = CollabOrigin::Client(CollabClient::new(self.uid().await, self.device_id.clone()));
|
||||
let collab = match encoded_collab_v1 {
|
||||
None => Arc::new(MutexCollab::new(origin.clone(), &object_id, vec![])),
|
||||
None => Arc::new(MutexCollab::new(origin.clone(), &object_id, vec![], false)),
|
||||
Some(data) => Arc::new(
|
||||
MutexCollab::new_with_doc_state(
|
||||
origin.clone(),
|
||||
&object_id,
|
||||
data.doc_state.to_vec(),
|
||||
vec![],
|
||||
false,
|
||||
)
|
||||
.unwrap(),
|
||||
),
|
||||
|
|
@ -574,7 +575,7 @@ impl TestClient {
|
|||
let (sink, stream) = (handler.sink(), handler.stream());
|
||||
let origin = CollabOrigin::Client(CollabClient::new(self.uid().await, self.device_id.clone()));
|
||||
let collab = Arc::new(
|
||||
MutexCollab::new_with_doc_state(origin.clone(), object_id, doc_state, vec![]).unwrap(),
|
||||
MutexCollab::new_with_doc_state(origin.clone(), object_id, doc_state, vec![], false).unwrap(),
|
||||
);
|
||||
|
||||
let ws_connect_state = self.ws_client.subscribe_connect_state();
|
||||
|
|
@ -661,6 +662,7 @@ pub async fn assert_server_snapshot(
|
|||
&object_id,
|
||||
encoded_collab_v1.doc_state.to_vec(),
|
||||
vec![],
|
||||
false,
|
||||
)
|
||||
.unwrap()
|
||||
.to_json_value();
|
||||
|
|
@ -718,6 +720,7 @@ pub async fn assert_server_collab(
|
|||
&object_id,
|
||||
data.doc_state.to_vec(),
|
||||
vec![],
|
||||
false,
|
||||
)
|
||||
.unwrap()
|
||||
.to_json_value();
|
||||
|
|
@ -838,6 +841,7 @@ pub async fn get_collab_json_from_server(
|
|||
object_id,
|
||||
bytes.doc_state.to_vec(),
|
||||
vec![],
|
||||
false,
|
||||
)
|
||||
.unwrap()
|
||||
.to_json_value()
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ where
|
|||
object_id: &str,
|
||||
collab_type: CollabType,
|
||||
) {
|
||||
let mut collab = Collab::new_with_origin(CollabOrigin::Server, object_id, vec![]);
|
||||
let mut collab = Collab::new_with_origin(CollabOrigin::Server, object_id, vec![], false);
|
||||
let plugin = CollabStoragePlugin::new(
|
||||
uid,
|
||||
workspace_id,
|
||||
|
|
|
|||
|
|
@ -290,6 +290,7 @@ where
|
|||
object_id,
|
||||
encoded_collab.doc_state.to_vec(),
|
||||
vec![],
|
||||
false,
|
||||
) {
|
||||
match collab_type {
|
||||
CollabType::Document => {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,12 @@ impl WorkspaceTemplate for GetStartedDocumentTemplate {
|
|||
let data = tokio::task::spawn_blocking(|| {
|
||||
let json_str = include_str!("../../assets/read_me.json");
|
||||
let document_data = JsonToDocumentParser::json_str_to_document(json_str).unwrap();
|
||||
let collab = Arc::new(MutexCollab::new(CollabOrigin::Empty, &view_id, vec![]));
|
||||
let collab = Arc::new(MutexCollab::new(
|
||||
CollabOrigin::Empty,
|
||||
&view_id,
|
||||
vec![],
|
||||
false,
|
||||
));
|
||||
let document = Document::create_with_data(collab, document_data)?;
|
||||
let data = document.get_collab().encode_collab_v1();
|
||||
Ok::<_, anyhow::Error>(TemplateData {
|
||||
|
|
|
|||
|
|
@ -117,7 +117,12 @@ impl WorkspaceTemplateBuilder {
|
|||
trash: Default::default(),
|
||||
};
|
||||
|
||||
let collab = Arc::new(MutexCollab::new(CollabOrigin::Empty, &workspace_id, vec![]));
|
||||
let collab = Arc::new(MutexCollab::new(
|
||||
CollabOrigin::Empty,
|
||||
&workspace_id,
|
||||
vec![],
|
||||
false,
|
||||
));
|
||||
let folder = Folder::create(uid, collab, None, folder_data);
|
||||
let data = folder.encode_collab_v1();
|
||||
Ok::<_, anyhow::Error>(TemplateData {
|
||||
|
|
|
|||
|
|
@ -309,6 +309,7 @@ pub fn check_encoded_collab_data(object_id: &str, data: &[u8]) -> Result<(), any
|
|||
object_id,
|
||||
encoded_collab.doc_state.to_vec(),
|
||||
vec![],
|
||||
false,
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,13 +25,13 @@ pub fn generate_random_string(len: usize) -> String {
|
|||
}
|
||||
|
||||
pub fn make_big_collab_doc_state(object_id: &str, key: &str, value: String) -> Vec<u8> {
|
||||
let collab = Collab::new_with_origin(CollabOrigin::Empty, object_id, vec![]);
|
||||
let collab = Collab::new_with_origin(CollabOrigin::Empty, object_id, vec![], false);
|
||||
collab.insert(key, value);
|
||||
collab.encode_collab_v1().doc_state.to_vec()
|
||||
}
|
||||
|
||||
pub fn test_encode_collab_v1(object_id: &str, key: &str, value: &str) -> EncodedCollab {
|
||||
let collab = Collab::new_with_origin(CollabOrigin::Empty, object_id, vec![]);
|
||||
let collab = Collab::new_with_origin(CollabOrigin::Empty, object_id, vec![], false);
|
||||
collab.insert(key, value);
|
||||
collab.encode_collab_v1()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ async fn get_snapshot_data_test() {
|
|||
&object_id,
|
||||
encoded_collab.doc_state.to_vec(),
|
||||
vec![],
|
||||
false,
|
||||
)
|
||||
.unwrap();
|
||||
let json = collab.to_json_value();
|
||||
|
|
@ -136,7 +137,7 @@ async fn snapshot_limit_test() {
|
|||
}
|
||||
|
||||
fn test_collab_data(uid: i64, oid: &str) -> (EncodedCollab, Value) {
|
||||
let collab = Collab::new(uid, oid, "fake_device_id", vec![]);
|
||||
let collab = Collab::new(uid, oid, "fake_device_id", vec![], false);
|
||||
collab.with_origin_transact_mut(|txn| {
|
||||
collab.insert_with_txn(txn, "0", "a");
|
||||
collab.insert_with_txn(txn, "1", "b");
|
||||
|
|
|
|||
Loading…
Reference in New Issue