nextcloud / nextcloud/android-library
Add bandwidth limit to file download and upload functions
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 105
- Forks
- 99
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 21
Description
What:
The Nextcloud Android client does not currently feature any way to limit bandwidth of the auto upload feature like the desktop client does. To add this feature this library would need to offer an API to limit the download and upload speed.
Why:
A client side limit is useful for cases where network bandwidth is limited and where the router the client is using is not smart enough to throttle invididual devices and insteads results in the entire network hanging (don't ask me how I know :P).
How:
I made a prototype to check the feasability of this by replacing the buffered input and output streams in DownloadFileRemoteOperation and FileRequestEntity with sources and sinks from okio which is a part of okhttp which is already included in the dependancies and then using a Throttler also from okio to then limit bandwidth. I ran some basic tests by uploading and downloading files using the sample client and on my setup upload and download speeds were within 5% of the original speed.
Alternativley an easier approach may be to just insert a delay in the buffer loops but that feels a little hacky to me compared to using okio.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with DownloadFileRemoteOperation.java and FileRequestEntity.java, then review the linked bandwidth-limit prototype and the existing Okio dependency. Determine the API needed to limit both download and upload speed, and validate the result with the sample client against the reported baseline speeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile-dev, networking
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100