Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: reduce visibility of the ConnectionPool and ConnectionWorker, so… #1954

Merged
merged 4 commits into from Jan 25, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -56,13 +56,13 @@ implementation 'com.google.cloud:google-cloud-bigquerystorage'
If you are using Gradle without BOM, add this to your dependencies:

```Groovy
implementation 'com.google.cloud:google-cloud-bigquerystorage:2.28.2'
implementation 'com.google.cloud:google-cloud-bigquerystorage:2.28.3'
```

If you are using SBT, add this to your dependencies:

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-bigquerystorage" % "2.28.2"
libraryDependencies += "com.google.cloud" % "google-cloud-bigquerystorage" % "2.28.3"
```

## Authentication
Expand Down
34 changes: 34 additions & 0 deletions google-cloud-bigquerystorage/clirr-ignored-differences.xml
Expand Up @@ -108,4 +108,38 @@
<className>com/google/cloud/bigquery/storage/v1/ConnectionWorkerPool</className>
<method>ConnectionWorkerPool(long, long, java.time.Duration, com.google.api.gax.batching.FlowController$LimitExceededBehavior, java.lang.String, com.google.cloud.bigquery.storage.v1.BigQueryWriteClient, boolean)</method>
</difference>
<difference>
<differenceType>1001</differenceType>
<className>com/google/cloud/bigquery/storage/v1/ConnectionWorker</className>
</difference>
<difference>
<differenceType>7009</differenceType>
<className>com/google/cloud/bigquery/storage/v1/ConnectionWorkerPool</className>
<method>ConnectionWorkerPool(long, long, java.time.Duration, com.google.api.gax.batching.FlowController$LimitExceededBehavior, java.lang.String, com.google.cloud.bigquery.storage.v1.BigQueryWriteClient, boolean)</method>
</difference>
<difference>
<differenceType>7009</differenceType>
<className>com/google/cloud/bigquery/storage/v1/ConnectionWorkerPool</className>
<method>com.google.api.core.ApiFuture append(com.google.cloud.bigquery.storage.v1.StreamWriter, com.google.cloud.bigquery.storage.v1.ProtoRows)</method>
</difference>
<difference>
<differenceType>7009</differenceType>
<className>com/google/cloud/bigquery/storage/v1/ConnectionWorkerPool</className>
<method>com.google.api.core.ApiFuture append(com.google.cloud.bigquery.storage.v1.StreamWriter, com.google.cloud.bigquery.storage.v1.ProtoRows, long)</method>
</difference>
<difference>
<differenceType>7009</differenceType>
<className>com/google/cloud/bigquery/storage/v1/ConnectionWorkerPool</className>
<method>void close(com.google.cloud.bigquery.storage.v1.StreamWriter)</method>
</difference>
<difference>
<differenceType>7009</differenceType>
<className>com/google/cloud/bigquery/storage/v1/ConnectionWorkerPool</className>
<method>void enableTestingLogic()</method>
</difference>
<difference>
<differenceType>7009</differenceType>
<className>com/google/cloud/bigquery/storage/v1/ConnectionWorkerPool</className>
<method>long getInflightWaitSeconds(com.google.cloud.bigquery.storage.v1.StreamWriter)</method>
</difference>
</differences>
Expand Up @@ -56,7 +56,7 @@
*
* <p>TODO: support updated schema
*/
public class ConnectionWorker implements AutoCloseable {
class ConnectionWorker implements AutoCloseable {
private static final Logger log = Logger.getLogger(StreamWriter.class.getName());

private Lock lock;
Expand Down
Expand Up @@ -21,6 +21,7 @@
import com.google.auto.value.AutoValue;
import com.google.cloud.bigquery.storage.v1.ConnectionWorker.Load;
import com.google.cloud.bigquery.storage.v1.ConnectionWorker.TableSchemaAndTimestamp;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.base.Stopwatch;
import com.google.common.collect.ImmutableList;
Expand Down Expand Up @@ -192,7 +193,7 @@ public abstract static class Builder {
/** Static setting for connection pool. */
private static Settings settings = Settings.builder().build();

public ConnectionWorkerPool(
ConnectionWorkerPool(
long maxInflightRequests,
long maxInflightBytes,
java.time.Duration maxRetryDuration,
Expand All @@ -218,13 +219,12 @@ public static void setOptions(Settings settings) {
}

/** Distributes the writing of a message to an underlying connection. */
public ApiFuture<AppendRowsResponse> append(StreamWriter streamWriter, ProtoRows rows) {
ApiFuture<AppendRowsResponse> append(StreamWriter streamWriter, ProtoRows rows) {
return append(streamWriter, rows, -1);
}

/** Distributes the writing of a message to an underlying connection. */
public ApiFuture<AppendRowsResponse> append(
StreamWriter streamWriter, ProtoRows rows, long offset) {
ApiFuture<AppendRowsResponse> append(StreamWriter streamWriter, ProtoRows rows, long offset) {
// We are in multiplexing mode after entering the following logic.
ConnectionWorker connectionWorker;
lock.lock();
Expand Down Expand Up @@ -371,7 +371,7 @@ private ConnectionWorker createConnectionWorker(String streamName, ProtoSchema w
* <p>The corresponding worker is not closed until there is no stream reference is targeting to
* that worker.
*/
public void close(StreamWriter streamWriter) {
void close(StreamWriter streamWriter) {
lock.lock();
try {
streamWriterToConnection.remove(streamWriter);
Expand Down Expand Up @@ -403,7 +403,7 @@ public void close(StreamWriter streamWriter) {
}

/** Fetch the wait seconds from corresponding worker. */
public long getInflightWaitSeconds(StreamWriter streamWriter) {
long getInflightWaitSeconds(StreamWriter streamWriter) {
lock.lock();
try {
ConnectionWorker connectionWorker = streamWriterToConnection.get(streamWriter);
Expand All @@ -422,7 +422,8 @@ TableSchemaAndTimestamp getUpdatedSchema(StreamWriter streamWriter) {
}

/** Enable Test related logic. */
public static void enableTestingLogic() {
@VisibleForTesting
static void enableTestingLogic() {
enableTesting = true;
}

Expand Down