Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ public WritableByteChannelSession<?, BlobInfo> writeSession(
grpc.startResumableWrite(grpcCallContext, req);
return ResumableMedia.gapic()
.write()
.byteChannel(grpc.storageClient.writeObjectCallable())
.byteChannel(
grpc.storageClient
.writeObjectCallable()
.withDefaultCallContext(grpcCallContext))
.setHasher(Hasher.noop())
.setByteStringStrategy(ByteStringStrategy.copy())
.resumable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ public GrpcBlobWriteChannel writer(BlobInfo blobInfo, BlobWriteOption... options
// 3. wrap the result in another future container before constructing the BlobWriteChannel
ApiFuture<ResumableWrite> wrapped = ApiFutures.immediateFuture(resumableWrite);
return new GrpcBlobWriteChannel(
storageClient.writeObjectCallable(),
storageClient.writeObjectCallable().withDefaultCallContext(grpcCallContext),
getOptions(),
retryAlgorithmManager.idempotent(),
() -> wrapped,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.api.core.InternalApi;
import com.google.api.gax.grpc.GrpcCallContext;
import com.google.api.gax.rpc.ApiExceptions;
import com.google.api.gax.rpc.ClientStreamingCallable;
import com.google.cloud.storage.Conversions.Decoder;
import com.google.cloud.storage.RecoveryFileManager.RecoveryVolumeSinkFactory;
import com.google.cloud.storage.Storage.BlobWriteOption;
Expand All @@ -34,6 +35,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.storage.v2.ServiceConstants.Values;
import com.google.storage.v2.WriteObjectRequest;
import com.google.storage.v2.WriteObjectResponse;
import java.io.IOException;
import java.io.ObjectInputStream;
Expand Down Expand Up @@ -184,16 +186,20 @@ public WritableByteChannelSession<?, BlobInfo> writeSession(
if (storage instanceof GrpcStorageImpl) {
GrpcStorageImpl grpcStorage = (GrpcStorageImpl) storage;
RecoveryFile recoveryFile = recoveryFileManager.newRecoveryFile(info);
GrpcCallContext grpcCallContext =
opts.grpcMetadataMapper().apply(GrpcCallContext.createDefault());
ApiFuture<ResumableWrite> f =
grpcStorage.startResumableWrite(
GrpcCallContext.createDefault(), grpcStorage.getWriteObjectRequest(info, opts));
grpcCallContext, grpcStorage.getWriteObjectRequest(info, opts));
ApiFuture<WriteCtx<ResumableWrite>> start =
ApiFutures.transform(f, WriteCtx::new, MoreExecutors.directExecutor());

ClientStreamingCallable<WriteObjectRequest, WriteObjectResponse> write =
grpcStorage.storageClient.writeObjectCallable().withDefaultCallContext(grpcCallContext);
BufferedWritableByteChannelSession<WriteObjectResponse> session =
ResumableMedia.gapic()
.write()
.byteChannel(grpcStorage.storageClient.writeObjectCallable())
.byteChannel(write)
.setHasher(Hasher.noop())
.setByteStringStrategy(ByteStringStrategy.copy())
.journaling()
Expand Down