-
Notifications
You must be signed in to change notification settings - Fork 84
feat: introduce new BlobWriteSession #2123
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
Conversation
writer.newLazyWriteChannel().getSession(); | ||
return new DecoratedWritableByteChannelSession<>(session, d); | ||
} | ||
return CrossTransportUtils.throwGrpcOnly(DefaultStorageWriterConfig.class, ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should methodName be empty or writeSession
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. This is an internal only method that will never be on the public api. This error fall through is to catch if somehow someone does manage to call this in a way they shouldn't it will error.
google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITBlobWriteSessionTest.java
Outdated
Show resolved
Hide resolved
GrpcStorageOptions options, | ||
StorageClient storageClient, | ||
WriterFactory writerFactory, | ||
Opts<UserProject> defaultOpts) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it defaultOpts or globalOpts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both? If a UserProject opt is specified in one of the methods that will take precidence, if it isn't specified any possible value in here will be used.
this.chunkSize = chunkSize; | ||
} | ||
|
||
public int getChunkSize() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this include other properties such as upload_id and offset?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is the singleton instance that is used to configure all BlobWriteSessions for the whole client. If we were to expose uploadId & offset those would more likely become part of the session.
ce7ff3d
to
16d7363
Compare
When writing a new Blob to GCS, there are secondary session related state and actions which can't be represented by WriteChannel. BlobWriteSession provides a new construct to allow retrieving the resultant object which is created after the WritableByteChannel is closed. Along with the new session, configuration for this is now performed at the StorageOptions level where cross session considerations can influence the implementation of the returned session. The configurable option present for this new StorageWriterConfig is chunkSize. In the future new configurations will be added with their corresponding options. For example, in a future release it will be possible to change from in memory buffering to instead buffer to disk thereby reducing heap usage.
16d7363
to
7ad02f5
Compare
This comment was marked as outdated.
This comment was marked as outdated.
7ad02f5
to
48d96c5
Compare
When writing a new Blob to GCS, there are secondary session related state and actions which can't be represented by WriteChannel.
BlobWriteSession provides a new construct to allow retrieving the resultant object which is created after the WritableByteChannel is closed.
Along with the new session, configuration for this is now performed at the StorageOptions level where cross session considerations can influence the implementation of the returned session. The configurable option present for this new StorageWriterConfig is chunkSize. In the future new configurations will be added with their corresponding options.
For example, in a future release it will be possible to change from in memory buffering to instead buffer to disk thereby reducing heap usage.