mirror of https://github.com/spf13/afero.git
Add buckets caching to GcsFS
Without it each files interaction on GCS results in an unnecessary GetBucket request.
This commit is contained in:
parent
5c4385aa20
commit
822ef76948
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue