1.2 KiB
1.2 KiB
S019 — Limiter, modes and priority shares
Category 04 Control · Model: Opus · Effort: high · Depends on: S006 · Size: L · Human: no Files touched: crates/core/src/limit/**, crates/core/tests/limit*
Goal
FEATURES 2.1, 2.2, 2.3.
Read
- crates/core/src/{segment,manager,site}*
- docs/FEATURES.md §2
Steps
- Hierarchical token buckets (total, queue, host, download) with a virtual clock for tests
- Weighted fair sharing by priority for bandwidth and connections; unused share flows to others; no starvation of the lowest
- "Only this one" mode that pauses the rest and restores them
- Three editable modes plus snail, switched live without reconnecting
- Small reads under low limits so speed stays even; limit accuracy within 5 % from 10 KB/s to 1 GB/s
- Socket receive pressure so a limit really slows the sender
docs/PROGRESS.mdentry, tickPlans/INDEX.md, commitS019: …, push
End criteria
nice cargo test -j 2 -p medlar-core --test limitgreen: accuracy, shares 1:2:4, live change under 500 ms, overhead under 3 % at full speed
Pitfalls
Sleeping per chunk at low speeds causes bursts and idle timeouts; keep connections alive.
Handoff (→ PROGRESS.md)
Limit and mode API.