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

Function sequential_reservations

nodedb/src/control/sequence/gap_free.rs:203–217  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

201
202 #[test]
203 fn sequential_reservations() {
204 let mgr = GapFreeManager::new();
205 let counter = AtomicI64::new(0);
206
207 let h1 = mgr
208 .reserve("1:test", || Ok(counter.fetch_add(1, Ordering::Relaxed) + 1))
209 .unwrap();
210 mgr.commit(&h1);
211
212 let h2 = mgr
213 .reserve("1:test", || Ok(counter.fetch_add(1, Ordering::Relaxed) + 1))
214 .unwrap();
215 assert_eq!(h2.value, 2);
216 mgr.commit(&h2);
217 }
218
219 #[test]
220 fn different_sequences_independent() {

Callers

nothing calls this directly

Calls 2

reserveMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected