Skip to content

Commit

Permalink
Support list_with_offset for GCS (#4993)
Browse files Browse the repository at this point in the history
  • Loading branch information
tustvold authored Oct 30, 2023
1 parent e3cce56 commit e4bb1e9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions object_store/src/gcp/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,6 @@ impl ListClient for GoogleCloudStorageClient {
page_token: Option<&str>,
offset: Option<&str>,
) -> Result<(ListResult, Option<String>)> {
assert!(offset.is_none()); // Not yet supported

let credential = self.get_credential().await?;
let url = format!("{}/{}", self.config.base_url, self.bucket_name_encoded);

Expand All @@ -495,6 +493,10 @@ impl ListClient for GoogleCloudStorageClient {
query.push(("max-keys", max_results))
}

if let Some(offset) = offset {
query.push(("start-after", offset))
}

let response = self
.client
.request(Method::GET, url)
Expand Down
8 changes: 8 additions & 0 deletions object_store/src/gcp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ impl ObjectStore for GoogleCloudStorage {
self.client.list(prefix)
}

fn list_with_offset(
&self,
prefix: Option<&Path>,
offset: &Path,
) -> BoxStream<'_, Result<ObjectMeta>> {
self.client.list_with_offset(prefix, offset)
}

async fn list_with_delimiter(&self, prefix: Option<&Path>) -> Result<ListResult> {
self.client.list_with_delimiter(prefix).await
}
Expand Down

0 comments on commit e4bb1e9

Please sign in to comment.