Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move list object API to java storage. #1083

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shilpi23pandey
Copy link
Contributor

No description provided.

@shilpi23pandey shilpi23pandey marked this pull request as draft December 13, 2023 10:20
@shilpi23pandey shilpi23pandey force-pushed the move-to-java-storage-list-objects branch from ee51416 to ddcfbfe Compare December 13, 2023 10:22
@@ -90,6 +105,17 @@ public class GoogleCloudStorageClientImpl extends ForwardingGoogleCloudStorage {
.setDaemon(true)
.build());

@Nullable
private static byte[] decodeMetadataValues(String value) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can considering somehow reusing the implementation rather then duplicating the code.

"listStorageObjectsInternal(%s, %s): item not found", resource, listOptions);
return null;
}
throw new IOException("Error listing " + resource, e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we include the e.message as well to the IOException message. Sometime some of the tools just log the message and skip the inner exception details.

"listStorageObjectsInternal(%s, %s): item not found", resource, listOptions);
return null;
}
throw new IOException("Error listing " + resource, e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Veneer would have retried, correct?

}

// Create inferred directory for the prefix object if necessary.
if (listOptions.isIncludePrefix()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code duplication. Is there a way to avoid this?

if (maxResults <= 0) {
return Long.MAX_VALUE;
}
return maxResults - blobs.size();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic is different from Apiary implementation. Why?

return maxResults - blobs.size();
}

private static BlobField getBlobField(String field) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this getting used?

List<BlobListOption> blobListOptions = new ArrayList<>();

blobListOptions.add(BlobListOption.pageSize(
maxResults <= 0 || maxResults >= storageOptions.getMaxListItemsPerCall()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why no use Math.min? It might be bit more readable.

byte[] md5Hash = null;
byte[] crc32c = null;

if (!isNullOrEmpty(blob.getCrc32c())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to avoid code duplication.

@shilpi23pandey shilpi23pandey force-pushed the move-to-java-storage-list-objects branch from ddcfbfe to 611f17f Compare December 19, 2023 10:12
@shilpi23pandey shilpi23pandey force-pushed the move-to-java-storage-list-objects branch from 611f17f to e99f850 Compare December 19, 2023 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants