Storage: refactor filtering, improve performance (#47403)

* Storage: refactor filtering, improve performance

* added a comment to `newpathfilter`

* after merge fixes
This commit is contained in:
Artur Wierzbicki
2022-04-21 23:27:43 +04:00
committed by GitHub
parent 53a6c0210d
commit 9f0b6a5754
12 changed files with 483 additions and 380 deletions
@@ -24,11 +24,11 @@ type cdkBlobStorage struct {
bucket *blob.Bucket
}
func NewCdkBlobStorage(log log.Logger, bucket *blob.Bucket, rootFolder string, pathFilters *PathFilters) FileStorage {
func NewCdkBlobStorage(log log.Logger, bucket *blob.Bucket, rootFolder string, filter PathFilter) FileStorage {
return newWrapper(log, &cdkBlobStorage{
log: log,
bucket: bucket,
}, pathFilters, rootFolder)
}, filter, rootFolder)
}
func (c cdkBlobStorage) Get(ctx context.Context, filePath string) (*File, error) {
@@ -266,7 +266,7 @@ func (c cdkBlobStorage) list(ctx context.Context, folderPath string, paging *Pag
path := obj.Key
lowerPath := strings.ToLower(path)
allowed := options.IsAllowed(lowerPath)
allowed := options.Filter.IsAllowed(lowerPath)
if obj.IsDir && recursive && !visitedFolders[lowerPath] {
iterators = append([]*blob.ListIterator{c.bucket.List(&blob.ListOptions{