From 822ef76948b0399774262d87adb02696e4ff639e Mon Sep 17 00:00:00 2001 From: "mike.art" Date: Mon, 29 Apr 2024 15:38:10 +0200 Subject: [PATCH] Add buckets caching to GcsFS Without it each files interaction on GCS results in an unnecessary GetBucket request. --- gcsfs/fs.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcsfs/fs.go b/gcsfs/fs.go index b2a78fcc..1b854f81 100644 --- a/gcsfs/fs.go +++ b/gcsfs/fs.go @@ -54,6 +54,7 @@ func NewGcsFsWithSeparator(ctx context.Context, client stiface.Client, folderSep ctx: ctx, client: client, separator: folderSep, + buckets: make(map[string]stiface.BucketHandle), rawGcsObjects: make(map[string]*GcsFile), autoRemoveEmptyFolders: true, @@ -109,6 +110,7 @@ func (fs *Fs) getBucket(name string) (stiface.BucketHandle, error) { if err != nil { return nil, err } + fs.buckets[name] = bucket } return bucket, nil }