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

Method view_own_change_hashes

atomic-repository/src/repository/split.rs:484–505  ·  view source on GitHub ↗

Return the source view's own change hashes in sequence order. Used by the CLI to resolve `--last N` into concrete change hashes. Only the view's own log is returned (inherited changes are excluded), which matches what [`split_view`](Self::split_view) can operate on.

(&self, view_name: &str)

Source from the content-addressed store, hash-verified

482 /// the view's own log is returned (inherited changes are excluded), which
483 /// matches what [`split_view`](Self::split_view) can operate on.
484 pub fn view_own_change_hashes(&self, view_name: &str) -> Result<Vec<Hash>, RepositoryError> {
485 let db = |e: PristineError| RepositoryError::Database(e.to_string());
486 let txn = self.pristine.read_txn().map_err(db)?;
487 let view =
488 txn.get_view(view_name)
489 .map_err(db)?
490 .ok_or_else(|| RepositoryError::ViewNotFound {
491 name: view_name.to_string(),
492 })?;
493
494 let mut out = Vec::new();
495 for item in txn.iter_changes(&view, 0).map_err(db)? {
496 let (_seq, id, _merkle) = item.map_err(db)?;
497 let hash = txn.get_external(id).map_err(db)?.ok_or_else(|| {
498 RepositoryError::ChangeNotFound {
499 hash: format!("id={}", id.0),
500 }
501 })?;
502 out.push(hash);
503 }
504 Ok(out)
505 }
506}

Callers 1

resolve_changesMethod · 0.80

Calls 5

read_txnMethod · 0.80
get_viewMethod · 0.45
iter_changesMethod · 0.45
get_externalMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected