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

Method view_own_change_hashes

atomic-repository/src/repository/split.rs:490–511  ·  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

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

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