Refuse unless `expected` is the view's snapshot now.
(repo: &Repository, view: &str, expected: &ViewSnapshot)
| 180 | |
| 181 | /// Refuse unless `expected` is the view's snapshot now. |
| 182 | fn fence(repo: &Repository, view: &str, expected: &ViewSnapshot) -> Result<ViewSnapshot, Status> { |
| 183 | let fence = wire::snapshot_fence(expected).map_err(invalid)?; |
| 184 | let current = current_snapshot(repo, view)?; |
| 185 | if wire::snapshot_fence(¤t).map_err(invalid)? != fence { |
| 186 | return Err(domain_status( |
| 187 | ErrorCode::ViewStale, |
| 188 | format!("view '{view}' has moved on; materialize it again"), |
| 189 | )); |
| 190 | } |
| 191 | Ok(current) |
| 192 | } |
| 193 | |
| 194 | fn wire_error(message: String) -> Status { |
| 195 | domain_status(ErrorCode::Internal, message) |
no test coverage detected