Struct Deleter
pub struct Deleter { /* private fields */ }Expand description
Deleter is designed to continuously remove content from storage.
It leverages batch deletion capabilities provided by storage services for efficient removal.
§Usage
Deleter provides several ways to delete files:
§Direct Deletion
Use the delete method to remove a single file:
use opendal_core::Operator;
use opendal_core::Result;
async fn example(op: Operator) -> Result<()> {
let mut d = op.deleter().await?;
d.delete("path/to/file").await?;
d.close().await?;
Ok(())
}Delete multiple files via a stream:
use futures::stream;
use opendal_core::Operator;
use opendal_core::Result;
async fn example(op: Operator) -> Result<()> {
let mut d = op.deleter().await?;
d.delete_stream(stream::iter(vec!["path/to/file"])).await?;
d.close().await?;
Ok(())
}§Using as a Sink
Deleter can be used as a Sink for file deletion:
use futures::stream;
use futures::Sink;
use futures::SinkExt;
use opendal_core::Operator;
use opendal_core::Result;
async fn example(op: Operator) -> Result<()> {
let mut sink = op.deleter().await?.into_sink();
sink.send("path/to/file").await?;
sink.close().await?;
Ok(())
}Implementations§
§impl Deleter
impl Deleter
pub async fn delete(&mut self, input: impl IntoDeleteInput) -> Result<(), Error>
pub async fn delete(&mut self, input: impl IntoDeleteInput) -> Result<(), Error>
Delete a path with default or per-entry options.
Pass a path directly to use options::DeleteOptions::default. Pass
(String, DeleteOptions) when this entry needs version or condition
options.
A successful call accepts the entry. Call Self::close to wait for
all accepted deletions to complete. With concurrency greater than one,
an error leaves the current entry unaccepted. This includes executor
rejection and errors from earlier backend tasks. Canceling a wait for
a task slot also leaves the entry unaccepted. If an interrupted close
is pending, this call resumes it before accepting another entry.
pub async fn delete_iter<I, D>(&mut self, iter: I) -> Result<(), Error>where
I: IntoIterator<Item = D>,
D: IntoDeleteInput,
pub async fn delete_iter<I, D>(&mut self, iter: I) -> Result<(), Error>where
I: IntoIterator<Item = D>,
D: IntoDeleteInput,
Delete an infallible iterator of paths.
Also see:
Deleter::delete_try_iter: delete a fallible iterator of paths.Deleter::delete_stream: delete an infallible stream of paths.Deleter::delete_try_stream: delete a fallible stream of paths.
pub async fn delete_try_iter<I, D>(&mut self, try_iter: I) -> Result<(), Error>
pub async fn delete_try_iter<I, D>(&mut self, try_iter: I) -> Result<(), Error>
Delete a fallible iterator of paths.
Also see:
Deleter::delete_iter: delete an infallible iterator of paths.Deleter::delete_stream: delete an infallible stream of paths.Deleter::delete_try_stream: delete a fallible stream of paths.
pub async fn delete_stream<S, D>(&mut self, stream: S) -> Result<(), Error>where
S: Stream<Item = D>,
D: IntoDeleteInput,
pub async fn delete_stream<S, D>(&mut self, stream: S) -> Result<(), Error>where
S: Stream<Item = D>,
D: IntoDeleteInput,
Delete an infallible stream of paths.
Also see:
Deleter::delete_iter: delete an infallible iterator of paths.Deleter::delete_try_iter: delete a fallible iterator of paths.Deleter::delete_try_stream: delete a fallible stream of paths.
pub async fn delete_try_stream<S, D>(
&mut self,
try_stream: S,
) -> Result<(), Error>
pub async fn delete_try_stream<S, D>( &mut self, try_stream: S, ) -> Result<(), Error>
Delete a fallible stream of paths.
Also see:
Deleter::delete_iter: delete an infallible iterator of paths.Deleter::delete_try_iter: delete a fallible iterator of paths.Deleter::delete_stream: delete an infallible stream of paths.
pub async fn close(&mut self) -> Result<(), Error>
pub async fn close(&mut self) -> Result<(), Error>
Flush accepted entries and wait for their deletions to complete.
With concurrency greater than one, this waits for every dispatched
task and returns the first error it observes, if any. Each call can
retry work whose failure was reported by an earlier call, using the
original paths and options. The deleter retains failed entries and
entries whose outcome is unknown. An accepted entry with a permanent
error, such as an unmet condition, can return that error again on a
later close. Dropping the future returned by
close preserves progress so the next call can resume it. Dropping
the deleter discards buffered work and cancels local tasks. Already
issued requests may still complete on the backend.
pub fn into_sink<T>(self) -> FuturesDeleteSink<T>where
T: IntoDeleteInput,
pub fn into_sink<T>(self) -> FuturesDeleteSink<T>where
T: IntoDeleteInput,
Convert the deleter into a sink.
Auto Trait Implementations§
impl !RefUnwindSafe for Deleter
impl !UnwindSafe for Deleter
impl Freeze for Deleter
impl Send for Deleter
impl Sync for Deleter
impl Unpin for Deleter
impl UnsafeUnpin for Deleter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].impl<T> MaybeSend for Twhere
T: Send,
impl<T> MaybeSend for Twhere
T: Send,
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> Scope for T
impl<T> Scope for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.