diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/BidiBlobWriteSessionConfig.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/BidiBlobWriteSessionConfig.java index 06dd7e7a02..390c5abbc0 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/BidiBlobWriteSessionConfig.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/BidiBlobWriteSessionConfig.java @@ -17,19 +17,31 @@ package com.google.cloud.storage; import com.google.api.core.ApiFuture; -import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; import com.google.api.gax.grpc.GrpcCallContext; +import com.google.cloud.storage.DefaultBlobWriteSessionConfig.DecoratedWritableByteChannelSession; +import com.google.cloud.storage.DefaultBlobWriteSessionConfig.LazySession; +import com.google.cloud.storage.TransportCompatibility.Transport; import com.google.common.base.Preconditions; -import com.google.common.util.concurrent.MoreExecutors; import com.google.storage.v2.BidiWriteObjectRequest; import com.google.storage.v2.BidiWriteObjectResponse; import java.io.IOException; -import java.nio.channels.WritableByteChannel; import java.time.Clock; +import javax.annotation.concurrent.Immutable; -public class BidiBlobWriteSessionConfig extends BlobWriteSessionConfig +/** + * Perform a resumable upload, uploading at most {@code bufferSize} bytes each flush. + * + *
Configuration of buffer size can be performed via {@link
+ * BidiBlobWriteSessionConfig#withBufferSize(int)}.
+ *
+ * @since 2.34.0 This new api is in preview and is subject to breaking changes.
+ */
+@Immutable
+@BetaApi
+@TransportCompatibility({Transport.GRPC})
+public final class BidiBlobWriteSessionConfig extends BlobWriteSessionConfig
implements BlobWriteSessionConfig.GrpcCompatible {
private static final long serialVersionUID = -903533790705476197L;
@@ -54,7 +66,7 @@ public int getBufferSize() {
@Override
WriterFactory createFactory(Clock clock) throws IOException {
- return new Factory(ByteSizeConstants._16MiB);
+ return new Factory(bufferSize);
}
@InternalApi
@@ -124,57 +136,4 @@ public BidiBlobWriteSessionConfig withBufferSize(int bufferSize) {
ByteSizeConstants._256KiB);
return new BidiBlobWriteSessionConfig(bufferSize);
}
-
- private static final class DecoratedWritableByteChannelSession