Cloudflare R2 backup - Improved buffer handling#162958
Conversation
|
Hey there @corrreia, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Pull request overview
This PR applies improved buffer handling from the IDrive e2 backup implementation (#144910) to the Cloudflare R2 backup integration. The changes introduce memoryview-based buffer management with offset tracking to reduce memory copies during multipart uploads, improving performance for large backup files.
Changes:
- Added memoryview-based buffer handling with offset tracking for multipart uploads
- Implemented buffer compaction logic to avoid unnecessary memory copies
- Added cast(Any, ...) for client method calls to handle type checking
|
This looks good! A a solid improvement, especially for bigger backup sizes |
|
Have you tested this with multipart uploads? R2 can be pretty finicky with those in my experience |
I tested it against idrive-e2 because I don't have Cloudflare-R2. Would be great if you could verify, |
|
@zweckj confirmed, multipart works! |
Proposed change
The new IDrive-e2 S3 backup implementation introduces improved buffer handling using memoryview.
During the review of #144910, it was requested to apply the same approach to the other S3-compatible backup implementations.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: