Skip to content

Select admitted v2 pieces by peer rarity - #201

Closed
linroid wants to merge 1 commit into
torrent-v2-08-peer-bitfieldsfrom
torrent-v2-08-rarity
Closed

linroid wants to merge 1 commit into
torrent-v2-08-peer-bitfieldsfrom
torrent-v2-08-rarity

Conversation

@linroid

@linroid linroid commented Sep 12, 2026

Copy link
Copy Markdown
Owner

V2 scheduling can now choose the rarest eligible piece advertised by a peer. The rarity index and compact peer snapshots are admitted before allocation; bitfield replacement, duplicate haves and peer removal update counts without aliasing caller data. Equal-rarity choices rotate, and selection avoids candidate-list allocations.

The scheduler precomputes wanted/verified/busy indexes for candidate eligibility. Its state allowance scales with actual blocks per piece, permitting more concurrent small pieces under the same budgets instead of charging every assembly as a 16 MiB piece.

Stacked on #200, under #162. Full peer/session availability routing, generation barriers, adaptive streaming/endgame policy, upload/hash serving and independent-client interoperability remain unfinished. Worst-case selection scans the bounded piece index; large-swarm CPU and throughput gates remain unproven.

Validation at 28152e91056110780f8481374c79b503813e5e6a:

  • 468 JVM tests and 447 actually executed iOS simulator tests; zero failures, errors or skips.
  • Both pinned v1 conformance scenarios and the native-runtime dependency guard pass.
  • Tests cover rarity/tie choices, replacement/removal, duplicate haves, malformed/unadmitted snapshots, empty/million-piece indexes, automatic candidate integration and admission of 128 small pieces within bounded state/payload budgets.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-09-12T18:51:16.309137Z 28152e9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

  677 files  + 5    677 suites  +5   4m 11s ⏱️ -41s
2 783 tests +18  2 783 ✅ +18  0 💤 ±0  0 ❌ ±0 
3 717 runs  +30  3 717 ✅ +30  0 💤 ±0  0 ❌ ±0 

Results for commit 28152e9. ± Comparison against base commit 4dd5256.

@linroid

linroid commented Sep 20, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #236 (V2 scheduling and download execution) in the consolidated eight-PR stack for #162.

The replacement preserves this PR's code and subsequent fixes; its description links the original head and review discussions. The only additional consolidation fix is the CI-discovered listener cancellation regression, documented on the replacement. All eight replacements have passed their required CI checks.

Closing without merging. This branch and its discussions remain available for reference. Review index: #162 (comment)

@linroid linroid closed this Sep 20, 2026
@linroid
linroid deleted the torrent-v2-08-rarity branch September 20, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant