Bucket: add prefix support for GCP
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
parent
6d4e654522
commit
674c287dbd
|
@ -790,8 +790,8 @@ details and examples.
|
||||||
`.spec.prefix` is an optional field to enable server-side filtering
|
`.spec.prefix` is an optional field to enable server-side filtering
|
||||||
of files in the Bucket.
|
of files in the Bucket.
|
||||||
|
|
||||||
**Note:** The server-side filtering works only with the `generic` and `aws`
|
**Note:** The server-side filtering works only with the `generic`, `aws`
|
||||||
[provider](#provider) and is preferred over [`.spec.ignore`](#ignore)
|
and `gcp` [provider](#provider) and is preferred over [`.spec.ignore`](#ignore)
|
||||||
as a more efficient way of excluding files.
|
as a more efficient way of excluding files.
|
||||||
|
|
||||||
### Ignore
|
### Ignore
|
||||||
|
|
|
@ -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,
|
// If the underlying client or the visit callback returns an error,
|
||||||
// it returns early.
|
// it returns early.
|
||||||
func (c *GCSClient) VisitObjects(ctx context.Context, bucketName string, prefix string, visit func(path, etag string) error) error {
|
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 {
|
for {
|
||||||
object, err := items.Next()
|
object, err := items.Next()
|
||||||
if err == IteratorDone {
|
if err == IteratorDone {
|
||||||
|
|
Loading…
Reference in New Issue