MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / find_change_sequence

Function find_change_sequence

atomic-repository/src/history/operations.rs:193–210  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

191///
192/// The sequence number if found, or None if the change is not in the view.
193pub 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///

Callers 2

get_state_before_changeFunction · 0.70
get_changes_up_to_changeFunction · 0.70

Calls 2

get_internalMethod · 0.45
get_change_seqMethod · 0.45

Tested by

no test coverage detected