Skip to content

Conversation

gaius-qi
Copy link
Member

Description

This pull request introduces support for tracking and configuring the number of pieces a peer can download concurrently (ConcurrentPieceCount) for both standard and persistent cache peers. It adds a default value, allows clients to specify this value, persists it in storage, and ensures it is properly propagated through the system. Additionally, the pull request updates dependencies in go.mod.

Peer concurrency support

  • Added ConcurrentPieceCount field to both standard.Peer and persistentcache.Peer structs, with a default value and a new functional option WithConcurrentPieceCount to allow explicit configuration. [1] [2] [3] [4] [5] [6]
  • Updated peer creation logic in both modules to initialize ConcurrentPieceCount and apply provided options. [1] [2] [3]
  • Modified peer manager and Redis persistence logic to store and retrieve ConcurrentPieceCount for persistent cache peers. [1] [2] [3] [4] [5]

API and service propagation

  • Updated scheduling and service layers to propagate ConcurrentPieceCount in RPC responses and peer construction, including handling client-provided values. [1] [2] [3] [4] [5] [6]

Testing improvements

  • Enhanced unit tests for both peer types to validate correct initialization and propagation of ConcurrentPieceCount, including cases with default and explicit values. [1] [2] [3] [4] [5] [6] [7] [8] [9]

Dependency updates

  • Updated d7y.io/api/v2 from v2.1.60 to v2.1.65 and google.golang.org/protobuf from v1.36.7 to v1.36.8 in go.mod. [1] [2]

Related Issue

Motivation and Context

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

@gaius-qi gaius-qi added this to the v2.4.0 milestone Sep 12, 2025
@gaius-qi gaius-qi self-assigned this Sep 12, 2025
@gaius-qi gaius-qi added the enhancement New feature or request label Sep 12, 2025
@gaius-qi gaius-qi force-pushed the feature/concurrent-piece branch from f071b0a to 41716e4 Compare September 12, 2025 07:46
@gaius-qi gaius-qi requested a review from Copilot September 12, 2025 07:48
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds support for tracking concurrent piece count per peer in both standard and persistent cache peers, enabling clients to specify how many pieces can be downloaded simultaneously. It also updates dependencies for API and protobuf packages.

  • Adds ConcurrentPieceCount field with default value and functional options for both peer types
  • Integrates concurrent piece count into peer storage/retrieval and RPC responses
  • Updates dependencies (d7y.io/api/v2 and google.golang.org/protobuf)

Reviewed Changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scheduler/resource/standard/peer.go Adds ConcurrentPieceCount field and WithConcurrentPieceCount option to standard peers
scheduler/resource/persistentcache/peer.go Adds ConcurrentPieceCount field and option support to persistent cache peers
scheduler/resource/persistentcache/peer_manager.go Updates Redis storage to persist and retrieve concurrent piece count
scheduler/service/service_v2.go Propagates concurrent piece count in RPC responses and peer creation
scheduler/scheduling/scheduling.go Includes concurrent piece count in scheduling responses
scheduler/resource/standard/peer_test.go Adds test coverage for concurrent piece count functionality
scheduler/resource/persistentcache/peer_test.go Updates tests to validate concurrent piece count behavior
scheduler/resource/persistentcache/peer_manager_test.go Updates manager tests with concurrent piece count assertions
scheduler/service/service_v2_test.go Adds test fixtures for concurrent piece count validation
scheduler/scheduling/scheduling_test.go Updates scheduling test to include concurrent piece count
go.mod Updates API and protobuf dependencies to newer versions

Copy link

codecov bot commented Sep 12, 2025

Codecov Report

❌ Patch coverage is 54.54545% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.64%. Comparing base (18695a8) to head (e9536bb).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
scheduler/service/service_v2.go 22.85% 26 Missing and 1 partial ⚠️
scheduler/resource/persistentcache/peer_manager.go 20.00% 7 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4315      +/-   ##
==========================================
+ Coverage   32.62%   32.64%   +0.01%     
==========================================
  Files         349      349              
  Lines       41411    41445      +34     
==========================================
+ Hits        13509    13528      +19     
- Misses      27023    27036      +13     
- Partials      879      881       +2     
Flag Coverage Δ
unittests 32.64% <54.54%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
scheduler/resource/persistentcache/peer.go 67.27% <100.00%> (+5.57%) ⬆️
scheduler/resource/standard/peer.go 72.40% <100.00%> (+0.56%) ⬆️
scheduler/scheduling/scheduling.go 61.97% <100.00%> (+0.05%) ⬆️
scheduler/resource/persistentcache/peer_manager.go 40.21% <20.00%> (-0.46%) ⬇️
scheduler/service/service_v2.go 50.59% <22.85%> (-0.19%) ⬇️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gaius-qi gaius-qi force-pushed the feature/concurrent-piece branch from 41716e4 to e9536bb Compare September 12, 2025 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants