[feature] Improve upload management adaptive controller#194
Conversation
…t-adaptive-controller' into feature/improve-upload-management-adaptive-controller # Conflicts: # tests/ByteSync.Client.IntegrationTests/Services/Communications/Transfers/Upload_SliceAndParallelism_Tests.cs
There was a problem hiding this comment.
Pull Request Overview
This PR integrates the adaptive upload controller into the client-side upload pipeline by injecting IAdaptiveUploadController into the file upload factories. This enables dynamic bandwidth control through adaptive chunk sizing and parallelism during file uploads.
- Modify
FileUploadProcessorFactoryandFileUploaderFactoryto resolve and injectIAdaptiveUploadController - Update upload components to use adaptive methods instead of fixed parameters
- Add comprehensive test coverage for the new adaptive upload functionality
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
src/ByteSync.Client/Factories/FileUploadProcessorFactory.cs |
Injects IAdaptiveUploadController into the file upload processor |
src/ByteSync.Client/Factories/FileUploaderFactory.cs |
Injects IAdaptiveUploadController into the file uploader |
src/ByteSync.Client/Services/Communications/Transfers/Uploading/ |
Implements adaptive upload logic and adds adaptive methods |
src/ByteSync.Client/Interfaces/Controls/Communications/ |
Defines interfaces for adaptive upload functionality |
tests/ |
Comprehensive test coverage for adaptive upload functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/ByteSync.Client/Services/Communications/Transfers/Uploading/FileUploadWorker.cs
Show resolved
Hide resolved
src/ByteSync.Client/Services/Communications/Transfers/Uploading/FileUploadWorker.cs
Outdated
Show resolved
Hide resolved
src/ByteSync.Client/Services/Communications/Transfers/Uploading/FileSlicer.cs
Outdated
Show resolved
Hide resolved
src/ByteSync.Client/Services/Communications/Transfers/Uploading/FileUploader.cs
Outdated
Show resolved
Hide resolved
src/ByteSync.Client/Services/Communications/Transfers/Uploading/FileUploadWorker.cs
Show resolved
Hide resolved
| // Start upload workers | ||
| for (var i = 0; i < 2; i++) | ||
| // Start upload workers (adaptive) | ||
| for (var i = 0; i < _adaptiveUploadController.CurrentParallelism; i++) |
There was a problem hiding this comment.
note: if I understand correctly, the parallelism won't change for a given file. Besides, if two files are uploaded at the same time, the theorical parallelism will be doubled.
I think that it is not what has to be done: Parallelism must be able to change during file upload, and it must be shared across all uploads.
src/ByteSync.Client/Services/Communications/Transfers/Uploading/FileUploadProcessor.cs
Outdated
Show resolved
Hide resolved
|



Summary
Wire
IAdaptiveUploadControllerinto client-side factories so the adaptive upload controller is constructed and passed down into the upload pipeline.Changes
IAdaptiveUploadControllerresolution and injection in:src/ByteSync.Client/Factories/FileUploadProcessorFactory.cssrc/ByteSync.Client/Factories/FileUploaderFactory.csThese edits ensure the adaptive controller instance is available to
IFileUploadProcessorandIFileUploadervia DI, enabling adaptive chunk sizing/parallelism at runtime.Rationale
Prepares the client upload flow to leverage adaptive bandwidth control by providing the controller at composition time. This isolates policy/heuristics from factories and keeps consumers DI-friendly.
Technical Notes
IAdaptiveUploadControllerfrom the existing DI context and pass it as a typed parameter.Backward Compatibility
Risks
IAdaptiveUploadControlleris not registered.IAdaptiveUploadControllerand its implementation are registered in the client module(s).Testing
Manual smoke test suggestions:
Checklist
FileUploadProcessorFactoryFileUploaderFactory