feat: add cancellation support for file and source uploads #252
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.
This pull request introduces several improvements and new features to the admin API library, focusing on enhanced document upload management, especially regarding cancellation and cleanup of in-progress uploads. The changes also include OpenAPI spec refinements, new abstract methods for upload cancellation, and corresponding implementation in the file uploader logic.
Key changes include:
API and OpenAPI Specification Enhancements
openapi.yamlto OpenAPI 3.0.2, added detailed endpoint descriptions, improved schema examples, clarified required fields, and refined the structure for better documentation and validation. [1] [2].openapi-generator-ignoreentries to prevent overwriting hand-maintained source files during code generation.Upload Cancellation Support
cancel_uploadabstract methods to bothFileUploaderandSourceUploaderbase classes, enabling a standard interface for upload cancellation by document identification. [1] [2]delete_documentendpoint logic to request cancellation of any in-progress file or source uploads before deleting the document, ensuring best-effort cleanup and preventing inconsistent states. [1] [2] [3]File Uploader Implementation Updates
cancel_uploadinDefaultFileUploaderto mark uploads as cancelled in the key-value store and log the action, supporting both namespaced and non-namespaced document IDs.UploadCancelledErrorexception to signal when a running upload is cancelled.These changes collectively make document deletion safer and more robust, improve API clarity, and lay the groundwork for better handling of concurrent or cancelled uploads.