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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC-3911: Deleter API #3911
RFC-3911: Deleter API #3911
Changes from all commits
43b49aa
f99ae12
187b444
5b2c9e7
07c405d
6d2d18f
262897f
2b05340
307f8b1
5594629
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
deleter_api
Summary
Introduce the
Deleter
API to enhance batch and recursive deletion capabilities.Motivation
All OpenDAL's public API follow the same design:
read
: Execute a read operation.read_with
: Execute a read operation with additional options, like range and if_match.reader
: Create a reader for streaming data, enabling flexible access.reader_with
: Create a reader with advanced options.However,
delete
operations vary. OpenDAL offers several methods for file deletion:delete
: Delete a single file or an empty dir.remove
: Remove a list of files.remove_via
: Remove files produced by a stream.remove_all
: Remove all files under a path.This design is not consistent with the other APIs, and it is not easy to use.
So I propose
Deleter
to address them all at once.Guide-level explanation
The following new API will be added to
Operator
:delete
is the existing API, which deletes a single file or an empty dir.delete_with
is an extension of the existingdelete
API, which supports additional options, such asrecursive
.deleter
is a new API that returns aDeleter
instance.deleter_with
is an extension of the existingdeleter
API, which supports additional options, such asrecursive
.The following new options will be available for
delete_with
anddeleter_with
:recursive
: Enable recursive deletion.concurrent
: How many delete tasks can be performed concurrently?buffer
: How many files can be buffered for send in a single batch?Users can delete a file recursively in this way:
Users can delete multiple files in this way:
Deleter
also implementsSink
, so all the methods ofSink
are available forDeleter
. For example, users can useforward
to forward a stream of files toDeleter
:Users can control the behavior of
Deleter
by setting the options:In response to
Deleter
API, we will remove APIs likeremove
,remove_via
andremove_all
.remove
andremove_via
could be replaced byDeleter
directly.remove_all
could be replaced bydelete_with(path).recursive(true)
.Reference-level explanation
To provide those public APIs, we will add a new associated type in
Accessor
:And the
delete
API will be changed to return aoio::Delete
instead:Along with this change, we will remove the
batch
API fromAccessor
:Drawbacks
Rationale and alternatives
None.
Prior art
None.
Unresolved questions
None.
Future possibilities
Add API that accepts
IntoIterator
It's possible to add a new API that accepts
IntoIterator
so users can inputVec<String>
orIter<String>
intoDeleter
.