Bucket: add prefix support for GCP

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
Stefan Prodan 2023-10-17 14:50:13 +03:00
parent 6d4e654522
commit 674c287dbd
No known key found for this signature in database
GPG Key ID: 3299AEB0E4085BAF
2 changed files with 5 additions and 3 deletions

View File

@ -790,8 +790,8 @@ details and examples.
`.spec.prefix` is an optional field to enable server-side filtering
of files in the Bucket.
**Note:** The server-side filtering works only with the `generic` and `aws`
[provider](#provider) and is preferred over [`.spec.ignore`](#ignore)
**Note:** The server-side filtering works only with the `generic`, `aws`
and `gcp` [provider](#provider) and is preferred over [`.spec.ignore`](#ignore)
as a more efficient way of excluding files.
### Ignore

View File

@ -166,7 +166,9 @@ func (c *GCSClient) FGetObject(ctx context.Context, bucketName, objectName, loca
// If the underlying client or the visit callback returns an error,
// it returns early.
func (c *GCSClient) VisitObjects(ctx context.Context, bucketName string, prefix string, visit func(path, etag string) error) error {
items := c.Client.Bucket(bucketName).Objects(ctx, nil)
items := c.Client.Bucket(bucketName).Objects(ctx, &gcpstorage.Query{
Prefix: prefix,
})
for {
object, err := items.Next()
if err == IteratorDone {