Return the names of all views whose change-set references `hash`.
(&self, hash: &Hash)
| 367 | |
| 368 | /// Return the names of all views whose change-set references `hash`. |
| 369 | pub fn views_containing_change(&self, hash: &Hash) -> Result<Vec<String>, RepositoryError> { |
| 370 | let txn = self |
| 371 | .pristine |
| 372 | .read_txn() |
| 373 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 374 | |
| 375 | let change_id = match txn |
| 376 | .get_internal(hash) |
| 377 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 378 | { |
| 379 | Some(id) => id, |
| 380 | None => return Ok(vec![]), |
| 381 | }; |
| 382 | |
| 383 | let mut names = Vec::new(); |
| 384 | for name in txn |
| 385 | .list_views() |
| 386 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 387 | { |
| 388 | let view = match txn |
| 389 | .get_view(&name) |
| 390 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 391 | { |
| 392 | Some(view) => view, |
| 393 | None => continue, |
| 394 | }; |
| 395 | if txn |
| 396 | .get_change_seq(&view, change_id) |
| 397 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 398 | .is_some() |
| 399 | { |
| 400 | names.push(name); |
| 401 | } |
| 402 | } |
| 403 | Ok(names) |
| 404 | } |
| 405 | |
| 406 | /// Check if a view exists. |
| 407 | /// |
no test coverage detected