Find the sequence number for a change by its hash. # Arguments `txn` - Read transaction `view` - View to search `hash` - Hash of the change to find # Returns The sequence number if found, or None if the change is not in the view.
(
txn: &T,
view: &ViewState,
hash: &Hash,
)
| 310 | /// |
| 311 | /// The sequence number if found, or None if the change is not in the view. |
| 312 | pub fn find_change_sequence<T: ViewTxnT>( |
| 313 | txn: &T, |
| 314 | view: &ViewState, |
| 315 | hash: &Hash, |
| 316 | ) -> HistoryResult<Option<u64>> { |
| 317 | // First get the internal ID |
| 318 | let node_id = match txn.get_internal(hash) { |
| 319 | Ok(Some(id)) => id, |
| 320 | Ok(None) => return Ok(None), |
| 321 | Err(e) => return Err(HistoryError::Database(e.to_string())), |
| 322 | }; |
| 323 | |
| 324 | // Then look up the sequence |
| 325 | match txn.get_change_seq(view, node_id) { |
| 326 | Ok(seq) => Ok(seq), |
| 327 | Err(e) => Err(HistoryError::Database(e.to_string())), |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | /// Check if a change is in the view's history. |
| 332 | /// |
no test coverage detected