Skip to content

Commit 83748e8

Browse files
committed
fix: update grpc bidi resumable uploads to validate ack'd object size
Follow up to #2527 Part 1, add tests and simulation server
1 parent a7b5fa2 commit 83748e8

File tree

3 files changed

+944
-4
lines changed

3 files changed

+944
-4
lines changed

google-cloud-storage/src/main/java/com/google/cloud/storage/GapicBidiUnbufferedWritableByteChannel.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,17 @@ final class GapicBidiUnbufferedWritableByteChannel implements UnbufferedWritable
6666
ResultRetryAlgorithm<?> alg,
6767
SettableApiFuture<BidiWriteObjectResponse> resultFuture,
6868
ChunkSegmenter chunkSegmenter,
69-
BidiResumableWrite requestFactory,
69+
BidiWriteCtx<BidiResumableWrite> writeCtx,
7070
Supplier<GrpcCallContext> baseContextSupplier) {
7171
this.write = write;
7272
this.deps = deps;
7373
this.alg = alg;
7474
this.baseContextSupplier = baseContextSupplier;
75-
this.bucketName = requestFactory.bucketName();
75+
this.bucketName = writeCtx.getRequestFactory().bucketName();
7676
this.resultFuture = resultFuture;
7777
this.chunkSegmenter = chunkSegmenter;
7878

79-
this.writeCtx = new BidiWriteCtx<>(requestFactory);
79+
this.writeCtx = writeCtx;
8080
this.responseObserver = new BidiObserver();
8181
}
8282

google-cloud-storage/src/main/java/com/google/cloud/storage/GapicBidiWritableByteChannelSessionBuilder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ BufferedWritableByteChannelSession<BidiWriteObjectResponse> build() {
155155
resultFuture,
156156
new ChunkSegmenter(
157157
boundHasher, boundStrategy, Values.MAX_WRITE_CHUNK_BYTES_VALUE),
158-
start,
158+
new BidiWriteCtx<>(start),
159159
Retrying::newCallContext))
160160
.andThen(c -> new DefaultBufferedWritableByteChannel(bufferHandle, c))
161161
.andThen(StorageByteChannels.writable()::createSynchronized));

0 commit comments

Comments
 (0)