MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / views_containing_change

Method views_containing_change

atomic-repository/src/repository/views.rs:424–459  ·  view source on GitHub ↗

Return the names of all views whose change-set references `hash`.

(&self, hash: &Hash)

Source from the content-addressed store, hash-verified

422
423 /// Return the names of all views whose change-set references `hash`.
424 pub fn views_containing_change(&self, hash: &Hash) -> Result<Vec<String>, RepositoryError> {
425 let txn = self
426 .pristine
427 .read_txn()
428 .map_err(|e| RepositoryError::Database(e.to_string()))?;
429
430 let change_id = match txn
431 .get_internal(hash)
432 .map_err(|e| RepositoryError::Database(e.to_string()))?
433 {
434 Some(id) => id,
435 None => return Ok(vec![]),
436 };
437
438 let mut names = Vec::new();
439 for name in txn
440 .list_views()
441 .map_err(|e| RepositoryError::Database(e.to_string()))?
442 {
443 let view = match txn
444 .get_view(&name)
445 .map_err(|e| RepositoryError::Database(e.to_string()))?
446 {
447 Some(view) => view,
448 None => continue,
449 };
450 if txn
451 .get_change_seq(&view, change_id)
452 .map_err(|e| RepositoryError::Database(e.to_string()))?
453 .is_some()
454 {
455 names.push(name);
456 }
457 }
458 Ok(names)
459 }
460
461 /// Check if a view exists.
462 ///

Callers 1

Calls 6

read_txnMethod · 0.80
get_internalMethod · 0.45
list_viewsMethod · 0.45
get_viewMethod · 0.45
get_change_seqMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected