Skip to content

Commit

Permalink
Add RemoteSegmentStoreDirectory to interact with remote segment store
Browse files Browse the repository at this point in the history
Signed-off-by: Sachin Kale <kalsac@amazon.com>
  • Loading branch information
Sachin Kale committed Jul 28, 2022
1 parent 00db112 commit 6e053b4
Show file tree
Hide file tree
Showing 4 changed files with 833 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*
* @opensearch.internal
*/
public final class RemoteDirectory extends Directory {
public class RemoteDirectory extends Directory {

private final BlobContainer blobContainer;

Expand All @@ -50,6 +50,16 @@ public String[] listAll() throws IOException {
return blobContainer.listBlobs().keySet().stream().sorted().toArray(String[]::new);
}

/**
* Returns names of files with given prefix in this directory.
* @param filenamePrefix The prefix to match against file names in the directory
* @return A list of the matching filenames in the directory
* @throws IOException IOException if there were any failures in reading from the blob container
*/
public Collection<String> listFilesByPrefix(String filenamePrefix) throws IOException {
return blobContainer.listBlobsByPrefix(filenamePrefix).keySet();
}

/**
* Removes an existing file in the directory.
*
Expand Down
Loading

0 comments on commit 6e053b4

Please sign in to comment.