| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e94c4e6 commit 356fb56
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,15 +26,13 @@ | |||
| 26 | 26 | import com.google.api.gax.rpc.HeaderProvider; | |
| 27 | 27 | import com.google.api.gax.tracing.ApiTracerFactory; | |
| 28 | 28 | import com.google.auth.Credentials; | |
| 29 | + import com.google.cloud.storage.Retrying.RetryingDependencies; | ||
| 29 | 30 | import com.google.cloud.ServiceFactory; | |
| 30 | 31 | import com.google.cloud.ServiceRpc; | |
| 31 | 32 | import com.google.cloud.TransportOptions; | |
| 32 | 33 | import com.google.cloud.http.HttpTransportOptions; | |
| 33 | 34 | import com.google.cloud.spi.ServiceRpcFactory; | |
| 34 | 35 | import com.google.cloud.storage.BlobWriteSessionConfig.WriterFactory; | |
| 35 | - import com.google.cloud.storage.Retrying.DefaultRetrier; | ||
| 36 | - import com.google.cloud.storage.Retrying.HttpRetrier; | ||
| 37 | - import com.google.cloud.storage.Retrying.RetryingDependencies; | ||
| 38 | 36 | import com.google.cloud.storage.Storage.BlobWriteOption; | |
| 39 | 37 | import com.google.cloud.storage.TransportCompatibility.Transport; | |
| 40 | 38 | import com.google.cloud.storage.spi.StorageRpcFactory; | |
@@ -407,15 +405,7 @@ public Storage create(StorageOptions options) { | |||
| 407 | 405 | blobWriteSessionConfig = HttpStorageOptions.defaults().getDefaultStorageWriterConfig(); | |
| 408 | 406 | } | |
| 409 | 407 | WriterFactory factory = blobWriteSessionConfig.createFactory(clock); | |
| 410 | - StorageImpl storage = | ||
| 411 | - new StorageImpl( | ||
| 412 | - httpStorageOptions, | ||
| 413 | - factory, | ||
| 414 | - new HttpRetrier( | ||
| 415 | - new DefaultRetrier( | ||
| 416 | - OtelStorageDecorator.retryContextDecorator(otel), | ||
| 417 | - RetryingDependencies.simple( | ||
| 418 | - options.getClock(), options.getRetrySettings())))); | ||
| 408 | + StorageImpl storage = new StorageImpl(httpStorageOptions, factory, options.createRetrier()); | ||
| 419 | 409 | return OtelStorageDecorator.decorate(storage, otel, Transport.HTTP); | |
| 420 | 410 | } catch (IOException e) { | |
| 421 | 411 | throw new IllegalStateException( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,12 +29,17 @@ | |||
| 29 | 29 | import com.google.cloud.storage.Storage.BlobWriteOption; | |
| 30 | 30 | import com.google.cloud.storage.TransportCompatibility.Transport; | |
| 31 | 31 | import com.google.cloud.storage.spi.StorageRpcFactory; | |
| 32 | + import com.google.common.annotations.VisibleForTesting; | ||
| 32 | 33 | import io.opentelemetry.api.OpenTelemetry; | |
| 33 | 34 | import java.io.IOException; | |
| 34 | 35 | import java.io.InputStream; | |
| 35 | 36 | import java.util.Locale; | |
| 36 | 37 | import java.util.Properties; | |
| 37 | 38 | import org.checkerframework.checker.nullness.qual.NonNull; | |
| 39 | + import com.google.cloud.storage.Retrying.DefaultRetrier; | ||
| 40 | + import com.google.cloud.storage.Retrying.HttpRetrier; | ||
| 41 | + import com.google.cloud.storage.Retrying.Retrier; | ||
| 42 | + import com.google.cloud.storage.Retrying.RetryingDependencies; | ||
| 38 | 43 | ||
| 39 | 44 | public abstract class StorageOptions extends ServiceOptions<Storage, StorageOptions> { | |
| 40 | 45 | ||
@@ -68,6 +73,13 @@ public abstract class StorageOptions extends ServiceOptions<Storage, StorageOpti | |||
| 68 | 73 | VERSION = tmp; | |
| 69 | 74 | } | |
| 70 | 75 | ||
| 76 | + Retrier createRetrier() { | ||
| 77 | + return new HttpRetrier( | ||
| 78 | + new DefaultRetrier( | ||
| 79 | + OtelStorageDecorator.retryContextDecorator(getOpenTelemetry()), | ||
| 80 | + RetryingDependencies.simple(getClock(), getRetrySettings()))); | ||
| 81 | + } | ||
| 82 | + | ||
| 71 | 83 | /** | |
| 72 | 84 | * @deprecated Use {@link HttpStorageFactory} | |
| 73 | 85 | */ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments