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

feat: update GrpcBlobReadChannel to allow seek/limit after read #1834

Merged
merged 2 commits into from Jan 12, 2023

Conversation

BenWhitehead
Copy link
Collaborator

Refactoring

Extract the majority of BlobReadChannelV2 to a new abstract base class BaseStorageReadChannel which effectively adapts a LazyReadChannel to a StorageReadChannel.

BaseStorageReadChannel now defines an abstract method newLazyReadChannel which each implementation is responsible for implementing to integrate into the lifecycle.

@BenWhitehead BenWhitehead added the owlbot:ignore instruct owl-bot to ignore a PR label Jan 9, 2023
@BenWhitehead BenWhitehead requested a review from a team as a code owner January 9, 2023 19:42
@product-auto-label product-auto-label bot added size: l Pull request size is large. api: storage Issues related to the googleapis/java-storage API. labels Jan 9, 2023
@BenWhitehead BenWhitehead force-pushed the grpc/read-channel/seek-after-read branch from c92ac2c to 3310f2c Compare January 9, 2023 19:42
Base automatically changed from chore/brs/endOffsetInclusive to main January 11, 2023 21:40
### Refactoring
Extract the majority of BlobReadChannelV2 to a new abstract base class BaseStorageReadChannel which effectively adapts a LazyReadChannel to a StorageReadChannel.

BaseStorageReadChannel now defines an abstract method newLazyReadChannel which each implementation is responsible for implementing to integrate into the lifecycle.
@BenWhitehead BenWhitehead force-pushed the grpc/read-channel/seek-after-read branch from 3310f2c to ce06f6f Compare January 11, 2023 21:42
Copy link
Member

@frankyn frankyn left a comment

Choose a reason for hiding this comment

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

I saw that the PR is mainly a refactor while enabling seek after read in gRPC; just have 2 follow-up questions otherwise LGTM.

}
} catch (IOException e) {
throw e;
} catch (Exception e) {
Copy link
Member

Choose a reason for hiding this comment

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

This is broad; is there a specific set of Exception types that are expected?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For grpc, the scope is more narrow, but for JSON there isn't really a common base since things can be socket issues, ssl issues or any other number of exceptions.

This catch is primarily here to guarantee we're always doing our best to present an actionable exception to whatever is catching.


protected abstract LazyReadChannel<T> newLazyReadChannel();

private void maybeResetChannel(boolean umallocBuffer) throws IOException {
Copy link
Member

Choose a reason for hiding this comment

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

what does umallocBuffer mean in this case; is it just to effectively delete the old buffer and start with a new one?

If that's the case, can you name it freeBuffer?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I'll rename to freeBuffer

@BenWhitehead BenWhitehead merged commit 45dc983 into main Jan 12, 2023
@BenWhitehead BenWhitehead deleted the grpc/read-channel/seek-after-read branch January 12, 2023 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/java-storage API. owlbot:ignore instruct owl-bot to ignore a PR size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants