From 6be969cc7f792d38f4206f74818077e334e645aa Mon Sep 17 00:00:00 2001 From: geetanshjuneja Date: Mon, 30 Dec 2024 16:05:29 +0000 Subject: [PATCH] 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,