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

Method set_limit

nodedb-mem/src/budget.rs:215–219  ·  view source on GitHub ↗

Update the limit dynamically (for rebalancing). The new limit must be >= current allocation. If it's less, the limit is set to the current allocation (no immediate eviction).

(&self, new_limit: usize)

Source from the content-addressed store, hash-verified

213 /// The new limit must be >= current allocation. If it's less, the limit
214 /// is set to the current allocation (no immediate eviction).
215 pub fn set_limit(&self, new_limit: usize) {
216 let allocated = self.allocated();
217 let effective = new_limit.max(allocated);
218 self.limit.store(effective, Ordering::Release);
219 }
220
221 /// Reset all counters (for testing).
222 #[cfg(test)]

Callers 1

dynamic_limit_adjustmentFunction · 0.45

Calls 2

allocatedMethod · 0.80
storeMethod · 0.45

Tested by 1

dynamic_limit_adjustmentFunction · 0.36