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

Method allocate

atomic-core/src/pristine/txn/write/mod.rs:56–62  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

54 }
55
56 fn allocate(&mut self) -> PristineResult<Inode> {
57 let inode = self.next.max(1);
58 self.next = inode
59 .checked_add(1)
60 .ok_or(PristineError::IdSpaceExhausted)?;
61 Ok(Inode::new(inode))
62 }
63
64 fn publish(self, shared: &AtomicU64) -> bool {
65 match shared.compare_exchange(self.expected, self.next, Ordering::SeqCst, Ordering::SeqCst)

Callers 1

alloc_inodeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected