Skip to content

Commit

Permalink
🦉 Updates from OwlBot post-processor
Browse files Browse the repository at this point in the history
  • Loading branch information
gcf-owl-bot[bot] committed Feb 16, 2024
1 parent 08d348c commit 983514a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 29 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ implementation 'com.google.cloud:google-cloud-storage'
If you are using Gradle without BOM, add this to your dependencies:

```Groovy
implementation 'com.google.cloud:google-cloud-storage:2.33.0'
implementation 'com.google.cloud:google-cloud-storage:2.34.0'
```

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

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-storage" % "2.33.0"
libraryDependencies += "com.google.cloud" % "google-cloud-storage" % "2.34.0"
```
<!-- {x-version-update-end} -->

Expand Down Expand Up @@ -428,7 +428,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-storage/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-storage.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-storage/2.33.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-storage/2.34.0
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,18 @@

import static com.google.cloud.storage.benchmarking.StorageSharedBenchmarkingUtils.generateCloudMonitoringResult;

import com.google.cloud.storage.Blob;
import com.google.cloud.storage.BlobInfo;
import com.google.cloud.storage.BlobWriteSession;
import com.google.cloud.storage.Bucket;
import com.google.cloud.storage.BucketInfo;
import com.google.cloud.storage.DataGenerator;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.Storage.BlobWriteOption;
import com.google.cloud.storage.it.runner.registry.Generator;
import java.io.PrintWriter;
import java.nio.ByteBuffer;
import java.nio.channels.WritableByteChannel;
import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;

class Bidi implements Callable<String> {
private final Storage storageClient;
Expand All @@ -44,7 +39,13 @@ class Bidi implements Callable<String> {
private final String api;
private final int workers;

Bidi(Storage storageClient, String bucketName, int objectSize, PrintWriter pw, String api, int workers) {
Bidi(
Storage storageClient,
String bucketName,
int objectSize,
PrintWriter pw,
String api,
int workers) {
this.storageClient = storageClient;
this.bucketName = bucketName;
this.objectSize = objectSize;
Expand All @@ -58,8 +59,7 @@ public String call() throws Exception {
String blobName = DataGenerator.base64Characters().genBytes(20).toString();
BlobWriteSession sess =
storageClient.blobWriteSession(
BlobInfo.newBuilder(bucketName, blobName).build(),
BlobWriteOption.doesNotExist());
BlobInfo.newBuilder(bucketName, blobName).build(), BlobWriteOption.doesNotExist());
byte[] bytes = DataGenerator.base64Characters().genBytes(objectSize);
Clock clock = Clock.systemDefaultZone();
Instant startTime = clock.instant();
Expand All @@ -77,10 +77,12 @@ public String call() throws Exception {
private void printResult(String op, BlobInfo created, Duration duration) {
pw.println(
generateCloudMonitoringResult(
op,
StorageSharedBenchmarkingUtils.calculateThroughput(
created.getSize().doubleValue(), duration),
created, api, workers)
op,
StorageSharedBenchmarkingUtils.calculateThroughput(
created.getSize().doubleValue(), duration),
created,
api,
workers)
.formatAsCustomMetric());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
import com.google.api.core.ListenableFutureToApiFuture;
import com.google.api.gax.retrying.RetrySettings;
import com.google.cloud.storage.BlobWriteSessionConfigs;
import com.google.cloud.storage.DataGenerator;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageOptions;
import com.google.cloud.storage.it.runner.registry.Generator;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
Expand Down Expand Up @@ -161,10 +159,11 @@ private void runWorkload1DirectPath() {
}

private void runWorkloadBidi() {
StorageOptions options = StorageOptions.grpc()
.setProjectId(project)
.setBlobWriteSessionConfig(BlobWriteSessionConfigs.bidiWrite())
.build();
StorageOptions options =
StorageOptions.grpc()
.setProjectId(project)
.setBlobWriteSessionConfig(BlobWriteSessionConfigs.bidiWrite())
.build();
Storage storageClient = options.getService();
try {
runBidi(storageClient);
Expand All @@ -175,10 +174,11 @@ private void runWorkloadBidi() {
}

private void runWorkloadNoBidi() {
StorageOptions options = StorageOptions.grpc()
.setProjectId(project)
.setBlobWriteSessionConfig(BlobWriteSessionConfigs.getDefault())
.build();
StorageOptions options =
StorageOptions.grpc()
.setProjectId(project)
.setBlobWriteSessionConfig(BlobWriteSessionConfigs.getDefault())
.build();
Storage storageClient = options.getService();
try {
runBidi(storageClient);
Expand Down Expand Up @@ -213,10 +213,13 @@ private void runW1R3(Storage storageClient) throws ExecutionException, Interrupt
private void runBidi(Storage storageClient) throws ExecutionException, InterruptedException {
ListeningExecutorService executorService =
MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(workers));
for(int i = 0; i < samples; i++) {
for (int i = 0; i < samples; i++) {
Range objectSizeRange = Range.of(objectSize);
int objectSize = getRandomInt(objectSizeRange.min, objectSizeRange.max);
convert(executorService.submit(new Bidi(storageClient, bucket, objectSize, printWriter, api, workers))).get();
convert(
executorService.submit(
new Bidi(storageClient, bucket, objectSize, printWriter, api, workers)))
.get();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package com.google.cloud.storage.benchmarking;

import com.google.cloud.storage.Blob;
import com.google.cloud.storage.BlobInfo;
import com.google.cloud.storage.Storage;
import java.time.Duration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ private void printResult(String op, Blob created, Duration duration) {
op,
StorageSharedBenchmarkingUtils.calculateThroughput(
created.getSize().doubleValue(), duration),
created.asBlobInfo(), api, workers)
created.asBlobInfo(),
api,
workers)
.formatAsCustomMetric());
}
}
Expand Down

0 comments on commit 983514a

Please sign in to comment.