From cd886b5f4d2263a4d655f16aa2a43569eeca43ac Mon Sep 17 00:00:00 2001 From: geetanshjuneja Date: Tue, 31 Dec 2024 07:52:09 +0000 Subject: [PATCH] more fn and fields deprecated --- core/src/layers/capability_check.rs | 2 +- core/src/raw/ops.rs | 2 +- core/src/types/capability.rs | 5 ++++- core/src/types/operator/operator_futures.rs | 12 ++++++++++++ core/tests/behavior/async_list.rs | 4 ++-- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/core/src/layers/capability_check.rs b/core/src/layers/capability_check.rs index 386b927ab06..0fb8639c678 100644 --- a/core/src/layers/capability_check.rs +++ b/core/src/layers/capability_check.rs @@ -298,7 +298,7 @@ mod tests { list_with_versioned: true, ..Default::default() }); - let res = op.lister_with("path/").version(true).await; + let res = op.lister_with("path/").versioned(true).await; assert!(res.is_ok()) } } diff --git a/core/src/raw/ops.rs b/core/src/raw/ops.rs index 817118015b4..4ef2e460744 100644 --- a/core/src/raw/ops.rs +++ b/core/src/raw/ops.rs @@ -184,7 +184,7 @@ impl OpList { } /// Change the version of this list operation - #[deprecated(since = "0.51.1", note = "use versioned instead")] + #[deprecated(since = "0.51.1", note = "use with_versioned instead")] pub fn with_version(mut self, version: bool) -> Self { self.versioned = version; self diff --git a/core/src/types/capability.rs b/core/src/types/capability.rs index 4377615a951..d3f354325c6 100644 --- a/core/src/types/capability.rs +++ b/core/src/types/capability.rs @@ -175,6 +175,9 @@ pub struct Capability { /// Indicates if recursive listing is supported. pub list_with_recursive: bool, /// Indicates if versioned listing is supported. + #[deprecated(since = "0.51.1", note = "use with_versioned instead")] + pub list_with_version: bool, + /// Indicates if versioned listing is supported. pub list_with_versioned: bool, /// Indicates whether cache control information is available in list response pub list_has_cache_control: bool, @@ -193,7 +196,7 @@ pub struct Capability { /// Indicates whether last modified timestamp is available in list response pub list_has_last_modified: bool, /// Indicates whether version information is available in list response - pub list_has_versioned: bool, + pub list_has_version: bool, /// Indicates whether user-defined metadata is available in list response pub list_has_user_metadata: bool, diff --git a/core/src/types/operator/operator_futures.rs b/core/src/types/operator/operator_futures.rs index 25afd405d26..5bba81fcfeb 100644 --- a/core/src/types/operator/operator_futures.rs +++ b/core/src/types/operator/operator_futures.rs @@ -540,7 +540,19 @@ impl>> FutureLister { /// by the underlying service /// /// Default to `false` + #[deprecated(since = "0.51.1", note = "use versioned instead")] pub fn version(self, v: bool) -> Self { self.map(|args| args.with_versioned(v)) } + + /// The version is used to control whether the object versions should be returned. + /// + /// - If `false`, list operation will not return with object versions + /// - If `true`, list operation will return with object versions if object versioning is supported + /// by the underlying service + /// + /// Default to `false` + pub fn versioned(self, v: bool) -> Self { + self.map(|args| args.with_versioned(v)) + } } diff --git a/core/tests/behavior/async_list.rs b/core/tests/behavior/async_list.rs index 483f8c5ab64..bff606e3e8b 100644 --- a/core/tests/behavior/async_list.rs +++ b/core/tests/behavior/async_list.rs @@ -633,7 +633,7 @@ pub async fn test_list_with_versioned_and_limit(op: Operator) -> Result<()> { .collect(); expected.push(parent.to_string()); - let mut objects = op.lister_with(parent).version(true).limit(5).await?; + let mut objects = op.lister_with(parent).versioned(true).limit(5).await?; let mut actual = vec![]; while let Some(o) = objects.try_next().await? { let path = o.path().to_string(); @@ -672,7 +672,7 @@ pub async fn test_list_with_versioned_and_start_after(op: Operator) -> Result<() let mut objects = op .lister_with(dir) - .version(true) + .versioned(true) .start_after(&given[2]) .await?; let mut actual = vec![];