Skip to content

Commit

Permalink
Merge pull request #76 from andyasp/aasp/gcs-set-attrs
Browse files Browse the repository at this point in the history
GCS: use Query.SetAttrSelection when listing objects
  • Loading branch information
fpetkovski committed Sep 13, 2023
2 parents 8d397d4 + 02d54dc commit eb06103
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
- [#64](https://github.com/thanos-io/objstore/pull/64) OCI: OKE Workload Identity support.
- [#73](https://github.com/thanos-io/objstore/pull/73) Аdded file path to erros from DownloadFile
- [#51](https://github.com/thanos-io/objstore/pull/51) Azure: Support using connection string authentication.
- [#76](https://github.com/thanos-io/objstore/pull/76) GCS: Query for object names only in `Iter` to possibly improve performance when listing objects.

### Changed
- [#38](https://github.com/thanos-io/objstore/pull/38) *: Upgrade minio-go version to `v7.0.45`.
Expand Down
10 changes: 8 additions & 2 deletions providers/gcs/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,16 @@ func (b *Bucket) Iter(ctx context.Context, dir string, f func(string) error, opt
delimiter = ""
}

it := b.bkt.Objects(ctx, &storage.Query{
query := &storage.Query{
Prefix: dir,
Delimiter: delimiter,
})
}
err := query.SetAttrSelection([]string{"Name"})
if err != nil {
return err
}

it := b.bkt.Objects(ctx, query)
for {
select {
case <-ctx.Done():
Expand Down

0 comments on commit eb06103

Please sign in to comment.