feat: port DefaultBlobWriteSessionConfig to work with HttpStorageOptions#2472
Merged
BenWhitehead merged 2 commits intomainfrom Mar 28, 2024
Merged
Conversation
| new LazyWriteChannel<>( | ||
| () -> { | ||
| final Map<StorageRpc.Option, ?> optionsMap = opts.getRpcOptions(); | ||
| BlobInfo.Builder builder = info.toBuilder().setMd5(null).setCrc32c(null); |
Contributor
There was a problem hiding this comment.
why do we need to set Md5 and CRC32C to null here?
Collaborator
Author
There was a problem hiding this comment.
This is replicated to follow the pattern of all the other write methods, for example
The reasoning why this is done, is due to the fact if the checksum is present in the object GCS will enforce it, and we only want to enforce it if the option crc32cMatch() or md5Match() are provided. At which point the files will be set back to non-null in the following line with opts.blobInfoMapper().apply(builder).build().
The usage pattern this enables is the read-modify-write of an object, i.e.
// assume storage.createFrom(info, Path.get("/file/on/disk/1")); created the current generation
Blob gen1 = storage.get(BlobId.of("bucket", "object"));
Blob gen2 = storage.createFrom(gen1, Paths.get("/file/on/disk/2"));
sydney-munro
approved these changes
Mar 27, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.