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

Extract Common Listing and Retrieval Functionality #4220

Merged
merged 6 commits into from
May 18, 2023

Conversation

tustvold
Copy link
Contributor

Which issue does this PR close?

Closes #.

Rationale for this change

Extracts common listing and get functionality from the various cloud ObjectStore. This ends up being more code, but avoids duplication and so I think is probably better, would appreciate any thoughts?

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added the object-store Object Store Interface label May 15, 2023
@@ -302,89 +268,6 @@ impl S3Client {
Ok(())
}

/// Make an S3 List request <https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html>
async fn list_request(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just moved

@@ -169,40 +169,6 @@ impl S3Client {
self.config.credentials.get_credential().await
}

/// Make an S3 GET request <https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html>
pub async fn get_request(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is moved to be a trait implementation

}

/// Perform a list operation automatically handling pagination
pub fn list_paginated(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is now implemented by ListClientExt

@@ -0,0 +1,85 @@
// or more contributor license agreements. See the NOTICE file
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just moved from list.rs

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

The structure looks (really) nice to me. 🏅 work @tustvold

I think the new traits could do with some docs (maybe just pointing at the ObjectStore:: trait to explain their semantics) but otherwise 🚀 I think

) -> Result<(ListResult, Option<String>)> {
assert!(offset.is_none()); // Not yet supported
Copy link
Contributor

Choose a reason for hiding this comment

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

This should return an error rather than panic'ing I think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is unreachable by the current code

use reqwest::Response;

#[async_trait]
pub trait GetClient: Send + Sync + 'static {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think some this should have some comments / explination for what it is doing

@@ -346,22 +358,6 @@ impl AzureClient {

Ok((to_list_result(response, prefix)?, token))
}

/// Perform a list operation automatically handling pagination
Copy link
Contributor

Choose a reason for hiding this comment

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

This is now implemented indirectly via ListClientExt

@tustvold tustvold merged commit fe1b574 into apache:master May 18, 2023
tustvold added a commit to tustvold/arrow-rs that referenced this pull request May 18, 2023
tustvold added a commit that referenced this pull request May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
object-store Object Store Interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants