Skip to content

Commit

Permalink
Support list_with_offset for GCS
Browse files Browse the repository at this point in the history
  • Loading branch information
tustvold committed Oct 25, 2023
1 parent c90aff3 commit f5917b3
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 @@ -376,8 +376,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 @@ -399,6 +397,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 @@ -156,6 +156,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 f5917b3

Please sign in to comment.