[feature] Enable cleanup in CloudflareR2 post-process#164
Merged
Ghass-M merged 8 commits intofeature/data-nodes-and-local-syncfrom Aug 12, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enables proper file cleanup for CloudflareR2 storage provider by implementing storage provider-aware deletion logic throughout the file transfer system. Previously, files were only being deleted from AzureBlobStorage regardless of where they were actually stored.
- Modified
SharedFilesServiceto accept storage provider parameter and route deletion calls to appropriate service - Updated
TransferParametersandSharedFileDatato track storage provider information - Enhanced command handlers and client code to pass storage provider context through the deletion chain
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
SharedFilesService.cs |
Implements storage provider-aware deletion logic using switch expressions for both services |
ISharedFilesService.cs |
Adds storage provider parameter to AssertFilePartIsDownloaded method signature |
AssertFilePartIsDownloadedCommandHandler.cs |
Passes storage provider from transfer parameters to service call |
SharedFileData.cs |
Adds StorageProvider property to track which storage service was used |
TransferParameters.cs |
Adds StorageProvider property to carry context through transfer operations |
FileDownloader.cs |
Extracts storage provider from download response and passes to assertion method |
AssertFilePartIsDownloadedCommandHandlerTests.cs |
Updates tests to cover both storage providers with parameterized test cases |
Contributor
paul-fresquet
left a comment
There was a problem hiding this comment.
Nice work :) Here are few comments
src/ByteSync.ServerCommon/Interfaces/Services/ISharedFilesService.cs
Outdated
Show resolved
Hide resolved
…des-and-local-sync-selective-deletion
…c-selective-deletion' into feature/data-nodes-and-local-sync-selective-deletion
|
paul-fresquet
approved these changes
Aug 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



🗂️ Fix CloudflareR2 file deletion in transfer completion
📋 Summary
This PR addresses the issue where files on CloudflareR2 were not being deleted at the end of a transfer because ByteSync was only attempting to delete from AzureBlobStorage. The implementation now properly handles file deletion for both storage providers based on the
StorageProviderparameter.🎯 Problem
✅ Solution
1. TransferParameters StorageProvider Support
TransferParametersclass already hadStorageProviderproperty2. SharedFilesService.AssertFilePartIsDownloaded Enhancement
StorageProvider storageProviderparameter3. SharedFileData StorageProvider Storage
SharedFileDataalready storesStorageProviderpropertyClearSessionto select the correct service for cleanup4. ClearSession Enhancement
ClearSessionmethod now usessharedFileData.StorageProviderto determine deletion service5. Command Handler Integration
AssertFilePartIsDownloadedCommandHandlerextractsStorageProviderfromTransferParametersSharedFilesService.AssertFilePartIsDownloaded🔄 Flow
TransferParameterswithStorageProviderStorageProviderfrom requestStorageProviderparameter_blobUrlService.DeleteBlob()_cloudflareR2UrlService.DeleteObject()StorageProviderfromSharedFileDatafor cleanup🎉 Benefits
Deployment Notes