MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / rollback

Method rollback

nodedb/src/control/sequence/gap_free.rs:142–149  ·  view source on GitHub ↗

Rollback a reservation: decrement the counter, recycle the number. Releases the per-sequence lock so the next caller can proceed. `rollback_fn` is called to decrement the sequence counter by one increment.

(&self, handle: &ReservationHandle, rollback_fn: impl FnOnce())

Source from the content-addressed store, hash-verified

140 ///
141 /// `rollback_fn` is called to decrement the sequence counter by one increment.
142 pub fn rollback(&self, handle: &ReservationHandle, rollback_fn: impl FnOnce()) {
143 rollback_fn();
144
145 let locks = self.locks.lock().unwrap_or_else(|p| p.into_inner());
146 if let Some(lock) = locks.get(&handle.sequence_key) {
147 self.unlock_sequence(lock);
148 }
149 }
150
151 /// Release the per-sequence lock and wake one blocked waiter.
152 fn unlock_sequence(&self, lock: &SequenceLock) {

Callers 2

reserve_rollbackFunction · 0.45

Calls 3

lockMethod · 0.80
unlock_sequenceMethod · 0.80
getMethod · 0.45

Tested by 2

reserve_rollbackFunction · 0.36