| 
									
										
										
										
											2023-07-05 20:57:09 +08:00
										 |  |  | use std::ops::Deref;
 | 
					
						
							| 
									
										
										
										
											2024-08-18 05:16:42 +02:00
										 |  |  | use std::sync::{Arc, OnceLock};
 | 
					
						
							| 
									
										
										
										
											2023-05-10 13:27:50 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-15 00:02:17 +08:00
										 |  |  | use collab::entity::EncodedCollab;
 | 
					
						
							| 
									
										
										
										
											2023-11-28 15:49:47 -08:00
										 |  |  | use collab::preclude::CollabPlugin;
 | 
					
						
							| 
									
										
										
										
											2023-07-14 13:37:13 +08:00
										 |  |  | use collab_document::blocks::DocumentData;
 | 
					
						
							| 
									
										
										
										
											2024-08-18 05:16:42 +02:00
										 |  |  | use collab_document::document::Document;
 | 
					
						
							| 
									
										
										
										
											2023-08-03 09:14:52 +08:00
										 |  |  | use collab_document::document_data::default_document_data;
 | 
					
						
							| 
									
										
										
										
											2023-11-28 15:49:47 -08:00
										 |  |  | use collab_integrate::collab_builder::{
 | 
					
						
							| 
									
										
										
										
											2023-12-30 07:05:26 +08:00
										 |  |  |   AppFlowyCollabBuilder, CollabCloudPluginProvider, CollabPluginProviderContext,
 | 
					
						
							| 
									
										
										
										
											2024-04-26 09:44:07 +08:00
										 |  |  |   CollabPluginProviderType, WorkspaceCollabIntegrate,
 | 
					
						
							| 
									
										
										
										
											2023-11-28 15:49:47 -08:00
										 |  |  | };
 | 
					
						
							| 
									
										
										
										
											2024-01-05 00:05:38 +08:00
										 |  |  | use collab_integrate::CollabKVDB;
 | 
					
						
							| 
									
										
										
										
											2024-01-07 11:12:05 +08:00
										 |  |  | use flowy_document::entities::{DocumentSnapshotData, DocumentSnapshotMeta};
 | 
					
						
							|  |  |  | use flowy_document::manager::{DocumentManager, DocumentSnapshotService, DocumentUserService};
 | 
					
						
							| 
									
										
										
										
											2024-01-11 14:42:03 +08:00
										 |  |  | use flowy_document_pub::cloud::*;
 | 
					
						
							| 
									
										
										
										
											2024-01-07 11:12:05 +08:00
										 |  |  | use flowy_error::{ErrorCode, FlowyError, FlowyResult};
 | 
					
						
							| 
									
										
										
										
											2024-08-11 20:39:25 +08:00
										 |  |  | use flowy_storage_pub::storage::{CreatedUpload, FileProgressReceiver, StorageService};
 | 
					
						
							| 
									
										
										
										
											2023-11-28 15:49:47 -08:00
										 |  |  | use lib_infra::async_trait::async_trait;
 | 
					
						
							| 
									
										
										
										
											2024-06-20 07:44:57 +08:00
										 |  |  | use lib_infra::box_any::BoxAny;
 | 
					
						
							| 
									
										
										
										
											2025-04-07 19:24:58 +08:00
										 |  |  | use nanoid::nanoid;
 | 
					
						
							|  |  |  | use tempfile::TempDir;
 | 
					
						
							|  |  |  | use tokio::sync::RwLock;
 | 
					
						
							|  |  |  | use tracing_subscriber::{fmt::Subscriber, util::SubscriberInitExt, EnvFilter};
 | 
					
						
							|  |  |  | use uuid::Uuid;
 | 
					
						
							| 
									
										
										
										
											2023-07-05 20:57:09 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | pub struct DocumentTest {
 | 
					
						
							|  |  |  |   inner: DocumentManager,
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | impl DocumentTest {
 | 
					
						
							|  |  |  |   pub fn new() -> Self {
 | 
					
						
							|  |  |  |     let user = FakeUser::new();
 | 
					
						
							|  |  |  |     let cloud_service = Arc::new(LocalTestDocumentCloudServiceImpl());
 | 
					
						
							| 
									
										
										
										
											2024-06-20 07:44:57 +08:00
										 |  |  |     let file_storage = Arc::new(DocumentTestFileStorageService) as Arc<dyn StorageService>;
 | 
					
						
							| 
									
										
										
										
											2024-01-07 11:12:05 +08:00
										 |  |  |     let document_snapshot = Arc::new(DocumentTestSnapshot);
 | 
					
						
							| 
									
										
										
										
											2024-04-26 09:44:07 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     let builder = Arc::new(AppFlowyCollabBuilder::new(
 | 
					
						
							|  |  |  |       DefaultCollabStorageProvider(),
 | 
					
						
							|  |  |  |       WorkspaceCollabIntegrateImpl {
 | 
					
						
							| 
									
										
										
										
											2025-04-07 19:34:26 +08:00
										 |  |  |         workspace_id: user.workspace_id,
 | 
					
						
							| 
									
										
										
										
											2024-04-26 09:44:07 +08:00
										 |  |  |       },
 | 
					
						
							|  |  |  |     ));
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-01 22:27:29 +08:00
										 |  |  |     let manager = DocumentManager::new(
 | 
					
						
							|  |  |  |       Arc::new(user),
 | 
					
						
							| 
									
										
										
										
											2024-04-26 09:44:07 +08:00
										 |  |  |       builder,
 | 
					
						
							| 
									
										
										
										
											2023-09-01 22:27:29 +08:00
										 |  |  |       cloud_service,
 | 
					
						
							|  |  |  |       Arc::downgrade(&file_storage),
 | 
					
						
							| 
									
										
										
										
											2024-01-07 11:12:05 +08:00
										 |  |  |       document_snapshot,
 | 
					
						
							| 
									
										
										
										
											2023-09-01 22:27:29 +08:00
										 |  |  |     );
 | 
					
						
							| 
									
										
										
										
											2023-07-05 20:57:09 +08:00
										 |  |  |     Self { inner: manager }
 | 
					
						
							|  |  |  |   }
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | impl Deref for DocumentTest {
 | 
					
						
							|  |  |  |   type Target = DocumentManager;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   fn deref(&self) -> &Self::Target {
 | 
					
						
							|  |  |  |     &self.inner
 | 
					
						
							|  |  |  |   }
 | 
					
						
							|  |  |  | }
 | 
					
						
							| 
									
										
										
										
											2023-05-10 13:27:50 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-24 14:25:00 +08:00
										 |  |  | pub struct FakeUser {
 | 
					
						
							| 
									
										
										
										
											2025-04-07 19:24:58 +08:00
										 |  |  |   workspace_id: Uuid,
 | 
					
						
							| 
									
										
										
										
											2024-01-05 00:05:38 +08:00
										 |  |  |   collab_db: Arc<CollabKVDB>,
 | 
					
						
							| 
									
										
										
										
											2023-04-24 14:25:00 +08:00
										 |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | impl FakeUser {
 | 
					
						
							|  |  |  |   pub fn new() -> Self {
 | 
					
						
							| 
									
										
										
										
											2023-12-27 11:42:39 +08:00
										 |  |  |     setup_log();
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     let tempdir = TempDir::new().unwrap();
 | 
					
						
							|  |  |  |     let path = tempdir.into_path();
 | 
					
						
							| 
									
										
										
										
											2024-01-05 00:05:38 +08:00
										 |  |  |     let collab_db = Arc::new(CollabKVDB::open(path).unwrap());
 | 
					
						
							| 
									
										
										
										
											2025-04-07 19:24:58 +08:00
										 |  |  |     let workspace_id = uuid::Uuid::new_v4();
 | 
					
						
							| 
									
										
										
										
											2023-12-27 11:42:39 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-26 09:44:07 +08:00
										 |  |  |     Self {
 | 
					
						
							|  |  |  |       collab_db,
 | 
					
						
							|  |  |  |       workspace_id,
 | 
					
						
							|  |  |  |     }
 | 
					
						
							| 
									
										
										
										
											2023-04-24 14:25:00 +08:00
										 |  |  |   }
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-07 11:12:05 +08:00
										 |  |  | impl DocumentUserService for FakeUser {
 | 
					
						
							| 
									
										
										
										
											2023-09-17 17:14:34 +08:00
										 |  |  |   fn user_id(&self) -> Result<i64, FlowyError> {
 | 
					
						
							| 
									
										
										
										
											2023-04-24 14:25:00 +08:00
										 |  |  |     Ok(1)
 | 
					
						
							|  |  |  |   }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-07 19:24:58 +08:00
										 |  |  |   fn workspace_id(&self) -> Result<Uuid, FlowyError> {
 | 
					
						
							| 
									
										
										
										
											2025-04-07 19:34:26 +08:00
										 |  |  |     Ok(self.workspace_id)
 | 
					
						
							| 
									
										
										
										
											2023-10-23 11:43:31 +08:00
										 |  |  |   }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-05 00:05:38 +08:00
										 |  |  |   fn collab_db(&self, _uid: i64) -> Result<std::sync::Weak<CollabKVDB>, FlowyError> {
 | 
					
						
							| 
									
										
										
										
											2023-07-29 09:46:24 +08:00
										 |  |  |     Ok(Arc::downgrade(&self.collab_db))
 | 
					
						
							| 
									
										
										
										
											2023-04-24 14:25:00 +08:00
										 |  |  |   }
 | 
					
						
							| 
									
										
										
										
											2024-03-28 17:46:31 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   fn device_id(&self) -> Result<String, FlowyError> {
 | 
					
						
							|  |  |  |     Ok("".to_string())
 | 
					
						
							|  |  |  |   }
 | 
					
						
							| 
									
										
										
										
											2023-04-24 14:25:00 +08:00
										 |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-27 11:42:39 +08:00
										 |  |  | pub fn setup_log() {
 | 
					
						
							| 
									
										
										
										
											2024-08-18 05:16:42 +02:00
										 |  |  |   static START: OnceLock<()> = OnceLock::new();
 | 
					
						
							|  |  |  |   START.get_or_init(|| {
 | 
					
						
							| 
									
										
										
										
											2023-04-24 14:25:00 +08:00
										 |  |  |     std::env::set_var("RUST_LOG", "collab_persistence=trace");
 | 
					
						
							|  |  |  |     let subscriber = Subscriber::builder()
 | 
					
						
							|  |  |  |       .with_env_filter(EnvFilter::from_default_env())
 | 
					
						
							|  |  |  |       .with_ansi(true)
 | 
					
						
							|  |  |  |       .finish();
 | 
					
						
							|  |  |  |     subscriber.try_init().unwrap();
 | 
					
						
							|  |  |  |   });
 | 
					
						
							|  |  |  | }
 | 
					
						
							| 
									
										
										
										
											2023-05-16 14:58:24 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-18 05:16:42 +02:00
										 |  |  | pub async fn create_and_open_empty_document() -> (DocumentTest, Arc<RwLock<Document>>, String) {
 | 
					
						
							| 
									
										
										
										
											2023-07-05 20:57:09 +08:00
										 |  |  |   let test = DocumentTest::new();
 | 
					
						
							| 
									
										
										
										
											2025-04-07 19:24:58 +08:00
										 |  |  |   let doc_id = gen_document_id();
 | 
					
						
							|  |  |  |   let data = default_document_data(&doc_id.to_string());
 | 
					
						
							| 
									
										
										
										
											2024-01-07 11:12:05 +08:00
										 |  |  |   let uid = test.user_service.user_id().unwrap();
 | 
					
						
							| 
									
										
										
										
											2023-06-15 10:37:51 +08:00
										 |  |  |   // create a document
 | 
					
						
							| 
									
										
										
										
											2023-12-29 13:02:27 +08:00
										 |  |  |   test
 | 
					
						
							| 
									
										
										
										
											2023-08-17 23:46:39 +08:00
										 |  |  |     .create_document(uid, &doc_id, Some(data.clone()))
 | 
					
						
							| 
									
										
										
										
											2023-08-28 13:28:24 +08:00
										 |  |  |     .await
 | 
					
						
							| 
									
										
										
										
											2023-08-17 23:46:39 +08:00
										 |  |  |     .unwrap();
 | 
					
						
							| 
									
										
										
										
											2023-06-15 10:37:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-05 12:40:31 +08:00
										 |  |  |   test.open_document(&doc_id).await.unwrap();
 | 
					
						
							| 
									
										
										
										
											2024-08-18 05:16:42 +02:00
										 |  |  |   let document = test.editable_document(&doc_id).await.unwrap();
 | 
					
						
							| 
									
										
										
										
											2023-06-15 10:37:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-05 20:57:09 +08:00
										 |  |  |   (test, document, data.page_id)
 | 
					
						
							| 
									
										
										
										
											2023-06-15 10:37:51 +08:00
										 |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-07 19:24:58 +08:00
										 |  |  | pub fn gen_document_id() -> Uuid {
 | 
					
						
							|  |  |  |   uuid::Uuid::new_v4()
 | 
					
						
							| 
									
										
										
										
											2023-06-15 10:37:51 +08:00
										 |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | pub fn gen_id() -> String {
 | 
					
						
							|  |  |  |   nanoid!(10)
 | 
					
						
							|  |  |  | }
 | 
					
						
							| 
									
										
										
										
											2023-07-05 20:57:09 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | pub struct LocalTestDocumentCloudServiceImpl();
 | 
					
						
							| 
									
										
										
										
											2024-08-18 05:16:42 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #[async_trait]
 | 
					
						
							| 
									
										
										
										
											2023-07-05 20:57:09 +08:00
										 |  |  | impl DocumentCloudService for LocalTestDocumentCloudServiceImpl {
 | 
					
						
							| 
									
										
										
										
											2024-08-18 05:16:42 +02:00
										 |  |  |   async fn get_document_doc_state(
 | 
					
						
							| 
									
										
										
										
											2023-10-23 11:43:31 +08:00
										 |  |  |     &self,
 | 
					
						
							| 
									
										
										
										
											2025-04-07 19:24:58 +08:00
										 |  |  |     document_id: &Uuid,
 | 
					
						
							| 
									
										
										
										
											2025-04-07 19:34:26 +08:00
										 |  |  |     _workspace_id: &Uuid,
 | 
					
						
							| 
									
										
										
										
											2024-08-18 05:16:42 +02:00
										 |  |  |   ) -> Result<Vec<u8>, FlowyError> {
 | 
					
						
							| 
									
										
										
										
											2024-01-04 08:02:12 +08:00
										 |  |  |     let document_id = document_id.to_string();
 | 
					
						
							| 
									
										
										
										
											2024-08-18 05:16:42 +02:00
										 |  |  |     Err(FlowyError::new(
 | 
					
						
							|  |  |  |       ErrorCode::RecordNotFound,
 | 
					
						
							|  |  |  |       format!("Document {} not found", document_id),
 | 
					
						
							|  |  |  |     ))
 | 
					
						
							| 
									
										
										
										
											2023-07-05 20:57:09 +08:00
										 |  |  |   }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-18 05:16:42 +02:00
										 |  |  |   async fn get_document_snapshots(
 | 
					
						
							| 
									
										
										
										
											2023-07-05 20:57:09 +08:00
										 |  |  |     &self,
 | 
					
						
							| 
									
										
										
										
											2025-04-07 19:34:26 +08:00
										 |  |  |     _document_id: &Uuid,
 | 
					
						
							|  |  |  |     _limit: usize,
 | 
					
						
							|  |  |  |     _workspace_id: &str,
 | 
					
						
							| 
									
										
										
										
											2024-10-26 11:20:16 +08:00
										 |  |  |   ) -> Result<Vec<DocumentSnapshot>, FlowyError> {
 | 
					
						
							| 
									
										
										
										
											2024-08-18 05:16:42 +02:00
										 |  |  |     Ok(vec![])
 | 
					
						
							| 
									
										
										
										
											2023-07-05 20:57:09 +08:00
										 |  |  |   }
 | 
					
						
							| 
									
										
										
										
											2023-07-14 13:37:13 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-18 05:16:42 +02:00
										 |  |  |   async fn get_document_data(
 | 
					
						
							| 
									
										
										
										
											2023-10-23 11:43:31 +08:00
										 |  |  |     &self,
 | 
					
						
							| 
									
										
										
										
											2025-04-07 19:34:26 +08:00
										 |  |  |     _document_id: &Uuid,
 | 
					
						
							|  |  |  |     _workspace_id: &Uuid,
 | 
					
						
							| 
									
										
										
										
											2024-10-26 11:20:16 +08:00
										 |  |  |   ) -> Result<Option<DocumentData>, FlowyError> {
 | 
					
						
							| 
									
										
										
										
											2024-08-18 05:16:42 +02:00
										 |  |  |     Ok(None)
 | 
					
						
							| 
									
										
										
										
											2023-07-14 13:37:13 +08:00
										 |  |  |   }
 | 
					
						
							| 
									
										
										
										
											2024-09-15 00:02:17 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   async fn create_document_collab(
 | 
					
						
							|  |  |  |     &self,
 | 
					
						
							| 
									
										
										
										
											2025-04-07 19:34:26 +08:00
										 |  |  |     _workspace_id: &Uuid,
 | 
					
						
							|  |  |  |     _document_id: &Uuid,
 | 
					
						
							|  |  |  |     _encoded_collab: EncodedCollab,
 | 
					
						
							| 
									
										
										
										
											2024-10-26 11:20:16 +08:00
										 |  |  |   ) -> Result<(), FlowyError> {
 | 
					
						
							| 
									
										
										
										
											2024-09-15 00:02:17 +08:00
										 |  |  |     Ok(())
 | 
					
						
							|  |  |  |   }
 | 
					
						
							| 
									
										
										
										
											2023-07-05 20:57:09 +08:00
										 |  |  | }
 | 
					
						
							| 
									
										
										
										
											2023-09-01 22:27:29 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | pub struct DocumentTestFileStorageService;
 | 
					
						
							| 
									
										
										
										
											2024-06-20 07:44:57 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #[async_trait]
 | 
					
						
							|  |  |  | impl StorageService for DocumentTestFileStorageService {
 | 
					
						
							| 
									
										
										
										
											2024-11-22 18:18:24 +08:00
										 |  |  |   async fn delete_object(&self, _url: String) -> FlowyResult<()> {
 | 
					
						
							| 
									
										
										
										
											2024-06-20 07:44:57 +08:00
										 |  |  |     todo!()
 | 
					
						
							|  |  |  |   }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   fn download_object(&self, _url: String, _local_file_path: String) -> FlowyResult<()> {
 | 
					
						
							|  |  |  |     todo!()
 | 
					
						
							|  |  |  |   }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-11 20:39:25 +08:00
										 |  |  |   async fn create_upload(
 | 
					
						
							| 
									
										
										
										
											2024-01-17 02:59:15 +08:00
										 |  |  |     &self,
 | 
					
						
							| 
									
										
										
										
											2024-06-20 07:44:57 +08:00
										 |  |  |     _workspace_id: &str,
 | 
					
						
							|  |  |  |     _parent_dir: &str,
 | 
					
						
							|  |  |  |     _local_file_path: &str,
 | 
					
						
							| 
									
										
										
										
											2024-08-11 20:39:25 +08:00
										 |  |  |   ) -> Result<(CreatedUpload, Option<FileProgressReceiver>), flowy_error::FlowyError> {
 | 
					
						
							| 
									
										
										
										
											2023-09-01 22:27:29 +08:00
										 |  |  |     todo!()
 | 
					
						
							|  |  |  |   }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-18 16:21:47 +08:00
										 |  |  |   async fn start_upload(&self, _record: &BoxAny) -> Result<(), FlowyError> {
 | 
					
						
							| 
									
										
										
										
											2023-09-01 22:27:29 +08:00
										 |  |  |     todo!()
 | 
					
						
							|  |  |  |   }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-20 07:44:57 +08:00
										 |  |  |   async fn resume_upload(
 | 
					
						
							|  |  |  |     &self,
 | 
					
						
							|  |  |  |     _workspace_id: &str,
 | 
					
						
							|  |  |  |     _parent_dir: &str,
 | 
					
						
							|  |  |  |     _file_id: &str,
 | 
					
						
							|  |  |  |   ) -> Result<(), FlowyError> {
 | 
					
						
							| 
									
										
										
										
											2023-09-01 22:27:29 +08:00
										 |  |  |     todo!()
 | 
					
						
							|  |  |  |   }
 | 
					
						
							| 
									
										
										
										
											2024-08-11 20:39:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-20 15:18:57 +08:00
										 |  |  |   async fn subscribe_file_progress(
 | 
					
						
							|  |  |  |     &self,
 | 
					
						
							|  |  |  |     _parent_idr: &str,
 | 
					
						
							|  |  |  |     _url: &str,
 | 
					
						
							|  |  |  |   ) -> Result<Option<FileProgressReceiver>, FlowyError> {
 | 
					
						
							| 
									
										
										
										
											2024-08-11 20:39:25 +08:00
										 |  |  |     todo!()
 | 
					
						
							|  |  |  |   }
 | 
					
						
							| 
									
										
										
										
											2023-09-01 22:27:29 +08:00
										 |  |  | }
 | 
					
						
							| 
									
										
										
										
											2023-11-28 15:49:47 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | struct DefaultCollabStorageProvider();
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #[async_trait]
 | 
					
						
							| 
									
										
										
										
											2023-12-30 07:05:26 +08:00
										 |  |  | impl CollabCloudPluginProvider for DefaultCollabStorageProvider {
 | 
					
						
							|  |  |  |   fn provider_type(&self) -> CollabPluginProviderType {
 | 
					
						
							|  |  |  |     CollabPluginProviderType::Local
 | 
					
						
							| 
									
										
										
										
											2023-11-28 15:49:47 -08:00
										 |  |  |   }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-23 09:18:47 +08:00
										 |  |  |   fn get_plugins(&self, _context: CollabPluginProviderContext) -> Vec<Box<dyn CollabPlugin>> {
 | 
					
						
							|  |  |  |     vec![]
 | 
					
						
							| 
									
										
										
										
											2023-11-28 15:49:47 -08:00
										 |  |  |   }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   fn is_sync_enabled(&self) -> bool {
 | 
					
						
							|  |  |  |     false
 | 
					
						
							|  |  |  |   }
 | 
					
						
							|  |  |  | }
 | 
					
						
							| 
									
										
										
										
											2024-01-07 11:12:05 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | struct DocumentTestSnapshot;
 | 
					
						
							|  |  |  | impl DocumentSnapshotService for DocumentTestSnapshot {
 | 
					
						
							|  |  |  |   fn get_document_snapshot_metas(
 | 
					
						
							|  |  |  |     &self,
 | 
					
						
							|  |  |  |     _document_id: &str,
 | 
					
						
							|  |  |  |   ) -> FlowyResult<Vec<DocumentSnapshotMeta>> {
 | 
					
						
							|  |  |  |     todo!()
 | 
					
						
							|  |  |  |   }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   fn get_document_snapshot(&self, _snapshot_id: &str) -> FlowyResult<DocumentSnapshotData> {
 | 
					
						
							|  |  |  |     todo!()
 | 
					
						
							|  |  |  |   }
 | 
					
						
							|  |  |  | }
 | 
					
						
							| 
									
										
										
										
											2024-04-26 09:44:07 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | struct WorkspaceCollabIntegrateImpl {
 | 
					
						
							| 
									
										
										
										
											2025-04-07 19:24:58 +08:00
										 |  |  |   workspace_id: Uuid,
 | 
					
						
							| 
									
										
										
										
											2024-04-26 09:44:07 +08:00
										 |  |  | }
 | 
					
						
							|  |  |  | impl WorkspaceCollabIntegrate for WorkspaceCollabIntegrateImpl {
 | 
					
						
							| 
									
										
										
										
											2025-04-07 19:24:58 +08:00
										 |  |  |   fn workspace_id(&self) -> Result<Uuid, FlowyError> {
 | 
					
						
							| 
									
										
										
										
											2025-04-07 19:34:26 +08:00
										 |  |  |     Ok(self.workspace_id)
 | 
					
						
							| 
									
										
										
										
											2024-04-26 09:44:07 +08:00
										 |  |  |   }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-07 19:24:58 +08:00
										 |  |  |   fn device_id(&self) -> Result<String, FlowyError> {
 | 
					
						
							| 
									
										
										
										
											2024-04-26 09:44:07 +08:00
										 |  |  |     Ok("fake_device_id".to_string())
 | 
					
						
							|  |  |  |   }
 | 
					
						
							|  |  |  | }
 |