Struct CopyOptions
pub struct CopyOptions {
pub if_not_exists: bool,
pub if_match: Option<String>,
pub if_none_match: Option<String>,
pub if_version_match: Option<String>,
pub if_version_not_match: Option<String>,
pub if_not_changed: Option<Metadata>,
pub source_version: Option<String>,
pub source_content_length_hint: Option<u64>,
pub concurrent: usize,
pub chunk: Option<usize>,
}Expand description
Options for copy operations.
Each condition checks the destination file, never the source, and every condition must hold for the copy to proceed:
- A false condition fails the copy with
crate::ErrorKind::ConditionNotMatch. - A condition the service does not advertise through its capability fails
the copy with
crate::ErrorKind::Unsupported; OpenDAL never silently drops a condition. - A missing source fails the copy with
crate::ErrorKind::NotFound; when a condition error applies at the same time, which error the copy returns is unspecified. - A service-side conflict unrelated to these conditions surfaces as
crate::ErrorKind::Conflict.
See the conditional operation specification for the complete cross-operation contract.
Fields§
§if_not_exists: boolCopy only when no file exists at the destination path.
The condition succeeds when the destination path is empty, so the
copy creates the destination file. An existing destination file fails
the copy with crate::ErrorKind::ConditionNotMatch.
The operation returns crate::ErrorKind::Unsupported when the
service does not advertise
crate::Capability::copy_with_if_not_exists.
if_match: Option<String>Copy only when the destination file has this exact ETag.
The condition succeeds when the destination file exists and its ETag
equals this value. A destination file with a different ETag, or a
missing destination file, fails the copy with
crate::ErrorKind::ConditionNotMatch. Only concrete ETag values
are portable; a wildcard such as "*" has no portable meaning here.
The operation returns crate::ErrorKind::Unsupported when the
service does not advertise crate::Capability::copy_with_if_match.
if_none_match: Option<String>Copy only when the destination file does not have this ETag.
With a concrete ETag value, the condition succeeds when the
destination file has a different ETag or does not exist; the copy
then replaces or creates the destination file. A destination file
whose ETag equals this value fails the copy with
crate::ErrorKind::ConditionNotMatch. Only concrete ETag values
are portable; a wildcard such as "*" has no portable meaning here.
The operation returns crate::ErrorKind::Unsupported when the
service does not advertise
crate::Capability::copy_with_if_none_match.
if_version_match: Option<String>Copy only when the destination file has this exact version.
The condition succeeds when the destination file exists and its
version equals this value. A destination file with a different
version, or a missing destination file, fails the copy with
crate::ErrorKind::ConditionNotMatch.
The operation returns crate::ErrorKind::Unsupported when the
service does not advertise
crate::Capability::copy_with_if_version_match.
if_version_not_match: Option<String>Copy only when the destination file does not have this version.
The condition succeeds when the destination file exists with a
different version. A destination file whose version equals this value
fails the copy with crate::ErrorKind::ConditionNotMatch. When no
destination file exists, no portable behavior is defined.
The operation returns crate::ErrorKind::Unsupported when the
service does not advertise
crate::Capability::copy_with_if_version_not_match.
if_not_changed: Option<Metadata>Copy only when the destination file still has the identity recorded in this metadata.
Pass metadata previously returned by OpenDAL for the destination
path. OpenDAL derives a version match when the service supports version
conditions and the metadata contains a version. Otherwise it derives
an ETag match when possible. A changed or missing destination file
fails the copy with crate::ErrorKind::ConditionNotMatch, as does
combining this option with a conflicting if_match or
if_version_match value.
The operation returns crate::ErrorKind::Unsupported when the
service does not support the derived primitive condition, and
crate::ErrorKind::ConfigInvalid when the metadata contains neither
a version nor an ETag.
source_version: Option<String>Copy from a specific source file version.
This selects which stored version of the source the copy reads; it is not a condition on the destination file. Destination behavior follows normal copy semantics.
Check crate::Capability::copy_with_source_version before using
this option.
source_content_length_hint: Option<u64>Asserted complete content length of the source object.
OpenDAL may trust this value without reading source metadata. It can use the value to plan copied ranges and to construct the returned metadata. An incorrect value can therefore cause incomplete copy planning, failed requests, or incorrect result metadata.
A service can ignore this value when its copy operation already reports an authoritative copied size.
This option does not pin the source object or protect the copy from a
concurrent source change. Set it only when the caller can guarantee that
the value describes the object that the service will copy, for example by
selecting an immutable Self::source_version. Otherwise omit it if the
source can change.
concurrent: usizeSets concurrent copy operations for this copier.
This is a best-effort execution option. Services that cannot split copy into concurrent server-side tasks can ignore it.
chunk: Option<usize>Sets chunk size for segmented copy operations.
§Capability
Check crate::Capability::copy_can_multi,
crate::Capability::copy_multi_min_size and
crate::Capability::copy_multi_max_size before using this feature.
This is a best-effort execution option. Services that support server-side segmented copy can use it as the target size for each copy step. Services that cannot split copy operations can ignore it.
Trait Implementations§
§impl Clone for CopyOptions
impl Clone for CopyOptions
§fn clone(&self) -> CopyOptions
fn clone(&self) -> CopyOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for CopyOptions
impl Debug for CopyOptions
§impl Default for CopyOptions
impl Default for CopyOptions
§fn default() -> CopyOptions
fn default() -> CopyOptions
§impl PartialEq for CopyOptions
impl PartialEq for CopyOptions
impl Eq for CopyOptions
impl StructuralPartialEq for CopyOptions
Auto Trait Implementations§
impl Freeze for CopyOptions
impl RefUnwindSafe for CopyOptions
impl Send for CopyOptions
impl Sync for CopyOptions
impl Unpin for CopyOptions
impl UnsafeUnpin for CopyOptions
impl UnwindSafe for CopyOptions
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moreSource§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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§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>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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> 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> 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.