Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Sophie Guo committed May 9, 2024
1 parent af687a7 commit edb6a51
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ default CompletableFuture<NamedBlobRecord> get(String accountName, String contai
* starting with the specified prefix or an exception if an error occurred.
*/
CompletableFuture<Page<NamedBlobRecord>> list(String accountName, String containerName, String blobNamePrefix,
String pageToken, String maxKey);
String pageToken, Integer maxKey);

/**
* Persist a {@link NamedBlobRecord} in the database.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ private Callback<Void> securityPostProcessRequestCallback() {
String maxKeys = getHeader(restRequest.getArgs(), MAXKEYS_PARAM_NAME, false);
CallbackUtils.callCallbackAfter(
namedBlobDb.list(namedBlobPath.getAccountName(), namedBlobPath.getContainerName(),
namedBlobPath.getBlobNamePrefix(), namedBlobPath.getPageToken(), maxKeys), listBlobsCallback());
namedBlobPath.getBlobNamePrefix(), namedBlobPath.getPageToken(),
maxKeys == null ? null : Integer.parseInt(maxKeys)), listBlobsCallback());
}, uri, LOGGER, finalCallback);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public CompletableFuture<NamedBlobRecord> get(String accountName, String contain

@Override
public CompletableFuture<Page<NamedBlobRecord>> list(String accountName, String containerName, String blobNamePrefix,
String pageToken, String maxKey) {
String pageToken, Integer maxKey) {
if (exception != null) {
return FutureUtils.completedExceptionally(exception);
}
Expand Down Expand Up @@ -113,7 +113,7 @@ public CompletableFuture<Page<NamedBlobRecord>> list(String accountName, String

NamedBlobRecord record = recordList.get(recordList.size() - 1).getFirst();
long deleteTs = recordList.get(recordList.size() - 1).getSecond().getSecond();
int maxKeysValue = maxKey == null ? listMaxResults : Integer.parseInt(maxKey);
int maxKeysValue = maxKey == null ? listMaxResults : maxKey;
if (numRecords++ == maxKeysValue) {
nextContinuationToken = record.getBlobName();
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public CompletableFuture<NamedBlobRecord> get(String accountName, String contain

@Override
public CompletableFuture<Page<NamedBlobRecord>> list(String accountName, String containerName, String blobNamePrefix,
String pageToken, String maxKeys) {
String pageToken, Integer maxKeys) {
return executeTransactionAsync(accountName, containerName, true, (accountId, containerId, connection) -> {
long startTime = this.time.milliseconds();
Page<NamedBlobRecord> recordPage =
Expand Down Expand Up @@ -624,10 +624,10 @@ private NamedBlobRecord run_get_v2(String accountName, String containerName, Str
}

private Page<NamedBlobRecord> run_list_v2(String accountName, String containerName, String blobNamePrefix,
String pageToken, short accountId, short containerId, Connection connection, String maxKeys) throws Exception {
String pageToken, short accountId, short containerId, Connection connection, Integer maxKeys) throws Exception {
String query = "";
String queryStatement = blobNamePrefix == null ? LIST_ALL_QUERY_V2 : LIST_QUERY_V2;
int maxKeysValue = maxKeys == null ? config.listMaxResults : Integer.parseInt(maxKeys);
int maxKeysValue = maxKeys == null ? config.listMaxResults : maxKeys;
try (PreparedStatement statement = connection.prepareStatement(queryStatement)) {
statement.setInt(1, accountId);
statement.setInt(2, containerId);
Expand Down

0 comments on commit edb6a51

Please sign in to comment.