Introduce concurrency-bounded parallel processing for index cache layers
Implement an `obipipeline::Throttle` with an RAII guard to acquire and release concurrency slots. Expose new bounded parallel methods on `IndexCache` to process cached layers with a configurable cap. Refactor downstream aggregation logic to use single-pass parallel map-reduce instead of manual collect-map-reduce sequences, enforcing a maximum of 8 concurrent layer scans to bound memory usage.
This commit is contained in:
1 parent
9dee6dcd08
commit
d084396aba
6 files changed
+211
-62
No files matched your search
@@ -35,6 +35,19 @@ impl Throttle {
|
||||
}
|
||||
}
|
||||
|
||||
impl Throttle {
|
||||
/// Acquire one slot and return a guard that releases it on drop —
|
||||
/// for callers with no natural "source iterator" to wrap via
|
||||
/// [`throttle`] (e.g. bounding concurrency inside a `rayon` parallel
|
||||
/// iterator's own closure, one call per item, rather than up front in
|
||||
/// a single source thread). Blocks the calling thread until a slot is
|
||||
/// free, same as [`throttle`]'s own per-item acquisition.
|
||||
pub fn acquire_guard(self: &Arc<Self>) -> ThrottleGuard {
|
||||
self.acquire();
|
||||
ThrottleGuard(Arc::clone(self))
|
||||
}
|
||||
}
|
||||
|
||||
// ── ThrottleGuard ─────────────────────────────────────────────────────────────
|
||||
|
||||
/// RAII guard: releases one slot in the `Throttle` when dropped.
|
||||
|
||||
Reference in new issue
Block a user