Return the names of all views whose change-set references `hash`.
(&self, hash: &Hash)
| 446 | |
| 447 | /// Return the names of all views whose change-set references `hash`. |
| 448 | pub fn views_containing_change(&self, hash: &Hash) -> Result<Vec<String>, RepositoryError> { |
| 449 | let txn = self |
| 450 | .pristine |
| 451 | .read_txn() |
| 452 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 453 | |
| 454 | let change_id = match txn |
| 455 | .get_internal(hash) |
| 456 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 457 | { |
| 458 | Some(id) => id, |
| 459 | None => return Ok(vec![]), |
| 460 | }; |
| 461 | |
| 462 | let mut names = Vec::new(); |
| 463 | for name in txn |
| 464 | .list_views() |
| 465 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 466 | { |
| 467 | let view = match txn |
| 468 | .get_view(&name) |
| 469 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 470 | { |
| 471 | Some(view) => view, |
| 472 | None => continue, |
| 473 | }; |
| 474 | if txn |
| 475 | .get_change_seq(&view, change_id) |
| 476 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 477 | .is_some() |
| 478 | { |
| 479 | names.push(name); |
| 480 | } |
| 481 | } |
| 482 | Ok(names) |
| 483 | } |
| 484 | |
| 485 | /// Check if a view exists. |
| 486 | /// |
no test coverage detected