public CompletableFuture<Page<NamedBlobRecord>> listRecursively(String accountName, String containerName,
        String blobNamePrefix, String pageToken, Integer maxKey, boolean groupDirectories) {

      // Start with an empty aggregated Page.
      Page<NamedBlobRecord> initialAggregatedPage = new Page<>(new ArrayList<>(), null);
      return listRecursivelyInternal(accountName, containerName, blobNamePrefix, pageToken, maxKey, groupDirectories,
          initialAggregatedPage).thenApply(
          finalPage -> new Page<>(finalPage.getEntries(), finalPage.getNextPageToken()));
    }
Top-level recursive method to aggregate results from the underlying NamedBlobDb.list() API
 using S3 list objects semantics.
<p>
This method repeatedly invokes the underlying NamedBlobDb.list() API to retrieve pages of NamedBlobRecord
objects and recursively merges them into an aggregated Page until the aggregated Page contains at
most {@code maxKey} entries or no further pages exist. When grouping is enabled, entries are examined
via {@link #extractDirectory(String, String)} to form aggregated directory entries.
@param accountName      the account name.
@param containerName    the container name.
@param blobNamePrefix   the blob name prefix.
@param pageToken        the token for the first page (null for initial call).
@param maxKey           the maximum number of entries to accumulate.
@param groupDirectories flag indicating whether to group directories.
@return a CompletableFuture that, when complete, contains an immutable Page with at most maxKey entries
        and an appropriate nextPageToken.
ambry-frontend/src/main/java/com/github/ambry/frontend/NamedBlobListHandler.java