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

Method views_containing_change

atomic-repository/src/repository/views.rs:448–483  ·  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

446
447 /// Return the names of all views whose change-set references `hash`.
448 pub fn views_containing_change(&self, hash: &Hash) -> Result<Vec<String>, RepositoryError> {
449 let txn = self
450 .pristine
451 .read_txn()
452 .map_err(|e| RepositoryError::Database(e.to_string()))?;
453
454 let change_id = match txn
455 .get_internal(hash)
456 .map_err(|e| RepositoryError::Database(e.to_string()))?
457 {
458 Some(id) => id,
459 None => return Ok(vec![]),
460 };
461
462 let mut names = Vec::new();
463 for name in txn
464 .list_views()
465 .map_err(|e| RepositoryError::Database(e.to_string()))?
466 {
467 let view = match txn
468 .get_view(&name)
469 .map_err(|e| RepositoryError::Database(e.to_string()))?
470 {
471 Some(view) => view,
472 None => continue,
473 };
474 if txn
475 .get_change_seq(&view, change_id)
476 .map_err(|e| RepositoryError::Database(e.to_string()))?
477 .is_some()
478 {
479 names.push(name);
480 }
481 }
482 Ok(names)
483 }
484
485 /// Check if a view exists.
486 ///

Callers 3

get_tagMethod · 0.80

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