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,
|
ctx: ctx,
|
||||||
client: client,
|
client: client,
|
||||||
separator: folderSep,
|
separator: folderSep,
|
||||||
|
buckets: make(map[string]stiface.BucketHandle),
|
||||||
rawGcsObjects: make(map[string]*GcsFile),
|
rawGcsObjects: make(map[string]*GcsFile),
|
||||||
|
|
||||||
autoRemoveEmptyFolders: true,
|
autoRemoveEmptyFolders: true,
|
||||||
|
@ -109,6 +110,7 @@ func (fs *Fs) getBucket(name string) (stiface.BucketHandle, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
fs.buckets[name] = bucket
|
||||||
}
|
}
|
||||||
return bucket, nil
|
return bucket, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue