Skip to content

Commit

Permalink
JCLOUDS-1371: JCLOUDS-1488: optimize fs prefix
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gaul committed Dec 26, 2022
1 parent 7e50ae6 commit 091bab1
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,14 @@ public Iterable<String> getBlobKeysInsideContainer(String container, String pref

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) {
Expand Down

0 comments on commit 091bab1

Please sign in to comment.