MCPcopy Create free account
hub / github.com/AppFlowy-IO/AppFlowy-Collab / create_collab

Method create_collab

collab/tests/plugins/disk/script.rs:162–186  ·  view source on GitHub ↗
(&mut self, doc_id: String)

Source from the content-addressed store, hash-verified

160 }
161
162 pub async fn create_collab(&mut self, doc_id: String) {
163 let object_id = Uuid::parse_str(&doc_id)
164 .unwrap_or_else(|_| Uuid::new_v5(&Uuid::NAMESPACE_OID, doc_id.as_bytes()));
165 let disk_plugin = disk_plugin_with_db(
166 self.uid,
167 self.workspace_id.clone(),
168 self.db.clone(),
169 &object_id.to_string(),
170 CollabType::Unknown,
171 );
172 let data_source = KVDBCollabPersistenceImpl {
173 db: Arc::downgrade(&self.db),
174 uid: self.uid,
175 workspace_id: self.workspace_id.clone(),
176 };
177
178 let options =
179 CollabOptions::new(object_id, default_client_id()).with_data_source(data_source.into());
180 let mut collab = Collab::new_with_options(CollabOrigin::Empty, options).unwrap();
181 collab.add_plugin(Box::new(disk_plugin));
182 collab.initialize();
183 self
184 .collab_by_id
185 .insert(doc_id, Arc::new(RwLock::from(collab)));
186 }
187
188 pub async fn enable_undo_redo(&self, doc_id: &str) {
189 self

Callers 3

Calls 7

disk_plugin_with_dbFunction · 0.85
default_client_idFunction · 0.85
as_bytesMethod · 0.80
with_data_sourceMethod · 0.80
add_pluginMethod · 0.80
initializeMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected