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

Method load_change

atomic-repository/src/repository/changes.rs:357–362  ·  view source on GitHub ↗

Load a change from the repository. If the change is in the cache, it's returned directly. Otherwise, it's loaded from disk, verified, and cached. # Arguments `hash` - The hash of the change to load # Errors Returns an error if: - The change doesn't exist (`ChangeNotFound`) - The file is corrupted (hash mismatch) - Deserialization fails # Example ```rust,ignore let change = repo.load_change(

(&self, hash: &Hash)

Source from the content-addressed store, hash-verified

355 /// println!("Message: {}", change.hashed.header.message);
356 /// ```
357 pub fn load_change(&self, hash: &Hash) -> Result<Change, RepositoryError> {
358 self.change_store.load_change(hash).map_err(|e| match e {
359 ChangeStoreError::NotFound { hash } => RepositoryError::ChangeNotFound { hash },
360 other => RepositoryError::Database(other.to_string()),
361 })
362 }
363
364 /// Check if a change exists in the repository.
365 ///

Calls

no outgoing calls