chore: Bump collab (#5136)

* chore: bump collab

* chore: bump collab

* chore: bump collab

* chore: fix test

* chore: disable supabse test
This commit is contained in:
Nathan.fooo
2024-04-15 14:50:28 +08:00
committed by GitHub
parent e9e483291e
commit d758e62c1a
41 changed files with 633 additions and 232 deletions

View File

@ -1,7 +1,7 @@
use std::sync::Arc;
use std::sync::Weak;
use collab::core::collab::{DocStateSource, MutexCollab};
use collab::core::collab::{DataSource, MutexCollab};
use collab::core::collab_plugin::EncodedCollab;
use collab::core::origin::CollabOrigin;
use collab::preclude::Collab;
@ -124,7 +124,7 @@ impl DocumentManager {
.doc_state
.to_vec();
let collab = self
.collab_for_document(uid, doc_id, DocStateSource::FromDocState(doc_state), false)
.collab_for_document(uid, doc_id, DataSource::DocStateV1(doc_state), false)
.await?;
collab.lock().flush();
Ok(())
@ -144,11 +144,11 @@ impl DocumentManager {
return Ok(doc);
}
let mut doc_state = DocStateSource::FromDisk;
let mut doc_state = DataSource::Disk;
// If the document does not exist in local disk, try get the doc state from the cloud. This happens
// When user_device_a create a document and user_device_b open the document.
if !self.is_doc_exist(doc_id).await? {
doc_state = DocStateSource::FromDocState(
doc_state = DataSource::DocStateV1(
self
.cloud_service
.get_document_doc_state(doc_id, &self.user_service.workspace_id()?)
@ -188,9 +188,9 @@ impl DocumentManager {
}
pub async fn get_document_data(&self, doc_id: &str) -> FlowyResult<DocumentData> {
let mut doc_state = DocStateSource::FromDisk;
let mut doc_state = DataSource::Disk;
if !self.is_doc_exist(doc_id).await? {
doc_state = DocStateSource::FromDocState(
doc_state = DataSource::DocStateV1(
self
.cloud_service
.get_document_doc_state(doc_id, &self.user_service.workspace_id()?)
@ -377,7 +377,7 @@ impl DocumentManager {
&self,
uid: i64,
doc_id: &str,
doc_state: DocStateSource,
doc_state: DataSource,
sync_enable: bool,
) -> FlowyResult<Arc<MutexCollab>> {
let db = self.user_service.collab_db(uid)?;
@ -439,7 +439,7 @@ async fn doc_state_from_document_data(
let doc_id = doc_id.to_string();
// spawn_blocking is used to avoid blocking the tokio thread pool if the document is large.
let encoded_collab = tokio::task::spawn_blocking(move || {
let collab = Arc::new(MutexCollab::from_collab(Collab::new_with_origin(
let collab = Arc::new(MutexCollab::new(Collab::new_with_origin(
CollabOrigin::Empty,
doc_id,
vec![],