From d67ceadb5ce2a5fa462fabb16bd3ab47e310b007 Mon Sep 17 00:00:00 2001 From: geetanshjuneja Date: Mon, 30 Dec 2024 15:39:58 +0000 Subject: [PATCH 1/7] Deprecate version and add versioned --- core/src/types/operator/operator_futures.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/src/types/operator/operator_futures.rs b/core/src/types/operator/operator_futures.rs index 2d119055794f..b9663dd3f101 100644 --- a/core/src/types/operator/operator_futures.rs +++ b/core/src/types/operator/operator_futures.rs @@ -486,9 +486,21 @@ impl>>> FutureList { /// by the underlying service /// /// Default to `false` + #[deprecated = "use versioned instead"] pub fn version(self, v: bool) -> Self { self.map(|args| args.with_version(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_version(v)) + } } /// Future that generated by [`Operator::list_with`] or [`Operator::lister_with`]. From 6be969cc7f792d38f4206f74818077e334e645aa Mon Sep 17 00:00:00 2001 From: geetanshjuneja Date: Mon, 30 Dec 2024 16:05:29 +0000 Subject: [PATCH 2/7] deprecate oplist::version and change use of version to versioned --- core/src/layers/capability_check.rs | 6 +++--- core/src/raw/ops.rs | 6 ++++++ core/src/services/s3/backend.rs | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/core/src/layers/capability_check.rs b/core/src/layers/capability_check.rs index 7a5064bc6b27..ca3bb6d03e50 100644 --- a/core/src/layers/capability_check.rs +++ b/core/src/layers/capability_check.rs @@ -131,7 +131,7 @@ impl LayeredAccess for CapabilityAccessor { async fn list(&self, path: &str, args: OpList) -> crate::Result<(RpList, Self::Lister)> { let capability = self.info.full_capability(); - if !capability.list_with_version && args.version() { + if !capability.list_with_version && args.versioned() { return Err(new_unsupported_error( self.info.as_ref(), Operation::List, @@ -191,7 +191,7 @@ impl LayeredAccess for CapabilityAccessor { args: OpList, ) -> crate::Result<(RpList, Self::BlockingLister)> { let capability = self.info.full_capability(); - if !capability.list_with_version && args.version() { + if !capability.list_with_version && args.versioned() { return Err(new_unsupported_error( self.info.as_ref(), Operation::BlockingList, @@ -289,7 +289,7 @@ mod tests { list: true, ..Default::default() }); - let res = op.list_with("path/").version(true).await; + let res = op.list_with("path/").versioned(true).await; assert!(res.is_err()); assert_eq!(res.unwrap_err().kind(), ErrorKind::Unsupported); diff --git a/core/src/raw/ops.rs b/core/src/raw/ops.rs index 3b196d7b20ee..66d789cbc0f1 100644 --- a/core/src/raw/ops.rs +++ b/core/src/raw/ops.rs @@ -190,9 +190,15 @@ impl OpList { } /// Get the version of this list operation + #[deprecated = "use versioned instead"] pub fn version(&self) -> bool { self.version } + + /// Get the version of this list operation + pub fn versioned(&self) -> bool { + self.version + } } /// Args for `presign` operation. diff --git a/core/src/services/s3/backend.rs b/core/src/services/s3/backend.rs index 2d8ba50588e3..3a66f9638aa0 100644 --- a/core/src/services/s3/backend.rs +++ b/core/src/services/s3/backend.rs @@ -1060,7 +1060,7 @@ impl Access for S3Backend { } async fn list(&self, path: &str, args: OpList) -> Result<(RpList, Self::Lister)> { - let l = if args.version() { + let l = if args.versioned() { TwoWays::Two(PageLister::new(S3ObjectVersionsLister::new( self.core.clone(), path, From 08deaf4a13e0bae91a5d6aa2ae6f6c117bd17c69 Mon Sep 17 00:00:00 2001 From: geetanshjuneja Date: Mon, 30 Dec 2024 16:34:30 +0000 Subject: [PATCH 3/7] refactor --- core/src/layers/capability_check.rs | 6 +++--- core/src/raw/ops.rs | 19 +++++++++++++------ core/src/services/s3/backend.rs | 2 +- core/src/types/capability.rs | 4 ++-- core/src/types/operator/operator_futures.rs | 8 ++++---- core/tests/behavior/async_list.rs | 18 +++++++++--------- 6 files changed, 32 insertions(+), 25 deletions(-) diff --git a/core/src/layers/capability_check.rs b/core/src/layers/capability_check.rs index ca3bb6d03e50..72fa30c769e6 100644 --- a/core/src/layers/capability_check.rs +++ b/core/src/layers/capability_check.rs @@ -131,7 +131,7 @@ impl LayeredAccess for CapabilityAccessor { async fn list(&self, path: &str, args: OpList) -> crate::Result<(RpList, Self::Lister)> { let capability = self.info.full_capability(); - if !capability.list_with_version && args.versioned() { + if !capability.list_with_versioned && args.versioned() { return Err(new_unsupported_error( self.info.as_ref(), Operation::List, @@ -191,7 +191,7 @@ impl LayeredAccess for CapabilityAccessor { args: OpList, ) -> crate::Result<(RpList, Self::BlockingLister)> { let capability = self.info.full_capability(); - if !capability.list_with_version && args.versioned() { + if !capability.list_with_versioned && args.versioned() { return Err(new_unsupported_error( self.info.as_ref(), Operation::BlockingList, @@ -295,7 +295,7 @@ mod tests { let op = new_test_operator(Capability { list: true, - list_with_version: true, + list_with_versioned: true, ..Default::default() }); let res = op.lister_with("path/").version(true).await; diff --git a/core/src/raw/ops.rs b/core/src/raw/ops.rs index 66d789cbc0f1..817118015b48 100644 --- a/core/src/raw/ops.rs +++ b/core/src/raw/ops.rs @@ -111,7 +111,7 @@ pub struct OpList { /// by the underlying service /// /// Default to `false` - version: bool, + versioned: bool, } impl Default for OpList { @@ -121,7 +121,7 @@ impl Default for OpList { start_after: None, recursive: false, concurrent: 1, - version: false, + versioned: false, } } } @@ -184,20 +184,27 @@ impl OpList { } /// Change the version of this list operation + #[deprecated(since = "0.51.1", note = "use versioned instead")] pub fn with_version(mut self, version: bool) -> Self { - self.version = version; + self.versioned = version; + self + } + + /// Change the version of this list operation + pub fn with_versioned(mut self, versioned: bool) -> Self { + self.versioned = versioned; self } /// Get the version of this list operation - #[deprecated = "use versioned instead"] + #[deprecated(since = "0.51.1", note = "use versioned instead")] pub fn version(&self) -> bool { - self.version + self.versioned } /// Get the version of this list operation pub fn versioned(&self) -> bool { - self.version + self.versioned } } diff --git a/core/src/services/s3/backend.rs b/core/src/services/s3/backend.rs index 3a66f9638aa0..fdd13f29799c 100644 --- a/core/src/services/s3/backend.rs +++ b/core/src/services/s3/backend.rs @@ -982,7 +982,7 @@ impl Access for S3Backend { list_with_limit: true, list_with_start_after: true, list_with_recursive: true, - list_with_version: self.core.enable_versioning, + list_with_versioned: self.core.enable_versioning, list_has_etag: true, list_has_content_md5: true, list_has_content_length: true, diff --git a/core/src/types/capability.rs b/core/src/types/capability.rs index 76bbc09611a5..4377615a9515 100644 --- a/core/src/types/capability.rs +++ b/core/src/types/capability.rs @@ -175,7 +175,7 @@ pub struct Capability { /// Indicates if recursive listing is supported. pub list_with_recursive: bool, /// Indicates if versioned listing is supported. - pub list_with_version: bool, + pub list_with_versioned: bool, /// Indicates whether cache control information is available in list response pub list_has_cache_control: bool, /// Indicates whether content disposition information is available in list response @@ -193,7 +193,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_version: bool, + pub list_has_versioned: 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 b9663dd3f101..25afd405d261 100644 --- a/core/src/types/operator/operator_futures.rs +++ b/core/src/types/operator/operator_futures.rs @@ -486,9 +486,9 @@ impl>>> FutureList { /// by the underlying service /// /// Default to `false` - #[deprecated = "use versioned instead"] + #[deprecated(since = "0.51.1", note = "use versioned instead")] pub fn version(self, v: bool) -> Self { - self.map(|args| args.with_version(v)) + self.map(|args| args.with_versioned(v)) } /// The version is used to control whether the object versions should be returned. @@ -499,7 +499,7 @@ impl>>> FutureList { /// /// Default to `false` pub fn versioned(self, v: bool) -> Self { - self.map(|args| args.with_version(v)) + self.map(|args| args.with_versioned(v)) } } @@ -541,6 +541,6 @@ impl>> FutureLister { /// /// Default to `false` pub fn version(self, v: bool) -> Self { - self.map(|args| args.with_version(v)) + self.map(|args| args.with_versioned(v)) } } diff --git a/core/tests/behavior/async_list.rs b/core/tests/behavior/async_list.rs index 9e9367b1ab8c..679ab3f6135c 100644 --- a/core/tests/behavior/async_list.rs +++ b/core/tests/behavior/async_list.rs @@ -47,9 +47,9 @@ pub fn tests(op: &Operator, tests: &mut Vec) { test_list_file_with_recursive, test_list_root_with_recursive, test_remove_all, - test_list_files_with_version, - test_list_with_version_and_limit, - test_list_with_version_and_start_after + test_list_files_with_versioned, + test_list_with_versioned_and_limit, + test_list_with_versioned_and_start_after )) } @@ -575,8 +575,8 @@ pub async fn test_list_only(op: Operator) -> Result<()> { Ok(()) } -pub async fn test_list_files_with_version(op: Operator) -> Result<()> { - if !op.info().full_capability().list_with_version { +pub async fn test_list_files_with_versioned(op: Operator) -> Result<()> { + if !op.info().full_capability().list_with_versioned { return Ok(()); } @@ -608,13 +608,13 @@ pub async fn test_list_files_with_version(op: Operator) -> Result<()> { } // listing a directory with version, which contains more object versions than a page can take -pub async fn test_list_with_version_and_limit(op: Operator) -> Result<()> { +pub async fn test_list_with_versioned_and_limit(op: Operator) -> Result<()> { // Gdrive think that this test is an abuse of their service and redirect us // to an infinite loop. Let's ignore this test for gdrive. if op.info().scheme() == Scheme::Gdrive { return Ok(()); } - if !op.info().full_capability().list_with_version { + if !op.info().full_capability().list_with_versioned { return Ok(()); } @@ -648,8 +648,8 @@ pub async fn test_list_with_version_and_limit(op: Operator) -> Result<()> { Ok(()) } -pub async fn test_list_with_version_and_start_after(op: Operator) -> Result<()> { - if !op.info().full_capability().list_with_version { +pub async fn test_list_with_versioned_and_start_after(op: Operator) -> Result<()> { + if !op.info().full_capability().list_with_versioned { return Ok(()); } From eb451db8ea0ce5fdcbcd50c208646d2a0c65fd4b Mon Sep 17 00:00:00 2001 From: geetanshjuneja Date: Mon, 30 Dec 2024 16:47:39 +0000 Subject: [PATCH 4/7] ruby test fix --- bindings/ruby/src/capability.rs | 4 ++-- core/src/layers/capability_check.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bindings/ruby/src/capability.rs b/bindings/ruby/src/capability.rs index 03116534d57a..005e0722edf5 100644 --- a/bindings/ruby/src/capability.rs +++ b/bindings/ruby/src/capability.rs @@ -89,7 +89,7 @@ define_accessors!(Capability, { list_with_limit: bool, list_with_start_after: bool, list_with_recursive: bool, - list_with_version: bool, + list_with_versioned: bool, presign: bool, presign_read: bool, presign_stat: bool, @@ -137,7 +137,7 @@ pub fn include(gem_module: &RModule) -> Result<(), Error> { list_with_limit, list_with_start_after, list_with_recursive, - list_with_version, + list_with_versioned, presign, presign_read, presign_stat, diff --git a/core/src/layers/capability_check.rs b/core/src/layers/capability_check.rs index 72fa30c769e6..386b927ab06e 100644 --- a/core/src/layers/capability_check.rs +++ b/core/src/layers/capability_check.rs @@ -30,7 +30,7 @@ use std::sync::Arc; /// /// There are two main differences between this checker with the `CorrectnessChecker`: /// 1. This checker provides additional checks for capabilities like write_with_content_type and -/// list_with_version, among others. These capabilities do not affect data integrity, even if +/// list_with_versioned, among others. These capabilities do not affect data integrity, even if /// the underlying storage services do not support them. /// /// 2. OpenDAL doesn't apply this checker by default. Users can enable this layer if they want to From b6a8ef0516a0b8d88235513047a9de8370dc70d1 Mon Sep 17 00:00:00 2001 From: geetanshjuneja Date: Mon, 30 Dec 2024 16:54:21 +0000 Subject: [PATCH 5/7] test fix --- core/tests/behavior/async_list.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tests/behavior/async_list.rs b/core/tests/behavior/async_list.rs index 679ab3f6135c..483f8c5ab642 100644 --- a/core/tests/behavior/async_list.rs +++ b/core/tests/behavior/async_list.rs @@ -586,7 +586,7 @@ pub async fn test_list_files_with_versioned(op: Operator) -> Result<()> { op.write(file_path.as_str(), "1").await?; op.write(file_path.as_str(), "2").await?; - let mut ds = op.list_with(parent.as_str()).version(true).await?; + let mut ds = op.list_with(parent.as_str()).versioned(true).await?; ds.retain(|de| de.path() != parent.as_str()); assert_eq!(ds.len(), 2); From cd886b5f4d2263a4d655f16aa2a43569eeca43ac Mon Sep 17 00:00:00 2001 From: geetanshjuneja Date: Tue, 31 Dec 2024 07:52:09 +0000 Subject: [PATCH 6/7] 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 386b927ab06e..0fb8639c6788 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 817118015b48..4ef2e460744b 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 4377615a9515..d3f354325c6b 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 25afd405d261..5bba81fcfebd 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 483f8c5ab642..bff606e3e8ba 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![]; From 76794d50e4ed9a02baf116afb8ecf70380bb4d99 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Tue, 31 Dec 2024 17:53:17 +0800 Subject: [PATCH 7/7] Use versions for better reading Signed-off-by: Xuanwo --- bindings/ruby/src/capability.rs | 4 ++-- core/src/layers/capability_check.rs | 12 +++++------ core/src/raw/ops.rs | 20 ++++++++--------- core/src/services/s3/backend.rs | 4 ++-- core/src/types/capability.rs | 14 ++++++------ core/src/types/operator/operator_futures.rs | 16 +++++++------- core/tests/behavior/async_list.rs | 24 ++++++++++----------- 7 files changed, 47 insertions(+), 47 deletions(-) diff --git a/bindings/ruby/src/capability.rs b/bindings/ruby/src/capability.rs index 005e0722edf5..b3a7309f9ab4 100644 --- a/bindings/ruby/src/capability.rs +++ b/bindings/ruby/src/capability.rs @@ -89,7 +89,7 @@ define_accessors!(Capability, { list_with_limit: bool, list_with_start_after: bool, list_with_recursive: bool, - list_with_versioned: bool, + list_with_versions: bool, presign: bool, presign_read: bool, presign_stat: bool, @@ -137,7 +137,7 @@ pub fn include(gem_module: &RModule) -> Result<(), Error> { list_with_limit, list_with_start_after, list_with_recursive, - list_with_versioned, + list_with_versions, presign, presign_read, presign_stat, diff --git a/core/src/layers/capability_check.rs b/core/src/layers/capability_check.rs index 0fb8639c6788..449bf9ce79a7 100644 --- a/core/src/layers/capability_check.rs +++ b/core/src/layers/capability_check.rs @@ -30,7 +30,7 @@ use std::sync::Arc; /// /// There are two main differences between this checker with the `CorrectnessChecker`: /// 1. This checker provides additional checks for capabilities like write_with_content_type and -/// list_with_versioned, among others. These capabilities do not affect data integrity, even if +/// list_with_versions, among others. These capabilities do not affect data integrity, even if /// the underlying storage services do not support them. /// /// 2. OpenDAL doesn't apply this checker by default. Users can enable this layer if they want to @@ -131,7 +131,7 @@ impl LayeredAccess for CapabilityAccessor { async fn list(&self, path: &str, args: OpList) -> crate::Result<(RpList, Self::Lister)> { let capability = self.info.full_capability(); - if !capability.list_with_versioned && args.versioned() { + if !capability.list_with_versions && args.versions() { return Err(new_unsupported_error( self.info.as_ref(), Operation::List, @@ -191,7 +191,7 @@ impl LayeredAccess for CapabilityAccessor { args: OpList, ) -> crate::Result<(RpList, Self::BlockingLister)> { let capability = self.info.full_capability(); - if !capability.list_with_versioned && args.versioned() { + if !capability.list_with_versions && args.versions() { return Err(new_unsupported_error( self.info.as_ref(), Operation::BlockingList, @@ -289,16 +289,16 @@ mod tests { list: true, ..Default::default() }); - let res = op.list_with("path/").versioned(true).await; + let res = op.list_with("path/").versions(true).await; assert!(res.is_err()); assert_eq!(res.unwrap_err().kind(), ErrorKind::Unsupported); let op = new_test_operator(Capability { list: true, - list_with_versioned: true, + list_with_versions: true, ..Default::default() }); - let res = op.lister_with("path/").versioned(true).await; + let res = op.lister_with("path/").versions(true).await; assert!(res.is_ok()) } } diff --git a/core/src/raw/ops.rs b/core/src/raw/ops.rs index 4ef2e460744b..2620bb541a18 100644 --- a/core/src/raw/ops.rs +++ b/core/src/raw/ops.rs @@ -111,7 +111,7 @@ pub struct OpList { /// by the underlying service /// /// Default to `false` - versioned: bool, + versions: bool, } impl Default for OpList { @@ -121,7 +121,7 @@ impl Default for OpList { start_after: None, recursive: false, concurrent: 1, - versioned: false, + versions: false, } } } @@ -184,27 +184,27 @@ impl OpList { } /// Change the version of this list operation - #[deprecated(since = "0.51.1", note = "use with_versioned instead")] + #[deprecated(since = "0.51.1", note = "use with_versions instead")] pub fn with_version(mut self, version: bool) -> Self { - self.versioned = version; + self.versions = version; self } /// Change the version of this list operation - pub fn with_versioned(mut self, versioned: bool) -> Self { - self.versioned = versioned; + pub fn with_versions(mut self, versions: bool) -> Self { + self.versions = versions; self } /// Get the version of this list operation - #[deprecated(since = "0.51.1", note = "use versioned instead")] + #[deprecated(since = "0.51.1", note = "use versions instead")] pub fn version(&self) -> bool { - self.versioned + self.versions } /// Get the version of this list operation - pub fn versioned(&self) -> bool { - self.versioned + pub fn versions(&self) -> bool { + self.versions } } diff --git a/core/src/services/s3/backend.rs b/core/src/services/s3/backend.rs index fdd13f29799c..24f441f36c45 100644 --- a/core/src/services/s3/backend.rs +++ b/core/src/services/s3/backend.rs @@ -982,7 +982,7 @@ impl Access for S3Backend { list_with_limit: true, list_with_start_after: true, list_with_recursive: true, - list_with_versioned: self.core.enable_versioning, + list_with_versions: self.core.enable_versioning, list_has_etag: true, list_has_content_md5: true, list_has_content_length: true, @@ -1060,7 +1060,7 @@ impl Access for S3Backend { } async fn list(&self, path: &str, args: OpList) -> Result<(RpList, Self::Lister)> { - let l = if args.versioned() { + let l = if args.versions() { TwoWays::Two(PageLister::new(S3ObjectVersionsLister::new( self.core.clone(), path, diff --git a/core/src/types/capability.rs b/core/src/types/capability.rs index d3f354325c6b..2c4d3faf4023 100644 --- a/core/src/types/capability.rs +++ b/core/src/types/capability.rs @@ -76,7 +76,7 @@ pub struct Capability { pub stat_with_override_content_disposition: bool, /// Indicates if Content-Type header override is supported during stat operations. pub stat_with_override_content_type: bool, - /// Indicates if versioned stat operations are supported. + /// Indicates if versions stat operations are supported. pub stat_with_version: bool, /// Indicates whether cache control information is available in stat response pub stat_has_cache_control: bool, @@ -113,7 +113,7 @@ pub struct Capability { pub read_with_override_content_disposition: bool, /// Indicates if Content-Type header override is supported during read operations. pub read_with_override_content_type: bool, - /// Indicates if versioned read operations are supported. + /// Indicates if versions read operations are supported. pub read_with_version: bool, /// Indicates if the operator supports write operations. @@ -155,7 +155,7 @@ pub struct Capability { /// Indicates if delete operations are supported. pub delete: bool, - /// Indicates if versioned delete operations are supported. + /// Indicates if versions delete operations are supported. pub delete_with_version: bool, /// Maximum size supported for single delete operations. pub delete_max_size: Option, @@ -174,11 +174,11 @@ pub struct Capability { pub list_with_start_after: bool, /// 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")] + /// Indicates if versions listing is supported. + #[deprecated(since = "0.51.1", note = "use with_versions instead")] pub list_with_version: bool, - /// Indicates if versioned listing is supported. - pub list_with_versioned: bool, + /// Indicates if versions listing is supported. + pub list_with_versions: bool, /// Indicates whether cache control information is available in list response pub list_has_cache_control: bool, /// Indicates whether content disposition information is available in list response diff --git a/core/src/types/operator/operator_futures.rs b/core/src/types/operator/operator_futures.rs index 5bba81fcfebd..6c9e2aa42ea9 100644 --- a/core/src/types/operator/operator_futures.rs +++ b/core/src/types/operator/operator_futures.rs @@ -486,9 +486,9 @@ impl>>> FutureList { /// by the underlying service /// /// Default to `false` - #[deprecated(since = "0.51.1", note = "use versioned instead")] + #[deprecated(since = "0.51.1", note = "use versions instead")] pub fn version(self, v: bool) -> Self { - self.map(|args| args.with_versioned(v)) + self.map(|args| args.with_versions(v)) } /// The version is used to control whether the object versions should be returned. @@ -498,8 +498,8 @@ impl>>> FutureList { /// by the underlying service /// /// Default to `false` - pub fn versioned(self, v: bool) -> Self { - self.map(|args| args.with_versioned(v)) + pub fn versions(self, v: bool) -> Self { + self.map(|args| args.with_versions(v)) } } @@ -540,9 +540,9 @@ impl>> FutureLister { /// by the underlying service /// /// Default to `false` - #[deprecated(since = "0.51.1", note = "use versioned instead")] + #[deprecated(since = "0.51.1", note = "use versions instead")] pub fn version(self, v: bool) -> Self { - self.map(|args| args.with_versioned(v)) + self.map(|args| args.with_versions(v)) } /// The version is used to control whether the object versions should be returned. @@ -552,7 +552,7 @@ impl>> FutureLister { /// by the underlying service /// /// Default to `false` - pub fn versioned(self, v: bool) -> Self { - self.map(|args| args.with_versioned(v)) + pub fn versions(self, v: bool) -> Self { + self.map(|args| args.with_versions(v)) } } diff --git a/core/tests/behavior/async_list.rs b/core/tests/behavior/async_list.rs index bff606e3e8ba..6a0aa2ffb5ee 100644 --- a/core/tests/behavior/async_list.rs +++ b/core/tests/behavior/async_list.rs @@ -47,9 +47,9 @@ pub fn tests(op: &Operator, tests: &mut Vec) { test_list_file_with_recursive, test_list_root_with_recursive, test_remove_all, - test_list_files_with_versioned, - test_list_with_versioned_and_limit, - test_list_with_versioned_and_start_after + test_list_files_with_versions, + test_list_with_versions_and_limit, + test_list_with_versions_and_start_after )) } @@ -575,8 +575,8 @@ pub async fn test_list_only(op: Operator) -> Result<()> { Ok(()) } -pub async fn test_list_files_with_versioned(op: Operator) -> Result<()> { - if !op.info().full_capability().list_with_versioned { +pub async fn test_list_files_with_versions(op: Operator) -> Result<()> { + if !op.info().full_capability().list_with_versions { return Ok(()); } @@ -586,7 +586,7 @@ pub async fn test_list_files_with_versioned(op: Operator) -> Result<()> { op.write(file_path.as_str(), "1").await?; op.write(file_path.as_str(), "2").await?; - let mut ds = op.list_with(parent.as_str()).versioned(true).await?; + let mut ds = op.list_with(parent.as_str()).versions(true).await?; ds.retain(|de| de.path() != parent.as_str()); assert_eq!(ds.len(), 2); @@ -608,13 +608,13 @@ pub async fn test_list_files_with_versioned(op: Operator) -> Result<()> { } // listing a directory with version, which contains more object versions than a page can take -pub async fn test_list_with_versioned_and_limit(op: Operator) -> Result<()> { +pub async fn test_list_with_versions_and_limit(op: Operator) -> Result<()> { // Gdrive think that this test is an abuse of their service and redirect us // to an infinite loop. Let's ignore this test for gdrive. if op.info().scheme() == Scheme::Gdrive { return Ok(()); } - if !op.info().full_capability().list_with_versioned { + if !op.info().full_capability().list_with_versions { return Ok(()); } @@ -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).versioned(true).limit(5).await?; + let mut objects = op.lister_with(parent).versions(true).limit(5).await?; let mut actual = vec![]; while let Some(o) = objects.try_next().await? { let path = o.path().to_string(); @@ -648,8 +648,8 @@ pub async fn test_list_with_versioned_and_limit(op: Operator) -> Result<()> { Ok(()) } -pub async fn test_list_with_versioned_and_start_after(op: Operator) -> Result<()> { - if !op.info().full_capability().list_with_versioned { +pub async fn test_list_with_versions_and_start_after(op: Operator) -> Result<()> { + if !op.info().full_capability().list_with_versions { return Ok(()); } @@ -672,7 +672,7 @@ pub async fn test_list_with_versioned_and_start_after(op: Operator) -> Result<() let mut objects = op .lister_with(dir) - .versioned(true) + .versions(true) .start_after(&given[2]) .await?; let mut actual = vec![];