test ListDirectoryPrefixedEntries

This commit is contained in:
Устюжанин Антон Александрович
2020-08-06 00:24:31 +05:00
parent 2d3b355fb6
commit a457c308ad
8 changed files with 56 additions and 8 deletions

View File

@@ -137,8 +137,10 @@ func (store *CassandraStore) ListDirectoryPrefixedEntries(ctx context.Context, f
if prefix == "" {
return notPrefixed, nil
}
var lastFileName string
for count < limit {
for _, entry := range notPrefixed {
lastFileName = entry.Name()
if strings.HasPrefix(entry.Name(), prefix) {
count++
entries = append(entries, entry)
@@ -148,10 +150,14 @@ func (store *CassandraStore) ListDirectoryPrefixedEntries(ctx context.Context, f
break
}
notPrefixed, err = store.ListDirectoryEntries(ctx, fullpath, startFileName, inclusive, limit)
notPrefixed, err = store.ListDirectoryEntries(ctx, fullpath, lastFileName, inclusive, limit)
if err != nil {
return nil, err
}
if len(notPrefixed) == 0 {
break
}
}
return entries, nil