Return the names of all views whose change-set references `hash`.
(&self, hash: &Hash)
| 422 | |
| 423 | /// Return the names of all views whose change-set references `hash`. |
| 424 | pub fn views_containing_change(&self, hash: &Hash) -> Result<Vec<String>, RepositoryError> { |
| 425 | let txn = self |
| 426 | .pristine |
| 427 | .read_txn() |
| 428 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 429 | |
| 430 | let change_id = match txn |
| 431 | .get_internal(hash) |
| 432 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 433 | { |
| 434 | Some(id) => id, |
| 435 | None => return Ok(vec![]), |
| 436 | }; |
| 437 | |
| 438 | let mut names = Vec::new(); |
| 439 | for name in txn |
| 440 | .list_views() |
| 441 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 442 | { |
| 443 | let view = match txn |
| 444 | .get_view(&name) |
| 445 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 446 | { |
| 447 | Some(view) => view, |
| 448 | None => continue, |
| 449 | }; |
| 450 | if txn |
| 451 | .get_change_seq(&view, change_id) |
| 452 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 453 | .is_some() |
| 454 | { |
| 455 | names.push(name); |
| 456 | } |
| 457 | } |
| 458 | Ok(names) |
| 459 | } |
| 460 | |
| 461 | /// Check if a view exists. |
| 462 | /// |
no test coverage detected