Skip to content

Commit 58557a0

Browse files
committed
chore: rename RangeProjectionConfig -> ReadProjectionConfig
The method these configs are provided to is now named `readAs` instead of `readRange`. Update the base name to follow this. * RangeProjectionConfig -> ReadProjectionConfig * RangeProjectionConfigs -> ReadProjectionConfigs * RangeAsChannel -> ReadAsChannel * RangeAsFutureBytes -> ReadAsFutureBytes * RangeAsFutureByteString -> ReadAsFutureByteString * SeekableChannelConfig -> ReadAsSeekableChannel
1 parent c109fdb commit 58557a0

13 files changed

+139
-141
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public interface BlobReadSession extends AutoCloseable, Closeable {
3131
BlobInfo getBlobInfo();
3232

3333
@BetaApi
34-
<Projection> Projection readAs(RangeProjectionConfig<Projection> config);
34+
<Projection> Projection readAs(ReadProjectionConfig<Projection> config);
3535

3636
@Override
3737
@BetaApi

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public BlobInfo getBlobInfo() {
3939
// the return type.
4040
@SuppressWarnings({"rawtypes", "unchecked"})
4141
@Override
42-
public <Projection> Projection readAs(RangeProjectionConfig<Projection> config) {
42+
public <Projection> Projection readAs(ReadProjectionConfig<Projection> config) {
4343
Projection projection = session.readAs(config);
4444
if (projection instanceof ApiFuture) {
4545
ApiFuture apiFuture = (ApiFuture) projection;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ interface ObjectReadSession extends IOAutoCloseable {
2626

2727
Object getResource();
2828

29-
<Projection> Projection readAs(RangeProjectionConfig<Projection> config);
29+
<Projection> Projection readAs(ReadProjectionConfig<Projection> config);
3030
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import com.google.api.core.ApiFuture;
2222
import com.google.api.core.ApiFutures;
2323
import com.google.cloud.storage.GrpcUtils.ZeroCopyBidiStreamingCallable;
24-
import com.google.cloud.storage.RangeProjectionConfig.ProjectionType;
24+
import com.google.cloud.storage.ReadProjectionConfig.ProjectionType;
2525
import com.google.cloud.storage.RetryContext.RetryContextProvider;
2626
import com.google.common.annotations.VisibleForTesting;
2727
import com.google.storage.v2.BidiReadObjectRequest;
@@ -80,7 +80,7 @@ public Object getResource() {
8080
}
8181

8282
@Override
83-
public <Projection> Projection readAs(RangeProjectionConfig<Projection> config) {
83+
public <Projection> Projection readAs(ReadProjectionConfig<Projection> config) {
8484
lock.lock();
8585
try {
8686
checkState(open, "stream already closed");

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
import static com.google.common.base.Preconditions.checkState;
2020

21-
import com.google.cloud.storage.RangeProjectionConfigs.RangeAsChannel;
22-
import com.google.cloud.storage.RangeProjectionConfigs.SeekableChannelConfig;
21+
import com.google.cloud.storage.ReadProjectionConfigs.ReadAsChannel;
22+
import com.google.cloud.storage.ReadProjectionConfigs.ReadAsSeekableChannel;
2323
import com.google.common.base.Preconditions;
2424
import java.io.IOException;
2525
import java.nio.ByteBuffer;
@@ -31,9 +31,9 @@
3131
final class ObjectReadSessionSeekableByteChannel implements SeekableByteChannel, IOAutoCloseable {
3232

3333
private final ObjectReadSession session;
34-
private final SeekableChannelConfig config;
34+
private final ReadAsSeekableChannel config;
3535
private final long size;
36-
private final RangeAsChannel channelConfig;
36+
private final ReadAsChannel channelConfig;
3737
private final IOAutoCloseable closeAlongWithThis;
3838

3939
private ReadableByteChannel rbc;
@@ -44,14 +44,14 @@ final class ObjectReadSessionSeekableByteChannel implements SeekableByteChannel,
4444
@Nullable private RangeSpec lastRangeSpec;
4545

4646
ObjectReadSessionSeekableByteChannel(
47-
ObjectReadSession session, SeekableChannelConfig config, IOAutoCloseable closeAlongWithThis) {
47+
ObjectReadSession session, ReadAsSeekableChannel config, IOAutoCloseable closeAlongWithThis) {
4848
this.session = session;
4949
this.config = config;
5050
this.closeAlongWithThis = closeAlongWithThis;
5151
this.size = session.getResource().getSize();
5252
this.position = 0;
5353
this.channelConfig =
54-
RangeProjectionConfigs.asChannel()
54+
ReadProjectionConfigs.asChannel()
5555
.withCrc32cValidationEnabled(config.getCrc32cValidationEnabled());
5656
}
5757

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import com.google.cloud.storage.HmacKey.HmacKeyState;
3333
import com.google.cloud.storage.PostPolicyV4.PostConditionsV4;
3434
import com.google.cloud.storage.PostPolicyV4.PostFieldsV4;
35-
import com.google.cloud.storage.RangeProjectionConfigs.BaseConfig;
35+
import com.google.cloud.storage.ReadProjectionConfigs.BaseConfig;
3636
import com.google.cloud.storage.ResponseContentLifecycleHandle.ChildRef;
3737
import com.google.cloud.storage.RetryContext.OnFailure;
3838
import com.google.cloud.storage.RetryContext.OnSuccess;
@@ -1828,12 +1828,12 @@ public void copyChunk() {
18281828
}
18291829
}
18301830

1831-
private static final class OtelRangeProjectionConfig<Projection>
1832-
extends RangeProjectionConfig<Projection> {
1833-
private final RangeProjectionConfig<Projection> delegate;
1831+
private static final class OtelReadProjectionConfig<Projection>
1832+
extends ReadProjectionConfig<Projection> {
1833+
private final ReadProjectionConfig<Projection> delegate;
18341834
private final Span parentSpan;
18351835

1836-
private OtelRangeProjectionConfig(RangeProjectionConfig<Projection> delegate, Span parentSpan) {
1836+
private OtelReadProjectionConfig(ReadProjectionConfig<Projection> delegate, Span parentSpan) {
18371837
this.delegate = delegate;
18381838
this.parentSpan = parentSpan;
18391839
}
@@ -1945,16 +1945,16 @@ public BlobInfo getBlobInfo() {
19451945
}
19461946

19471947
@Override
1948-
public <Projection> Projection readAs(RangeProjectionConfig<Projection> config) {
1948+
public <Projection> Projection readAs(ReadProjectionConfig<Projection> config) {
19491949
Span readRangeSpan =
19501950
tracer
19511951
.spanBuilder("readAs")
19521952
.setAttribute("gsutil.uri", id.toGsUtilUriWithGeneration())
19531953
.setParent(blobReadSessionContext)
19541954
.startSpan();
19551955
try (Scope ignore2 = readRangeSpan.makeCurrent()) {
1956-
OtelRangeProjectionConfig<Projection> c =
1957-
new OtelRangeProjectionConfig<>(config, readRangeSpan);
1956+
OtelReadProjectionConfig<Projection> c =
1957+
new OtelReadProjectionConfig<>(config, readRangeSpan);
19581958
return delegate.readAs(c);
19591959
} catch (Throwable t) {
19601960
readRangeSpan.recordException(t);

google-cloud-storage/src/main/java/com/google/cloud/storage/RangeProjectionConfig.java renamed to google-cloud-storage/src/main/java/com/google/cloud/storage/ReadProjectionConfig.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818

1919
import com.google.api.core.BetaApi;
2020
import com.google.api.core.InternalExtensionOnly;
21-
import com.google.cloud.storage.RangeProjectionConfigs.BaseConfig;
21+
import com.google.cloud.storage.ReadProjectionConfigs.BaseConfig;
2222
import java.util.Locale;
2323

2424
@BetaApi
2525
@InternalExtensionOnly
26-
public abstract class RangeProjectionConfig<Projection> {
26+
public abstract class ReadProjectionConfig<Projection> {
2727

28-
RangeProjectionConfig() {}
28+
ReadProjectionConfig() {}
2929

3030
BaseConfig<Projection, ?> cast() {
3131
throw new UnsupportedOperationException(String.format("%s#cast()", this.getClass().getName()));

0 commit comments

Comments
 (0)