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

Function new_state_for_view

atomic-repository/src/repository/adoption.rs:2911–2926  ·  view source on GitHub ↗
(
    repo: &Repository,
    view_name: &str,
)

Source from the content-addressed store, hash-verified

2909}
2910
2911fn new_state_for_view(
2912 repo: &Repository,
2913 view_name: &str,
2914) -> Result<atomic_core::types::Merkle, RepositoryError> {
2915 let txn = repo
2916 .pristine
2917 .read_txn()
2918 .map_err(|error| RepositoryError::Database(error.to_string()))?;
2919 let view = txn
2920 .get_view(view_name)
2921 .map_err(|error| RepositoryError::Database(error.to_string()))?
2922 .ok_or_else(|| RepositoryError::ViewNotFound {
2923 name: view_name.to_string(),
2924 })?;
2925 Ok(view.state)
2926}
2927
2928/// §6.4: drop the local WIP ref once the replacement snapshot is durable.
2929///

Calls 2

read_txnMethod · 0.80
get_viewMethod · 0.45

Tested by

no test coverage detected