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,
)
| 191 | /// |
| 192 | /// The sequence number if found, or None if the change is not in the view. |
| 193 | pub fn find_change_sequence<T: ViewTxnT>( |
| 194 | txn: &T, |
| 195 | view: &ViewState, |
| 196 | hash: &Hash, |
| 197 | ) -> HistoryResult<Option<u64>> { |
| 198 | // First get the internal ID |
| 199 | let node_id = match txn.get_internal(hash) { |
| 200 | Ok(Some(id)) => id, |
| 201 | Ok(None) => return Ok(None), |
| 202 | Err(e) => return Err(HistoryError::Database(e.to_string())), |
| 203 | }; |
| 204 | |
| 205 | // Then look up the sequence |
| 206 | match txn.get_change_seq(view, node_id) { |
| 207 | Ok(seq) => Ok(seq), |
| 208 | Err(e) => Err(HistoryError::Database(e.to_string())), |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | /// Get the state immediately before a change was applied. |
| 213 | /// |
no test coverage detected