This is an automated email from the ASF dual-hosted git repository.
gaul pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jclouds.git
The following commit(s) were added to refs/heads/master by this push:
new e478dd5452 JCLOUDS-1371: JCLOUDS-1488: optimize fs prefix
e478dd5452 is described below
commit e478dd5452d70a5ea2082337b05ad91f331f0eb6
Author: Andrew Gaul <[email protected]>
AuthorDate: Mon Dec 26 15:39:27 2022 +0900
JCLOUDS-1371: JCLOUDS-1488: optimize fs prefix
This reduces the number of stat calls required when prefix is deep in the
filesystem hierarchy. Further optimizations to delimiter are possible.
References gaul/s3proxy#473.
---
.../strategy/internal/FilesystemStorageStrategyImpl.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git
a/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
b/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
index f34b3aaf7c..92216f1b10 100644
---
a/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
+++
b/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
@@ -353,6 +353,14 @@ public class FilesystemStorageStrategyImpl implements
LocalStorageStrategy {
File containerFile = openFolder(container);
final int containerPathLength = containerFile.getAbsolutePath().length()
+ 1;
+ if (prefix != null) {
+ // prefix may end with a partial directory so only list the complete
parent
+ int index = prefix.lastIndexOf('/');
+ if (index != -1) {
+ containerFile = new File(containerFile, prefix.substring(0, index
+ 1));
+ }
+ }
+
populateBlobKeysInContainer(containerFile, blobNames, prefix, new
Function<String, String>() {
@Override
public String apply(String string) {