Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core): Deprecate OpList::version and add versions instead #5481

Merged
merged 7 commits into from
Dec 31, 2024

Conversation

geetanshjuneja
Copy link
Contributor

Which issue does this PR close?

Closes #5476.

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

///
/// Default to `false`
pub fn versioned(self, v: bool) -> Self {
self.map(|args| args.with_version(v))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also deprecate all use of OpList::version and change them to OpList::versioned.

@Xuanwo Xuanwo changed the title Deprecate version and add versioned refactor(core): Deprecate OpList::version and add versioned instead Dec 30, 2024
Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @geetanshjuneja, I apologize for not listing all the list_with_version patterns.

The OpenDAL API is a consistent system, so all fields like list_with_version should be deprecated in favor of list_with_versioned.

@@ -191,7 +191,7 @@ impl<A: Access> LayeredAccess for CapabilityAccessor<A> {
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() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list_with_version should also be depreated by list_with_versioned.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem I'll add that all also.

pub fn version(&self) -> bool {
self.version
}

/// Get the version of this list operation
pub fn versioned(&self) -> bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with_version should be replaced by with_versioned.

@@ -486,9 +486,21 @@ impl<F: Future<Output = Result<Vec<Entry>>>> FutureList<F> {
/// by the underlying service
///
/// Default to `false`
#[deprecated = "use versioned instead"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add a version field: 0.51.1


/// Get the version of this list operation
pub fn versioned(&self) -> bool {
self.version
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be changed by self.versioned

@@ -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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need to change. the version is the version in metadata, not for the versioned filter in list operation.

@@ -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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capability is part of opendal's public API so we can't simplely change it. Please add a new field and deprecate the old one.

@@ -529,6 +541,6 @@ impl<F: Future<Output = Result<Lister>>> FutureLister<F> {
///
/// Default to `false`
pub fn version(self, v: bool) -> Self {
self.map(|args| args.with_version(v))
self.map(|args| args.with_versioned(v))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a versioned for it too. Also, this API should be deprecated.

Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @geetanshjuneja, for this change; it mostly looks good to me now! I consulted with some native English speakers, and they all felt that list_with(path).versioned(true) was a bit confusing. Therefore, I will push another change to use versions(true) instead.

@Xuanwo Xuanwo changed the title refactor(core): Deprecate OpList::version and add versioned instead refactor(core): Deprecate OpList::version and add versions instead Dec 31, 2024
@Xuanwo Xuanwo merged commit 386b8de into apache:main Dec 31, 2024
241 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

new feature: Replace list_with().version() with list_with().versioned()
2 participants