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

Method get_view_info

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

Get information about a view. Returns the view's metadata including its Merkle state and change count. # Arguments `name` - The name of the view to query # Returns A `ViewInfo` struct with the view's metadata, or an error if the view doesn't exist.

(&self, name: &str)

Source from the content-addressed store, hash-verified

497 /// A `ViewInfo` struct with the view's metadata, or an error if the view
498 /// doesn't exist.
499 pub fn get_view_info(&self, name: &str) -> Result<ViewInfo, RepositoryError> {
500 let txn = self
501 .pristine
502 .read_txn()
503 .map_err(|e| RepositoryError::Database(e.to_string()))?;
504
505 let view = txn
506 .get_view(name)
507 .map_err(|e| RepositoryError::Database(e.to_string()))?
508 .ok_or_else(|| RepositoryError::ViewNotFound {
509 name: name.to_string(),
510 })?;
511
512 // Resolve parent name if the view has a parent
513 let parent_name = if let Some(parent_id) = view.parent {
514 txn.get_view_by_id(parent_id)
515 .map_err(|e| RepositoryError::Database(e.to_string()))?
516 .map(|p| p.name)
517 } else {
518 None
519 };
520
521 Ok(ViewInfo {
522 name: view.name.clone(),
523 state: view.state,
524 change_count: view.change_count,
525 scope: view.kind,
526 parent_name,
527 })
528 }
529}

Callers 15

runMethod · 0.80
list_stashesMethod · 0.80
run_showMethod · 0.80
resolve_referenceMethod · 0.80
display_dry_runMethod · 0.80
execute_reviseMethod · 0.80
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80

Calls 4

read_txnMethod · 0.80
get_viewMethod · 0.45
get_view_by_idMethod · 0.45
cloneMethod · 0.45