|
@ -194,7 +194,7 @@ func (fsw *FilerStoreWrapper) DeleteFolderChildren(ctx context.Context, fp util. |
|
|
return actualStore.DeleteFolderChildren(ctx, fp) |
|
|
return actualStore.DeleteFolderChildren(ctx, fp) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (fsw *FilerStoreWrapper) ListDirectoryEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int) ([]*Entry, error) { |
|
|
|
|
|
|
|
|
func (fsw *FilerStoreWrapper) ListDirectoryEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int) ([]*Entry, bool, error) { |
|
|
actualStore := fsw.getActualStore(dirPath + "/") |
|
|
actualStore := fsw.getActualStore(dirPath + "/") |
|
|
stats.FilerStoreCounter.WithLabelValues(actualStore.GetName(), "list").Inc() |
|
|
stats.FilerStoreCounter.WithLabelValues(actualStore.GetName(), "list").Inc() |
|
|
start := time.Now() |
|
|
start := time.Now() |
|
@ -203,18 +203,18 @@ func (fsw *FilerStoreWrapper) ListDirectoryEntries(ctx context.Context, dirPath |
|
|
}() |
|
|
}() |
|
|
|
|
|
|
|
|
glog.V(4).Infof("ListDirectoryEntries %s from %s limit %d", dirPath, startFileName, limit) |
|
|
glog.V(4).Infof("ListDirectoryEntries %s from %s limit %d", dirPath, startFileName, limit) |
|
|
entries, err := actualStore.ListDirectoryEntries(ctx, dirPath, startFileName, includeStartFile, limit) |
|
|
|
|
|
|
|
|
entries, hasMore, err := actualStore.ListDirectoryEntries(ctx, dirPath, startFileName, includeStartFile, limit) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return nil, err |
|
|
|
|
|
|
|
|
return nil, hasMore, err |
|
|
} |
|
|
} |
|
|
for _, entry := range entries { |
|
|
for _, entry := range entries { |
|
|
fsw.maybeReadHardLink(ctx, entry) |
|
|
fsw.maybeReadHardLink(ctx, entry) |
|
|
filer_pb.AfterEntryDeserialization(entry.Chunks) |
|
|
filer_pb.AfterEntryDeserialization(entry.Chunks) |
|
|
} |
|
|
} |
|
|
return entries, err |
|
|
|
|
|
|
|
|
return entries, hasMore, err |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (fsw *FilerStoreWrapper) ListDirectoryPrefixedEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int, prefix string) ([]*Entry, error) { |
|
|
|
|
|
|
|
|
func (fsw *FilerStoreWrapper) ListDirectoryPrefixedEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int, prefix string) ([]*Entry, bool, error) { |
|
|
actualStore := fsw.getActualStore(dirPath + "/") |
|
|
actualStore := fsw.getActualStore(dirPath + "/") |
|
|
stats.FilerStoreCounter.WithLabelValues(actualStore.GetName(), "prefixList").Inc() |
|
|
stats.FilerStoreCounter.WithLabelValues(actualStore.GetName(), "prefixList").Inc() |
|
|
start := time.Now() |
|
|
start := time.Now() |
|
@ -222,25 +222,25 @@ func (fsw *FilerStoreWrapper) ListDirectoryPrefixedEntries(ctx context.Context, |
|
|
stats.FilerStoreHistogram.WithLabelValues(actualStore.GetName(), "prefixList").Observe(time.Since(start).Seconds()) |
|
|
stats.FilerStoreHistogram.WithLabelValues(actualStore.GetName(), "prefixList").Observe(time.Since(start).Seconds()) |
|
|
}() |
|
|
}() |
|
|
glog.V(4).Infof("ListDirectoryPrefixedEntries %s from %s prefix %s limit %d", dirPath, startFileName, prefix, limit) |
|
|
glog.V(4).Infof("ListDirectoryPrefixedEntries %s from %s prefix %s limit %d", dirPath, startFileName, prefix, limit) |
|
|
entries, err := actualStore.ListDirectoryPrefixedEntries(ctx, dirPath, startFileName, includeStartFile, limit, prefix) |
|
|
|
|
|
|
|
|
entries, hasMore, err := actualStore.ListDirectoryPrefixedEntries(ctx, dirPath, startFileName, includeStartFile, limit, prefix) |
|
|
if err == ErrUnsupportedListDirectoryPrefixed { |
|
|
if err == ErrUnsupportedListDirectoryPrefixed { |
|
|
entries, err = fsw.prefixFilterEntries(ctx, dirPath, startFileName, includeStartFile, limit, prefix) |
|
|
|
|
|
|
|
|
entries, hasMore, err = fsw.prefixFilterEntries(ctx, dirPath, startFileName, includeStartFile, limit, prefix) |
|
|
} |
|
|
} |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return nil, err |
|
|
|
|
|
|
|
|
return nil, hasMore, err |
|
|
} |
|
|
} |
|
|
for _, entry := range entries { |
|
|
for _, entry := range entries { |
|
|
fsw.maybeReadHardLink(ctx, entry) |
|
|
fsw.maybeReadHardLink(ctx, entry) |
|
|
filer_pb.AfterEntryDeserialization(entry.Chunks) |
|
|
filer_pb.AfterEntryDeserialization(entry.Chunks) |
|
|
} |
|
|
} |
|
|
return entries, nil |
|
|
|
|
|
|
|
|
return entries, hasMore, nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (fsw *FilerStoreWrapper) prefixFilterEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int, prefix string) (entries []*Entry, err error) { |
|
|
|
|
|
|
|
|
func (fsw *FilerStoreWrapper) prefixFilterEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int, prefix string) (entries []*Entry, hasMore bool, err error) { |
|
|
actualStore := fsw.getActualStore(dirPath + "/") |
|
|
actualStore := fsw.getActualStore(dirPath + "/") |
|
|
entries, err = actualStore.ListDirectoryEntries(ctx, dirPath, startFileName, includeStartFile, limit) |
|
|
|
|
|
|
|
|
entries, hasMore, err = actualStore.ListDirectoryEntries(ctx, dirPath, startFileName, includeStartFile, limit) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return nil, err |
|
|
|
|
|
|
|
|
return nil, hasMore, err |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if prefix == "" { |
|
|
if prefix == "" { |
|
@ -263,7 +263,7 @@ func (fsw *FilerStoreWrapper) prefixFilterEntries(ctx context.Context, dirPath u |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if count < limit { |
|
|
if count < limit { |
|
|
notPrefixed, err = actualStore.ListDirectoryEntries(ctx, dirPath, lastFileName, false, limit) |
|
|
|
|
|
|
|
|
notPrefixed, hasMore, err = actualStore.ListDirectoryEntries(ctx, dirPath, lastFileName, false, limit) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|