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

Method build_arc_database_row

collab/src/database/database_trait.rs:244–270  ·  view source on GitHub ↗
(
    &self,
    row_id: &RowId,
    data: Option<DatabaseRowDataVariant>,
    sender: Option<RowChangeSender>,
  )

Source from the content-addressed store, hash-verified

242 }
243
244 async fn build_arc_database_row(
245 &self,
246 row_id: &RowId,
247 data: Option<DatabaseRowDataVariant>,
248 sender: Option<RowChangeSender>,
249 ) -> Result<Arc<RwLock<DatabaseRow>>, CollabError> {
250 if let Some(cache) = self.database_row_cache() {
251 if let Some(cached_row) = cache.get(row_id) {
252 return Ok(cached_row.clone());
253 }
254 }
255
256 let client_id = self.reader_client_id().await;
257 let collab_type = CollabType::DatabaseRow;
258 let data = match data {
259 None => self.reader_get_collab(row_id, collab_type).await?,
260 Some(data) => data.into_encode_collab(client_id),
261 };
262 let collab = build_collab(client_id, row_id, collab_type, data).await?;
263 let database_row = DatabaseRow::open(*row_id, collab, sender)?;
264 let arc_row = Arc::new(RwLock::new(database_row));
265
266 if let Some(cache) = self.database_row_cache() {
267 cache.insert(*row_id, arc_row.clone());
268 }
269 Ok(arc_row)
270 }
271
272 async fn batch_build_arc_database_row(
273 &self,

Callers 3

batch_load_rowsMethod · 0.80

Calls 7

build_collabFunction · 0.85
into_encode_collabMethod · 0.80
database_row_cacheMethod · 0.45
getMethod · 0.45
reader_client_idMethod · 0.45
reader_get_collabMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected