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

Function dynamic_limit_adjustment

nodedb-mem/src/budget.rs:312–324  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

310
311 #[test]
312 fn dynamic_limit_adjustment() {
313 let budget = Budget::new(1024);
314 budget.try_reserve(600);
315
316 // Increase limit.
317 budget.set_limit(2048);
318 assert_eq!(budget.limit(), 2048);
319 assert!(budget.try_reserve(1000));
320
321 // Decrease limit — but not below current allocation.
322 budget.set_limit(100);
323 assert_eq!(budget.limit(), 1600); // max(100, 1600 allocated)
324 }
325
326 #[test]
327 fn try_reserve_arc_returns_shared_counter() {

Callers

nothing calls this directly

Calls 2

try_reserveMethod · 0.45
set_limitMethod · 0.45

Tested by

no test coverage detected